Step 1: The Core Request
All payments are created by sending aPOST
request to the Process Transaction endpoint. The request body must contain required fields that are common to all payment methods, plus a payment_method
object with specific fields for your chosen payment method.
Basic Request Structure
Every payment request to the Process Transaction endpoint follows this structure:Field | Type | Description |
---|---|---|
operation_type | string | Must be "payment" to process a payment transaction. |
amount | decimal | Transaction amount using a dot as decimal separator (e.g., 100.00 ). |
currency | string | Transaction currency. Currently only "MXN" (Mexican Peso) is supported. |
customer | object | Customer information containing at minimum name (string) and email (string). |
payment_method | object | Payment method configuration with a type field and method-specific parameters. |
client_reference | string | Your unique transaction identifier for reconciliation and tracking purposes. |
Depending on the payment method you choose, additional fields may be required inside the
payment_method
object (for example: card details, SPEI, OXXO, etc.). For detailed information about each payment method and their specific requirements, see the section below or the Payment Methods Overview.Step 2: Processing Different Payment Methods
To process a specific payment method, you change thetype
inside the payment_method
object and provide any required additional fields. The examples below show how to process different payment methods.
Credit/Debit Card Payment
Credit/Debit Card Payment
To process a card payment, set the A successful card payment response will have a status of For cards that require extra security, see the guide for creating a payment with 3DS.
type
to CARD
and provide the tokenized card details. Here’s an example request:authorized
and includes the transaction details:Card Payment Response
SPEI Bank Transfer
SPEI Bank Transfer
To let a customer pay via a SPEI transfer, set the A successful SPEI response will have a status of
type
to SPEI
. The API will generate payment instructions for the customer. Here’s an example request:SPEI Bank Transfer
pending
and includes payment instructions for the customer:SPEI Payment Response
OXXO Cash Payment
OXXO Cash Payment
To generate a voucher for a cash payment at an OXXO store, set the A successful OXXO response will have a status of
type
to oxxopay
. Here’s an example request:OXXO Cash Payment
pending
and includes payment instructions with a barcode and reference for the customer:OXXO Payment Response
Step 3: Handling the Response
After you send the request, the API will respond immediately with the initial status of the transaction. Thestatus
field can have one of the following values:
Status | Description |
---|---|
pending | Transaction is being processed (common for asynchronous payments) |
on_hold | Transaction is temporarily held for review |
processing | Transaction is being processed by the payment provider |
sent_to_provider | Transaction has been sent to the payment provider |
success | Transaction completed successfully |
paid_full | Payment has been fully processed and settled |
in_transit | Funds are in transit to your account |
authorized | Payment has been authorized (common for card payments) |
canceled | Transaction was canceled before completion |
declined | Payment was declined by the provider |
rejected | Transaction was rejected |
failed | Transaction failed to process |
expired | Transaction expired before completion |
Unknown | Status is unknown or unclear |
Validation of
id
and status
fieldsFor proper payment validation, you must check:id
is the unique transaction identifier - store this for future reference.status
is the current payment state - determines next actions.
status
field in your response and implement appropriate logic based on the status value received.
The table below details the fields that are returned in the response:
Field | Type | Description |
---|---|---|
id | string | Unique transaction identifier |
operation_type | string | Always "payment" |
status | string | Transaction status |
amount | decimal | Transaction amount |
currency | string | Currency code |
client_reference | string | Your reference identifier |
payment_id | integer | Internal payment ID |
transaction_id | string | Provider transaction ID |
provider | string | Payment provider used |
created_at | string | ISO 8601 timestamp |
status_code | integer | HTTP status code |
next_action | object | Required actions (3DS, redirects) |
Synchronous vs. Asynchronous Payments
Bear in mind that different payment methods have different response flows.- Card Payments are typically synchronous. You will get a final status (
authorized
ordeclined
) in the initial API response. - SPEI and OXXO Payments are asynchronous. The initial status will be
pending
because they require the customer to take further action. You must use Webhooks or poll the transaction status endpoint to know when the payment is completed.
Step 4: Check the Transaction Status
For asynchronous payments, or if you need to confirm the final status of any transaction, you can query the transaction status using the Get Transaction Status endpoint with theid
from the payment response:
cURL
success
, failed
, expired
). Always validate both the id
and status
fields in the response.
Next Steps
- Try creating a payment with 3D Secure for enhanced card security.
- Explore creating payments with card tokens to securely store and reuse customer payment methods.
- Set up webhooks to receive real-time notifications when payment statuses change.