One-Click Checkout
This guide allows you to achieve a significant speedup of the checkout process by re-using the data a customer entered for a previous transaction/registration. It's based on one of these two guides:
After the customer account details are stored, as part of the initial transaction/registration, you will need to keep a record of the associated registration IDs (token) that you can then use in step 1 below.
How it works
1. Prepare the checkout
NOTE: For demonstration purposes we have created a registration, which will be used in your one-click checkout, with id(s): 8ac7a4a0739e4f720173a048387d7a7c,8ac7a49f739e470f0173a048391e1c24. Following the guides above, you may add additional registrations options to the checkout.
First perform a server-to-server POST request to prepare the checkout, this should include the registration IDs of the customer as shown below.
The registration IDs should be sent in the registrations[n].id
parameter, where n is a sequence number from zero, incrementing for each of the customer's registration IDs. For example, if the customer has two accounts on file, you would send registrations[0].id = {first registration.id}
and registrations[1].id = {second registration.id}
.
Response:
2. Create the payment form
Then, to show the payment form you just need to add the following lines of HTML/Javascript to your page and populating the following variables
The checkout's
id
that you got in the response from step 1The
shopperResultUrl
, which is the page on your site where the customer should be redirected to after the payment is processed and the brands that will be available.
When Primeiro Pay builds up the payment form it automatically fetches the registrations data from the server and displays the pre-filled widgets to the shopper.
Require CVVShow initial payment from
html
css
js
result
3. Get the payment status
As usual, once the payment has been processed, the customer is redirected to your shopperResultUrl
along with a GET parameter resourcePath
.
IMPORTANT: The baseUrl must end in a "/", e.g. "https://test.oppwa.com/".
Then, to get the status of the payment, you should make a GET request to the baseUrl + resourcePath
, including your authentication parameters.
Example for a resourcePath:
https://test.oppwa.com/v1/checkouts//payment
We recommend that you verify the following fields from the Payment Status response, by comparing the returned values with expected:
ID(s)
Amount
Currency
Brand
Type
Last updated