Getting started: single payment

Three steps are required for integrating a payment form on the merchant website:

  • Initialize the embedded form
  • Display the embedded form
  • Check the transaction status and the end of payment

The following diagram presents the interactions between the different actors (embedded form, merchant server, payment gateway) at each of these stages:

1. Initializing the form

Before displaying a new payment form on the merchant website, you must initialize the form by generating a formToken that summarizes all the payment related options.

In order to create a formToken, you must call the Charge/CreatePayment REST Web Service via your server:

Step Description
1 Call to the Charge/CreatePayment REST Web Service via merchant servers.
2 Reception of the result containing the formToken.

The formToken is valid for 15 minutes.

See the list of use cases that will help you initialize your form.

2. Displaying the form

To display the payment form, you must include our JavaScript library in the header of your payment page.

It is imperative for the main library to be loaded very early on, well before the other JS libraries used on your page:

The formToken is to be added to the integration code. It will be used by the JavaScript library to display the form using the formToken defined in the previous step:

Step Description
3 Download of the JavaScript library. Request made via the Buyer's browser.
4 Retrieval of JavaScript, then display of the page containing the payment form.

For a website using a JavaScript framework (Angular, React, Vue.js, etc.), the concept is slightly different: see Single Page Checkout.

Once the form is displayed, the buyer can enter their bank details. If the payment is rejected, the buyer stays on the merchant website. If the payment is accepted, the transaction details are sent to the merchant server.

3. Checking the transaction status

When the transaction is accepted or the maximum number of attempts has been reached, the JavaScript client POSTs the payment form. It is made in exactly the same way as for a classic HTML form. You retrieve the payment information in the POST parameters sent to your server.

Step Description
5 The Buyer has clicked the “pay” button: submission of the form via the Buyer’s browser to our servers. This call is made automatically by our JavaScript client.
6 Once the transaction has been processed, we make a call via our servers to the URL specified by you. The complete Transaction object will be sent to allow you to update your information system before the browser return. The IPN (Instant Payment Notification).
7 Our servers return the payment result to the JavaScript client.
8 The JavaScript client POSTs the payment form to your servers.

For dynamic websites (that use AngularJS, React or Vue.js), it is also possible to retrieve payment details in JavaScript: Single-page application.

Processing the IPN allows you to update your information system more securely and guarantees that you will not lose any payments if the Buyer loses their Internet connection. For more information, see the article IPN: Presentation.

Let’s get started!

After this theoretical part, it is time to move on to the practical steps and Create a formToken.