Direct API
With the Direct API, the whole payment experience happens on your website. You build both the payment method selection page and the checkout page, and the customer completes the payment without being redirected to PayRetailers. It gives you full control of the design, in exchange for a bigger implementation effort.
How it compares
| Paywall | Hosted Payment Pages | Direct API | |
|---|---|---|---|
| Payment method selection page | Hosted by PayRetailers | Built by you | Built by you |
| Payment method checkout page | Hosted by PayRetailers | Hosted by PayRetailers | Built by you |
| Customer is redirected | Yes | Yes, after selecting a method | No |
| Endpoints used | Create Paywall | Get Payment Methods + Create Transaction | Create Transaction + Get Landing Info |
| Implementation effort | Low | Medium | High |
Choose the Direct API when you want the customer to stay on your site for the whole payment and you can build and maintain your own checkout pages.
Two features, depending on the payment method
The Direct API is made of two different features. Which one you use depends on the type of payment method:
| Get Landing Info | Direct API JavaScript Library | |
|---|---|---|
| Payment methods | Alternative payment methods (bank transfers, QR, cash vouchers, wallets) | Credit cards |
| Countries | Argentina, Brazil, Colombia, Mexico and Peru (see the list below) | Mexico only |
| What you get | The payment instructions, references, QR codes and logos as data, to display on your own checkout page | A card payment form that you embed on your page |
| Where to start | This page | Direct API JavaScript Library |
The rest of this page covers Get Landing Info.
Before you start
- You have your Shop ID and Secret Key. See Authentication.
- Your server IP addresses are whitelisted by PayRetailers.
- You have a public HTTPS endpoint to receive Notifications (
notificationUrl). - The payment methods you want to offer support Get Landing Info (see Supported payment methods).
Direct API flow
Direct API flow
1. Create the transaction
When the customer has selected a payment method on your site, call Create Transaction from your server with that method, the amount and currency, the customer's details and your notificationUrl. To build the list of methods, you can use Get Payment Methods, as in Hosted Payment Pages.
The transaction is created with status PENDING. Instead of redirecting the customer to the checkout URL returned in the response, keep the transaction ID (uid) and continue with the next step.
2. Get the payment instructions
Call Get Landing Info with the transaction ID. The response contains everything the PayRetailers checkout page would show for that transaction:
| Block | What it contains |
|---|---|
amount, currency | The amount and currency to pay. |
expirationDate | The date and time until which the customer can pay. |
references | The data the customer needs to pay, such as a payment reference, key or account number. |
instructions | The payment steps, already written in the transaction's language. |
qrCodes | The QR code or barcode, when the method uses one, as an image and as raw data. |
links | Additional links for the payment method, such as the return URL. |
logos | The logo of the payment method. |
See Landing Info Response for the full description of each field.
3. Display the instructions on your checkout page
Show the customer, with your own design:
- The amount and the payment deadline.
- The references, with a copy button, so the customer can paste them in their banking app.
- The QR code or barcode, if there is one.
- The payment steps, in the order they are returned.
- The payment method's logo, so the customer recognises it.
The customer then pays from their banking app, wallet or at a cash point, following your page.
4. Confirm the result
The transaction follows the standard transaction flow, and PayRetailers sends notifications to your notificationUrl.
Confirm the payment before fulfilling the orderMany methods (cash, bank transfer) are paid hours or days after the instructions are shown. Always confirm the final status from the notification or with Get Transaction by UID before releasing goods or crediting balance.
Supported payment methods
Get Landing Info is currently available for the following payment methods. For any other method, redirect the customer to the checkout URL returned by Create Transaction, as in Hosted Payment Pages.
| Country | Payment methods |
|---|---|
| Argentina | QR Code, Pago Fácil, Rapipago, MODO, Alias |
| Brazil | PIX, PicPay, Boleto Rápido |
| Colombia | Efecty, Bre-B |
| Mexico | SPEI |
| Peru | Yape, Plin, Interbank, BBVA, Scotiabank, QR, PagoEfectivo |
This list is not the same as the methods supported by Landing Info Customisation. That feature brands the PayRetailers checkout page; Get Landing Info lets you build your own.
Good to know
- Instructions expire. Show the payment deadline (
expirationDate) clearly and offer the customer a new payment if it has passed. - Use the QR data that suits you. You can display the QR image as it is, or generate it yourself from the raw data.
- Keep a fallback. If Get Landing Info fails, you can still redirect the customer to the checkout URL returned by Create Transaction, so the sale is not lost.
Related
Updated about 5 hours ago