PrimeiroPay
Search…
Copy and Pay

1. Prepare the checkout

First, perform a server-to-server POST request to prepare the checkout with the required data, including the order type, amount and currency. The response to a successful request is a JSON string with an id, which is required in the second step to create the payment form.
curl https://test.oppwa.com/v1/checkouts \
-d "entityId=8a8294184e736012014e78a17a5615ac" \
-d "amount=92.00" \
-d "currency=EUR" \
-d "paymentType=DB" \
-H "Authorization: Bearer OGE4Mjk0MTg0ZTczNjAxMjAxNGU3OGExN2E2YTE1YjB8ZjJGRUtacXRCUA=="
For a full list of parameters that can be sent in the prepare checkout request, please see the API Reference
Please note that for a HTTP POST request all the parameters are expected to go into the message body and not into the URL.

2. Create the payment form

To create 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" data-brands="VISA MASTER AMEX"></form>
View the customization guide for more information on customizing the payment form.
A checkout id expires when a payment has been finalized successfully by user, but not later than 30 minutes. Before it expires, it can be used multiple times in order to retrieve a valid payment form. This can occur for example when a user does not finish a payment and reloads the page, or uses the back button of the browser. Therefore you don't have to generate a new checkout ID in such scenarios. However be aware that such cases can generate multiple transactions in the system, for example one (or more) failed and another one successful, based on the same checkout id.

3. Get the payment status

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 of a resourcePath:
resourcePath=/v1/checkouts/{checkoutId}/payment
Once a status response is successful the checkout identifier can't be used anymore. In this case the Transaction Reports endpoint can be used to get the transaction status using the payment id.
curl -G https://test.oppwa.com/v1/checkouts/{id}/payment \
-d "entityId=8a8294184e736012014e78a17a5615ac" \
-H "Authorization: Bearer OGE4Mjk0MTg0ZTczNjAxMjAxNGU3OGExN2E2YTE1YjB8ZjJGRUtacXRCUA=="
IMPORTANT: A throttling rule applies for get payment status calls. Per checkout, it is allowed to send two get payment requests in a minute.
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