Process an online SPEI purchase or payout using pay by bank.
You can submit a SPEI transaction in these ways:
- Purchase (deposit): Create a pay-by-bank transaction with
apmProviderset toSpeiandintentset toPurchase. Redirect the shopper tofundingData.payByBank.redirectUrlso they can complete the transfer. - Payout (withdrawal), new bank account: Create a pay-by-bank transaction with
intentset toPayoutand supply all three ofbankAccountNumber,bankCode, andaccountType. Don't also sendgatewayTokenId. CapturefundingData.payByBank.gatewayTokenIdfrom the response to reuse the destination later. - Payout (withdrawal), stored bank account: Create a payout and supply
gatewayTokenIdfrom an earlier accepted payout instead of resending bank details.
SPEI supports MXN only and shoppers in Mexico (countryCode MX). Treat merchant webhooks as the authoritative final outcome. Don't treat the shopper's browser return from the hosted page as payment confirmation. Learn more about webhooks.
Use the following request to start a SPEI deposit. Send the shopper to the redirectUrl returned in the response.
{ "merchant": "MERCHANT-1", "site": "SITE-1", "merchantTransactionId": "SPEI-TXN-001", "merchantTransactionDate": "2024-01-27T08:51:02.826445+00:00", "transactionMethod": { "intent": "Purchase", "entryType": "Ecom", "fundingType": "PayByBank" }, "fundingData": { "payByBank": { "apmProvider": "Spei", "language": "ES" } }, "amounts": { "transaction": 100, "currencyCode": "MXN" }, "shopper": { "id": "Shopper_MX_01", "firstName": "Juan", "lastName": "Garcia", "dateOfBirth": "1990-01-01", "email": "juan.garcia@example.com", "countryCode": "MX", "documentType": "TaxIdNumber", "documentNumber": "HEGJ850101ABC", "phoneNumber": "+5215555555555" } }
| Parameter | Description |
|---|---|
merchantstring (≤ 10 characters) required | Your unique merchant identifier, as assigned by PXP. |
sitestring (≤ 50 characters) required | Your unique site identifier, as assigned by PXP. |
merchantTransactionIdstring (≤ 50 characters) required | A unique identifier for this transaction. |
merchantTransactionDatedate-time required | The date and time when the transaction happened, in ISO 8601 format. |
transactionMethodobject required | Details about the transaction method. |
transactionMethod.entryTypestring required | The entry type. For e-commerce SPEI transactions, this is always Ecom. |
transactionMethod.fundingTypestring required | The funding type. For SPEI, this is always PayByBank. |
transactionMethod.intentstring required | The payment intent. For a SPEI deposit, set this to Purchase. Learn more about intents. |
amountsobject required | Details about the transaction amount. |
amounts.transactionnumber | The transaction amount. The numbers after the decimal will be zero padded if they are less than the expected currencyCode exponent. For example, GBP 1.1 = GBP 1.10, EUR 1 = EUR 1.00, or BHD 1.3 = 1.300. The transaction will be rejected if numbers after the decimal are greater than the expected currencyCode exponent (e.g., GBP 1.234), or if a decimal is supplied when the currencyCode exponent does not require it (e.g., JPY 1.0). |
amounts.currencyCodestring (1-3 characters) required | The currency code associated with the transaction, in ISO 4217 format. For SPEI, this must be MXN. |
fundingDataobject required | Details about the payment method used for the transaction. For SPEI, use the Pay by bank funding shape only. |
fundingData.payByBankobject required | Pay by bank funding details for SPEI. |
fundingData.payByBank.apmProviderstring required | The APM provider. For SPEI, this must be Spei. Values are case-sensitive PascalCase. |
fundingData.payByBank.languagestring | The language code for the hosted SPEI experience. Purchase only. Omit on payout. |
fundingData.payByBank.bankAccountNumberstring | An optional destination CLABE or bank account number for the purchase. |
fundingData.payByBank.bankCodestring | An optional destination bank code for the purchase. |
fundingData.payByBank.successRedirectUrlstring | An optional URL where the shopper is returned after a successful hosted SPEI purchase. Omit on payout. |
fundingData.payByBank.failureRedirectUrlstring | An optional URL where the shopper is returned after a failed hosted SPEI purchase. Omit on payout. |
shopperobject required | Details about the shopper making the payment. |
shopper.countryCodestring (2 characters) required | The shopper's country, in ISO 3166-1 alpha-2 format. For SPEI, this must be MX. |
shopper.documentTypestring required | The shopper identity document type. For SPEI, use TaxIdNumber (RFC) or CivilRegisterId (CURP). When supplied, documentNumber is also required. |
shopper.documentNumberstring required | The shopper identity document number. Exactly 13 alphanumeric characters for TaxIdNumber, or exactly 18 for CivilRegisterId. |
shopper.phoneNumberstring required | The shopper's phone number in E.164 format (e.g., +5215555555555). |
If your request is successful, you'll receive a 200 response. fundingData.payByBank.apmProvider is always Spei. Optional fields under fundingData.payByBank are omitted when they have no value, rather than returned as null.
For a successful SPEI purchase initiation, expect a Pending state, a populated fundingData.payByBank.redirectUrl, plus paymentId and processorPaymentId when known. For a successful SPEI payout initiation, expect Pending with no redirectUrl, plus paymentId, processorPaymentId, and gatewayTokenId when each is stored. On payout, status is omitted until the status poll completes.
fundingData.payByBank.status is the raw, unmapped provider status. Use the top-level mapped state for the transaction outcome.
The final outcome is delivered by a SPEI merchant webhook (e.g., spei-transaction-order-executed). Learn more about webhooks.
Always use the systemTransactionId for later PXP API calls against the same transaction. Provider payment identifiers (providerTransactionId, fundingData.payByBank.paymentId, and fundingData.payByBank.processorPaymentId) are for reconciliation and support only. When both are present, providerTransactionId and fundingData.payByBank.processorPaymentId carry the same value.
{ "state": "Pending", "systemTransactionId": "1ed768bb-e88a-4636-91ae-67927ccbb02b", "merchantTransactionDate": "2024-01-27T08:51:02.826Z", "merchantTransactionId": "SPEI-TXN-001", "providerTransactionId": "9a4c7e21-3f5d-4b8e-8a1c-2d3e4f5a6b7c", "fundingData": { "payByBank": { "apmProvider": "Spei", "redirectUrl": "https://hosted-payment-page.example/spei/...", "paymentId": "6f2b6d0a-8b1a-4e2b-9c3d-0a1b2c3d4e5f", "processorPaymentId": "9a4c7e21-3f5d-4b8e-8a1c-2d3e4f5a6b7c" } } }
SPEI supports a full refund only. Set fundingType to PayByBank, apmProvider to Spei, and currencyCode to MXN. The refund response returns fundingData.payByBank with apmProvider, paymentId, and processorPaymentId only. Use the shared Refund guide for the request shape and webhook confirmation.