One Click Checkout

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

Prepare the checkout

Send the request parameters server-to-server to prepare the payment form.

Create the payment form

Display the payment form on your checkout page

Get the payment status

Find out if the payment was successful


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): 8a82944a5fa67f48015fce9c2b6c5a1e,8a8294495fa65eba015fce9c2d85285e. 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}.

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 1
    <script src="https://test.oppwa.com/v1/paymentWidgets.js?checkoutId={checkoutId}"></script>
  • The 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.
    <form action="{shopperResultUrl}" class="paymentWidgets">VISA MASTER AMEX</form>

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 CVV
Show initial payment from

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:

resourcePath=/v1/checkouts/{checkoutId}/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