# OXXO
source: https://developer.mastercard.com/mastercard-gateway/documentation/payment-methods/alt-pay-methods/vouchers/oxxo/index.md

OXXO is a payment method that is used only in Mexico. Customers can use OXXO to pay utility bills and make online purchases. The e-commerce customers can generate payment vouchers and pay these vouchers in cash at OXXO branches across Mexico.

The API support is available for OXXO browser payments for transactions in Mexican Pesos (MXN) from Gateway version 56 and later.

OXXO is a supported browser payment method in the Mastercard Gateway. This page describes integration details specific to OXXO. It is recommended that you read the [integration guidelines for browser payments](https://developer.mastercard.com/mastercard-gateway/documentation/payment-methods/imp-brow-pay-int/index.md), before building an OXXO integration.

## Understanding the OXXO payment process {#understanding-the-oxxo-payment-process}

These are the stages of making OXXO payments.

The payer,

1. Selects OXXO as the payment method on the checkout page.  

   The payments are detailed displays on the checkout page screen.

2. Print the payment receipt.

3. Pays the purchase amount at the OXXO location.

   Warning: After the payment, you receive a notification, and the goods are shipped to the payer.

   <br />

## Prerequisites {#prerequisites}

To offer OXXO as a payment method through the Mastercard Gateway:

* Be registered with your browser payments service provider.
* Your merchant profile on the gateway must be configured using the details of your account with the browser payments service provider.
* You must have a bank account in one of the supported currencies registered against your merchant account at your browser payments service provider.

## OXXO Integration {#oxxo-integration}

#### OXXO through Hosted Checkout {#oxxo-through-hosted-checkout}

OXXO through Hosted Checkout will be available soon. Contact your payment service provider for further information.

#### OXXO through Direct Payment {#oxxo-through-direct-payment}

Direct Payment integration allows you to offer OXXO payment method on your own checkout page.
Alert: OXXO is supported from Mastercard Gateway API version 56 and later.

In addition to the [standard fields](https://developer.mastercard.com/mastercard-gateway/documentation/payment-methods/imp-brow-pay-int/index.md#browser-payments-through-direct-payment-integration) required in a browser payment request, provide the following fields in the [Initiate Browser Payment](https://developer.mastercard.com/mastercard-gateway/documentation/api-reference/v100/rest/api-ops/index.md#browser-payment) request:

### Common fields {#common-fields}

* `sourceOfFunds.type` = OXXO
* `browserPayment.operation` = PAY (the Authorize operation is not supported by OXXO)
* `customer.email`: The email address of the payer.
* `sourceOfFunds.provided.oxxo.bankAccountHolder`: The name of the bank account holder for the payer's bank account.

For **MXN currency (OXXO domestic) transactions ONLY**, provide the following additional fields:

* sourceOfFunds.provided.oxxo.dueDate: The date by which the payer has to make the payment. If you do not provide a value, the default date will be today plus three days.

#### Preferred Language {#preferred-language}

You can set the language that you prefer OXXO to use for pages displayed to the payer by providing the `browserPayment.preferredLanguage` field in the Initiate Browser Payment request. However, the language will be used only if OXXO supports it.

### Sample Code to Initiate OXXO Payment for Domestic Transactions {#sample-code-to-initiate-oxxo-payment-for-domestic-transactions}

```json
{
  "apiOperation": "INITIATE_BROWSER_PAYMENT",
  "browserPayment": {
    "operation": "PAY",
    "returnUrl": "https://<return_url>"
  },
  "customer": {
    "email": "john.smith@example.com"
  },
  "order": {
    "amount": "10.00",
    "currency": "MXN"
  },
  "sourceOfFunds": {
    "type": "OXXO",
    "provided": {
      "oxxo": {
        "bankAccountHolder": "John Smith",
        "dueDate": "2021-04-01"
      }
    }
  }
}
```

## How to Interpret the Transaction Result {#how-to-interpret-the-transaction-result}

The table below shows the transaction Response Codes for the possible scenarios that you may encounter after initiating an OXXO payment.

|                     Initiate Browser Payment Response                     |                                                                                                                 What This Means...                                                                                                                 |
|---------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `response.gatewayCode`=SUBMITTED `result`=SUCCESS                         | Redirect the payer using the URL provided in the response.                                                                                                                                                                                         |
| **Retrieve Transaction/Retrieve Order Response**                          | **What This Means...**                                                                                                                                                                                                                             |
| `response.gatewayCode`=APPROVED `result`=SUCCESS                          | The payment is successful.                                                                                                                                                                                                                         |
| `response.gatewayCode`=PENDING `result`=PENDING                           | The Mastercard Gateway is waiting for a notification from the acquirer about the payment result. Try `RETRIEVE_TRANSACTION` again later or listen to notifications from the Mastercard Gateway.                                                    |
| `response.gatewayCode`=CANCELLED `result`=FAILURE                         | The payer has canceled the interaction for this payment. Offer the payer the option to try another payment method.                                                                                                                                 |
| `response.gatewayCode`=DECLINED or ACQUIRER_SYSTEM_ERROR `result`=FAILURE | The payment was declined. Offer the payer the option to try another payment method. In the case of an ACQUIRER_SYSTEM_ERROR you may want to inquire with the acquirer the reason for payment failure, or you can try `RETRIEVE_TRANSACTION` again. |
| `response.gatewayCode`=TIMED_OUT `result`=FAILURE                         | Treat this as a declined payment. The Mastercard Gateway will attempt to ensure that the transaction is not successful or will revert the transaction.                                                                                             |

## Testing your Integration {#testing-your-integration}

The Mastercard Gateway provides a browser payments emulator that allows you to ***test your OXXO integration***.
