Skip to content

SPEI transaction

Process an online SPEI purchase or payout using pay by bank.

Overview

You can submit a SPEI transaction in these ways:

  • Purchase (deposit): Create a pay-by-bank transaction with apmProvider set to Spei and intent set to Purchase. Redirect the shopper to fundingData.payByBank.redirectUrl so they can complete the transfer.
  • Payout (withdrawal), new bank account: Create a pay-by-bank transaction with intent set to Payout and supply all three of bankAccountNumber, bankCode, and accountType. Don't also send gatewayTokenId. Capture fundingData.payByBank.gatewayTokenId from the response to reuse the destination later.
  • Payout (withdrawal), stored bank account: Create a payout and supply gatewayTokenId from 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.

Initiate a SPEI transaction

POST
/v1/transactions

Request examples

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" } }
ParameterDescription
merchant
string (≤ 10 characters)
required
Your unique merchant identifier, as assigned by PXP.
site
string (≤ 50 characters)
required
Your unique site identifier, as assigned by PXP.
merchantTransactionId
string (≤ 50 characters)
required
A unique identifier for this transaction.
merchantTransactionDate
date-time
required
The date and time when the transaction happened, in ISO 8601 format.
transactionMethod
object
required
Details about the transaction method.
transactionMethod.entryType
string
required
The entry type. For e-commerce SPEI transactions, this is always Ecom.
transactionMethod.fundingType
string
required
The funding type. For SPEI, this is always PayByBank.
transactionMethod.intent
string
required
The payment intent. For a SPEI deposit, set this to Purchase. Learn more about intents.
amounts
object
required
Details about the transaction amount.
amounts.transaction
number
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.currencyCode
string (1-3 characters)
required
The currency code associated with the transaction, in ISO 4217 format. For SPEI, this must be MXN.
fundingData
object
required
Details about the payment method used for the transaction. For SPEI, use the Pay by bank funding shape only.
fundingData.payByBank
object
required
Pay by bank funding details for SPEI.
fundingData.payByBank.apmProvider
string
required
The APM provider. For SPEI, this must be Spei. Values are case-sensitive PascalCase.
fundingData.payByBank.language
string
The language code for the hosted SPEI experience. Purchase only. Omit on payout.
fundingData.payByBank.bankAccountNumber
string
An optional destination CLABE or bank account number for the purchase.
fundingData.payByBank.bankCode
string
An optional destination bank code for the purchase.
fundingData.payByBank.successRedirectUrl
string
An optional URL where the shopper is returned after a successful hosted SPEI purchase. Omit on payout.
fundingData.payByBank.failureRedirectUrl
string
An optional URL where the shopper is returned after a failed hosted SPEI purchase. Omit on payout.
shopper
object
required
Details about the shopper making the payment.
shopper.countryCode
string (2 characters)
required
The shopper's country, in ISO 3166-1 alpha-2 format. For SPEI, this must be MX.
shopper.documentType
string
required
The shopper identity document type. For SPEI, use TaxIdNumber (RFC) or CivilRegisterId (CURP). When supplied, documentNumber is also required.
shopper.documentNumber
string
required
The shopper identity document number. Exactly 13 alphanumeric characters for TaxIdNumber, or exactly 18 for CivilRegisterId.
shopper.phoneNumber
string
required
The shopper's phone number in E.164 format (e.g., +5215555555555).

Response examples

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.