The Widget integration (column / tab or Lightbox mode), takes place in only 3 steps :
- Initialization of payment : from your server you use the doWebPayment function of Web Payment API to initiate a payment on Payline payment pages.
- From web page, add a script and <DIV> tag in body of your web page : Payline will use that tag to display the payment form.
- Payment Result : from your server you use the getWebPaymentDetails function of Web Payment API to get payment result.
The minimum HTML page for generating a payment form is as follows:
data-token="the token obtained in doWebPayment Response"
The HTML file of the payment page must contain, at a minimum, in the HEAD the links to the static resources of the widget corresponding to the desired environment (approval, production):
And possibly a link to your own CSS, in a relative fashion.
The data-token is the session token for authentication and is obtained in response to the request to initialize a payment (doWebPayment). In order to avoid that a new initialization is performed during each refresh of the page, you must either use a session on your server to store it, or check if the current URL already contains a payment token in a GET parameter named paylinetoken. Here is an example to reuse the token present in the URL:
<?php $paylineToken = ( is_empty($_GET['paylinetoken']) ) ? createNewWebPayment() : $_GET['paylinetoken']; ?>
Additional attributes that you can use in the <div> tag allow you to customize the display of the form. For example; if you do not want the payment form to appear automatically when your page is displayed :
|The name of the template to use for initializing the form.|
|Defines whether the form should initialize as soon as the web page has finished loading (auto-init to "true"), or if it must wait for an initialization request (auto-init to "false")|
The parameter allows you to specify a return url for a defined list of partners, for now: AmazonPay
When the buyer clicks on the AmazonPay button, he is redirected to the partner to authenticate. Once authenticated, it is redirected to the specified URL.
|<div id="PaylineWidget" |
Examples of integration of Widget modes
According to the parameters, here are the examples of integration :
|InShop Tab mode ||InShop Column mode ||LightBox mode ||Shortcut mode |
Payline forces column page display of payment pages when you use tab mode and the size of the device used by the consumer is too small to display properly. This enhancement simplifies your technical integration when you have a "responsive desktop / mobile" store.
When a form is requested with several means of payment, some of which are conditioned by the return of a partner API, then:
- If the partner answers before the display of the form then the means of payment are displayed according to the partners' response;
- If the partner responds after displaying the form then the inserts of the conditioned means of payment are displayed only with a Spinner while waiting for the partner's response.
The order in which the payment methods are displayed is carried out with the order specified in the contractList tag of the doWebPayment.
Customizing the style of the payment form is possible by overriding the stylesheet provided by default by Payline. Consult the CSS customaton.
Expense management functions
The cost management is present on the payment form and corresponds to the Transaction insert:
Administration center: Payment method to configure
Administration center: Details of a transaction
The cost management excludes in the following cases:
- Wallet payment
- ShortCut payment
- Rec / NX payment