The customization functions of the Widget in lightbox mode and in-shop mode (tab / column). For the merchant to follow the evolution of the widget in his page, Payline offers Callback. These Callbacks will be called by the widget as it runs synchronously. To use these callbacks, the marketer uses the usual mechanism for setting the widget, the data- * attributes in the PaylineWidget div. The passed value must correspond to a classic JavaScript function, declared in the Window scope, as in the following example: Bloc de code |
---|
| <html>
<head>
<!-- Import from widget, ... -->
<script>
function maFonction() {
// Actions to do
}
</script>
</head>
<body>
<div id="PaylineWidget" data-token="123" data-event-nomdeletape="maFonction"/>
</body>
</html> |
In the previous example, the function "myFunction" will be called when the life cycle of the widget reaches the step "chunkname".
The steps for which you can specify a Callback are: Callback ID | Description | Parameters | Return values | From version |
---|
data-embeddedredirectionallowed | Set to 'false' to prevent the ACS 3DS from being embedded in iframe in the Widget, and force a redirection to it. This makes it possible to test the two use cases (3DS via iframe or via redirection). | true / false |
|
| data-event-willinit | The widget has loaded on the browser and is about to initialize.. |
|
| 4.46.1 | data-event-willshow | The widget has made its first initialization and is about to appear. This event occurs before the widget has recovered from the server. |
|
| 4.46.1 | data-event-finalstatehasbeenreached | The widget will show the user an end state (where no more interaction is possible) to the buyer. | The name of the state reaches. Example of a past object: Bloc de code |
---|
{
state: "PAYMENT_SUCCESS"
} |
Voir § suivant pour toutes les valeurs possibles | If the callback of the merchant returns then the widget will not handle the new state. | 4.46.1 | data-event-didshowstate | The widget has recovered its status from the server and displayed the result. | The name of the state that appeared Example of a past object : Bloc de code |
---|
{
state: "PAYMENT_METHODS_LIST"
} |
See below for all possible values. |
| 4.49 | data-event-willdisplaymessage | Manage the message display | The callback can take as argument a complex object of the form: Bloc de code |
---|
{ id: [l'id du champ message], type: [le type de message (voir les
valeurs possibles), key: [la clé du message à afficher (voir les valeurs
possibles)], message: [le message] } |
Possible values for the "type": success, info, error, warn. | - TRUE: the widget behavior is not changed, ie the widget will still display the message
- FALSE: the behavior of the widget is impacted, the widget will not display the message
| 4.50 | data-event-willremovemessage | Management of the withdrawal of the message | The callback can take as argument a complex object of the form: Bloc de code |
---|
{ id: [l'id du champ message] } |
| - TRUE: the behavior of the widget is not changed, ie the widget will still remove the message;
- FALSE: the behavior of the widget is impacted, the widget will not remove the message.
| 4.50 | data-event-beforepayment | Event when clicking the Pay button, after the data validation and before Payline completes the transaction. Then Payline triggers the final eventStateHasBeenReached? The event can be triggered several times during a payment session, for example when the buyer clicks on the Wallet and he has to enter the CVV and then clicks a second time on Pay. Then the event will have been triggered twice. The merchant must be able to manage the idempotency of this event. The event is not raised during a call to Payline.Api.finalizeShortcut () |
Bloc de code |
---|
<div id="PaylineWidget"
data-token="1fe9zY4eaJo0VPJSM1571456927334471"
data-template="lightbox"
data-event-beforepayment="myBusinessFunction">
</div>
<script>
function myBusinessFunction()
{ -- Check values
-- Provisioning
-- If Provisioning OK return true
-- Return false }
</script> |
| - TRUE: triggered payment
- FALSE: secure payment
| 4.54.1 |
The set of possible values for the "state" property of the objects passed in parameter by the callbacks: ID Status | Description | Final | Release |
---|
PAYMENT_METHODS_LIST | The payment session is valid and the list of payment methods is displayed. | No |
| PAYMENT_CANCELED | The session was invalidated at the request of the merchant and a failure message is displayed. | Yes |
| PAYMENT_SUCCESS | The payment session is over and a ticket is displayed. | Yes |
| PAYMENT_FAILURE | The payment session is over and a failure message is displayed. | Yes |
| PAYMENT_FAILURE_WITH_RETRY | The payment session is over, a failure message is displayed along with a button proposing to use another payment method. | No |
| TOKEN_EXPIRED | The payment session is complete, a failure message is displayed indicating the expiration of the payment session. | Yes |
| BROWSER_NOT_SUPPORTED | The browser is detected as incompatible, a screen offers the buyer to switch to the classic payment pages. | Yes |
| PAYMENT_METHOD_NEEDS_MORE_INFOS | The means of payment selected by the user indicates that it is necessary to confirm information (CV for wallet, validation of credit file etc ..). | No |
| PAYMENT_REDIRECT_NO_RESPONSE | The payment request completed in redirection request (3DS authentication, partner such as Paypal). | No |
| MANAGE_WEB_WALLET | Same PAYMENT_METHOD_LIST but for the management of the portfolios. | No |
| ACTIVE_WAITING | A payment has been started and new information is expected to continue | No | 4.51 | PAYMENT_CANCELED_WITH_RETRY | The buyer has canceled his payment, either via our pages or via the pages of a partner on which he was redirected, but he has the possibility to choose a new means of payment | No | 4.51 | PAYMENT_ONHOLD_PARTNER | The payment method will answer us later, we indicate to the buyer that he will get the answer from the merchant | Yes | 4.51 | PAYMENT_SUCCESS_FORCE_TICKET_DISPLAY | The buyer has successfully completed his payment, and automatic redircetion is disabled (ticket display) | Yes | 4.51 | PAYMENT_METHODS_LIST_SHORTCUT | The buyer is on the list of shortcut payment method | No | 4.51 | PAYMENT_TRANSITIONAL_SHORTCUT | The intermediate state after a shortcut request (getting buyer data: buyer, shippingAddress, billingAddress via API JS) | No | 4.51 |
|