> ## Documentation Index
> Fetch the complete documentation index at: https://developers.epayclub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SPEI

> Collect bank transfer payments from customers using Mexico’s SPEI interbank system.

Accept payments from Mexican customers using SPEI (Sistema de Pagos Electrónicos Interbancarios), Mexico's real-time interbank transfer system. Customers complete the transaction by transferring funds from their own bank account using the details you present to them.

<Info>
  This payment method only supports one-time (non-recurring) payments. It is available for MXN transactions to customers in Mexico.
</Info>

## Payment flow

Several steps occur between creating the order and completing the SPEI charge.

1. [Create an order](#creating-the-order) with the customer's information.
2. [Encrypt](/api-basics/encryption) and send the pay order request.
3. [Redirect](#completing-the-payment) the customer to complete the SPEI transfer.
4. Confirm the payment and inform the customer of its outcome.

### Creating the Order

Follow the standard [create order](/orders/create-orders) flow, setting `customer.mobile` to the customer's Mexican phone number and `customer.country` to `MX`.

```json theme={null}
{
   "customer":{
      "firstname":"Ana",
      "lastname":"García",
      "mobile":"+521234567890",
      "country":"MX",
      "email":"ana@example.com"
   },
   "order":{
      "amount":250,
      "reference":"40cac2b6-6793-489a-8c96-c97a18b3c58a",
      "description":"Deposit via SPEI",
      "currency":"MXN"
   }
}
```

### Initiating the Payment

Encrypt the order reference and `paymentoption` before sending it to the pay order [endpoint](/api-reference/orders/pay).

<CodeGroup>
  ```json Example (Unencrypted) theme={null}
  {
      "reference": "40cac2b6-6793-489a-8c96-c97a18b3c58a",
      "paymentoption": "SPEI"
  }
  ```

  ```json Example (Encrypted) theme={null}
  {
    "data": "B9pQJ1HoxybgfjNnEro+26w7lQZ6jriF3AFiUeGH2Ggacn6cF0srUlqiHEXeEncJcMw6ThDobjuS+AsmvhNfvGPGMddjbt5rcK2JrUnUI4cHk0XebJKoNnjEqivcyq0UKEMdYOLd6mYZtvKu5FMlpz0Lo0aMY49pnYvUGLSsCf/wOhlPx9PHgQDXptT+WBJcO3lzeD8O0S4IVSWPCWPLi7GhGlqhZpheEi1FHq39TCHk12hL3sqkkIktZIkkQVAe8AkwZGhy/CMJZrTzU6IXZr2ulT7mJenZljSk66m0pARcUqwMw/+5PEPECDo8SX3IkX2hmym02pGuWZeHE9ONWcaW7h8UIroQ/+kThz/RtP/UMiK3596cij66JcW+RcXKPiqNKysskcnaOlQFIFuhEiAczimLgd320RrQzehaw1C33UGsCzAG1p2EnDthjTF63BZtEhVlu9kN7qtFCz9AvojZeaZFKOxpJJ0usfwl9Hq5oAa56AFt/3IIsvqrAktTOyMgQ/jGQ6uhRYpA6UAH0CcYyv7L99hgVtRTXAxA/rpCtY7aTR9Pjxb5Lt1IV0Q1V8fWxAv0yY+ss07qeiSIsccsdJiN4LaMx3RvmDlu54XF68w51L34hOCDj/NBoPVUZrSaCJK2GPJ6CjOHI8q2/U2TkU+y+a80XCAC/rgqGhw="
  }
  ```
</CodeGroup>

Upon receiving your request, we will return a successful response with a redirect URL for our hosted SPEI payment page.

```json 200 OK [expandable] theme={null}
{
    "data": {
        "paymentDetail": {
            "redirectUrl": "https://checkout-widget.epayclub.com/apm/PGW-PAYREF-CFE5A0D0D31B4E54AABAAD89F123F422",
            "recipientAccount": null,
            "paymentReference": "CP1B3F264C-8DB1-47C1-A50E-6494FB927D51"
        },
        "bankTransferDetails": null,
        "orderPayment": {
            "orderId": 628,
            "orderPaymentReference": "PGW-PAYREF-CFE5A0D0D31B4E54AABAAD89F123F422",
            "currency": "MXN",
            "statusId": 2,
            "orderPaymentResponseCode": "02",
            "orderPaymentResponseMessage": "pending-authentication",
            "orderPaymentInstrument": null,
            "remarks": "Order payment initiated",
            "totalAmount": 250.00,
            "fee": 0.00
        }
    },
    "status": "success",
    "statusCode": "02",
    "message": "pending-authentication"
}
```

### Completing the Payment

Redirect the customer to `paymentDetail.redirectUrl`. This takes them to our hosted SPEI payment page, where we present the bank name, CLABE account number, and reference the customer needs to complete the transfer from their own bank's app or website. This is an offline, asynchronous payment method — the transfer isn't instant, and we'll notify you once it's confirmed.

### Verifying the Payment

<Info>
  [Read](/orders/verify-orders) the transaction verification section to learn how to verify your SPEI transactions.
</Info>

## Testing your integration

<Warning>
  Kindly [contact](mailto:support@epayclub.com) the support team to enable SPEI testing on your account.
</Warning>

Follow these guidelines to successfully test your SPEI integration:

1. Use a MXN order currency — SPEI is only available for MXN transactions.
2. Set `customer.country` to `MX` when creating the order.
3. Expect the transaction to remain in a pending state until the simulated/test bank transfer is confirmed — SPEI is not an instant confirmation method like PIX.
