### Would you like to contact support?

No momento, esta página não está disponível em inglês

# OXXO for API only

Add OXXO to an existing API-only integration.

Accept OXXO payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.

## Before you begin

These instructions explain how to add OXXO to your existing API-only integration. The API-only integration works the same way for all payment methods. If you haven't done this integration yet, refer to our API-only integration guide.

1. Make sure that you have set up your back end implementation.

## Build your payment form for OXXO

To show OXXO in your payment form, you need to:

1. Show OXXO as an available payment method.

2. Pass the following data to your server:

## Make a payment

• amount: The currency and value of the amount due.
• reference: Your reference to uniquely identify a payment. This reference is used in all communication with you about the payment status.
• paymentMethod.type: oxxo.
• returnUrl: The URL to return to after the voucher is created.
• merchantAccount: Your unique merchant account identifier, with which you want to process the transaction.
• countryCode: The country code for the payment method, in this case MX.

/payments request
curl https://checkout-test.adyen.com/v68/payments \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
"amount": {
"currency": "MXN",
"value": 30000
},
"reference": "YOUR_ORDER_NUMBER",
"paymentMethod": {
"type": "oxxo"
},
"returnUrl": "https://your-company.com/...",
"merchantAccount": "YOUR_MERCHANT_ACCOUNT",
"countryCode": "MX"
}'

The /payments response with action.type voucher contains:

• resultCode: PresentToShopper
• action: Object containing information about the voucher:

• alternativeReference: This reference is a short version of the barcode number of the voucher.
• expiresAt: The date and time when the due date expires.
• initialAmount: The currency and value of the amount due.
• instructionsUrl: Link to instructions on how to pay.
• merchantName: The name of your company.
• merchantReference: The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status.
• paymentMethodType: This will state oxxo.
• reference: The barcode number of the voucher.
• totalAmount: The currency and value of the amount due.
/payments response
{
"resultCode": "PresentToShopper",
"action": {
"alternativeReference": "59570565678234",
"expiresAt": "2019-10-12T00:00:00",
"initialAmount": {
"currency": "MXN",
"value": 30000
},
"merchantName": "YOUR_MERCHANT_NAME",
"merchantReference": "YOUR_ORDER_NUMBER",
"paymentMethodType": "oxxo",
"reference": "59595705656782342019101200903004",
"totalAmount": {
"currency": "MXN",
"value": 30000
},
"type": "voucher"
}
}

## Present the voucher

Use the information in the action object in the /payments response to present the voucher to the shopper.

• action.instructionUrl: Link to the instructions how to pay.
• action.expiresAt: The date and time when the due date expires.
• action.reference: The barcode number for the payment.
• action.totalAmount: The currency and value of the amount due.

Make sure you show the voucher and an option to copy the barcode number. The shopper can then print the voucher and pay in cash at an OXXO store.

You can create and present a custom voucher, for example when you want to customize the look and feel of the voucher. The only restriction is the barcode. To generate the barcode to show on the voucher, you have to use the number from the action.reference field in the /payments response, and the generated barcode must be of the type Code-128.

## Present the payment result

Use the resultCode that you received in the /payments response to inform your shopper of the payment status.

The resultCode value you can receive for OXXO is:

resultCodeDescriptionAction to take
PresentToShopperPresent the voucher.After you present the voucher to the shopper, inform the shopper that you are waiting for the payment to be completed.

## Test and go live

OXXO is an offline payment method. This means that there is time between the shopper receiving the voucher and the actual processing of the payment.

When you create the voucher, it is shown as an offer in your Customer Area, with an Open status. If you set up PENDING notifications specifically for OXXO, you receive a notification for pending OXXO voucher payments.

When the shopper pays the voucher at an OXXO store, the payment will be processed. The offer becomes a sale and the status changes to Received. You will receive the final result of the payment in an AUTHORISATION notification. This all happens automatically in a live environment, but you can test this process in your Customer Area.

In the test environment, you can simulate an OXXO payment by promoting the pending payment to a sale.