SPEI

Learn how to accept SPEI, a common payment method in Mexico.

SPEI® is a system developed and operated by Banco de México that allows the general public, in a matter of seconds, to make electronic payments, also called electronic transfers, via a bank, the Internet, or mobile banking. This system allows money to be transferred electronically between bank deposit accounts almost instantly.

Payment typeBank transfer
MarketMexico
Customers currenciesMXN
Processing currenciesMXN
Settlement currenciesEUR
RefundsYes
PayoutYes

Step 1. Make a transaction request

From your server, make a POST /payment_preauthorize request.

https://sandbox.payabl.com/pay/backoffice/payment_preauthorize

Include in the request parameters below:

🚧

The below parameters are mandatory for SPEI.

  • merchantid: The merchant identification number.
  • orderid: The field orderid is optional and exclusively for the merchant's convenience.
  • amount: The amount field contains the transaction’s total amount. This is the amount that will be transmitted to the authorizing system.
  • currency: The currency field contains the alphanumeric currency code for the transaction, according to ISO 4217, e.g. MXN.
  • payment_method: The payment method id - 130 (or 126 if instructed by tech support).
  • signature: The signature field contains a 40-figure hexadecimal value. This signature value is a checksum designed to protect the merchant account from unauthorized access.
  • email: The customer's email address.
  • custom2: The name of payment method - spei.
  • nationalid: Consumer’s national id, has to satisfy the following regular expression: RFC: 13 chars, ex: MAMB780915969; CURP: 18 chars.
  • nationaltype: User's identification type RFC or CURP.
    You can see a full list of parameters in Pre-Authorization.

Request example

/pay/backoffice/payment_preauthorize&merchantid=gateway_test&amount=23&currency=MXN&orderid=Payabl-Test
&language=en&gender=&lastname=Mann&street=Office+11A,+Swepco+Court,+Griva+Digeni+80&zip=60322&
city=Frankfurt&country=DEU&customerid=&salutation=&title=&firstname=Muster&company=&birthday=&house=&
postbox=&state=&[email protected]&phone=&fax=&mobile=&customerip=&custom1=&custom2=SPEI&custom3=&
url_return=http://dev-sim-ng.inatec.local/~simdad/InatecResponse/redirect_response.php&url_success=
http://dev-sim-ng.inatec.local/~simdad/InatecResponse/success.php&url_failed=http://dev-sim-ng.inatec.
local/~simdad/InatecResponse/failed.php&notification_url=https://api.powercash.de/simulation/billing_
response.php&payment_method=130&nationaltype=RFC&nationalid=MAMB780915969&subject=test+subject&
content=test+content&signature=4938f36364571ddeeb80fa1d61b011a801b5ffbe

Step 2. Handle the redirect

To complete the payment, you need to redirect the customer to the correct URL in the response.

Response

transactionid=105352762&transid=105352762&status=2000&errormessage=pending&errmsg=pending&amount=23&
price=23&currency=MXN&orderid=Payabl-Test&user_id=787410&redirect_url=https://checkout-test.pagsmile.
com/checkout?prepay_id=VVYwNzVPZEhKV1VSdjU5akl4QkhxOHhKZWxUTDJ0YWJKTlROR3daditQYz0=-5a1e6537

Step 3. Transaction states

If the customer successfully completed the transaction, you will receive a notification with confirmation.

Notification example (successful transaction):

type=capture&orderid=Payabl-Test&errorcode=0&errormessage=&security=036e1050afc9f18ada82e923e39d45ec29
df31c8e7a7295e06378e08c434ca5d&transactionid=105352762&payment_method=130&timestamp=1693227607&
payment_state=credited

If the customer initiated the transaction but didn't finalize it, you will receive a failed notification.

Notification example with error:

errorcode=-66183&errormessage=Wrong+national+type&security=98eb1dbce3c3075fa371217d5ef705b862dbe6c3429
6ed0b06d5f8afd4d7ba01&timestamp=1693227169&transactionid=105352759&type=order&orderid=Payabl-Test

Refunds

The method allows merchants to refund full or partial amount of initial transaction via wire transfer. In order for this to be done, the merchant needs to initiate refund request, and customer will receive email with link where he should specify payment information to receive refund. Merchant needs to specify email of the customer, that he could receive email.

Refund will be processed after customer submitted payment data.

Request example

backoffice/payment_refund&merchantid=andrei&transactionid=215458995&amount=1¤cy=MXN&language=en&
external_id=en&signature=8b5d75824db2a85be4d9f98f68bfe900a527b8ee

Response example

transactionid=215458995&transid=215458995&status=0&errormessage=&errmsg=&amount=1.00&price=1.00&
currency=MXN&orderid=Payabl-Test

Payouts

The method allows merchants to send funds to a bank account via wire transfer. In order for this to be done, the merchant needs to submit the bank details of the customer.

Include in a request:

  • currency: MXN
  • account: Customer's account number, 10 ~ 18 digits
  • document_id: Customer's id
  • document_type: Customer's identification type, one of RFC or CURP
  • bankcountry:MEX
  • bank_code: bank code, see below
  • method: spei
  • account_type: Should be one of debit | phone | clabe
FieldValue FormatAccepted Values
merchantidString[A-Z][0-9]
amountFloat0.00
currencyStringMXN
orderidString[0-9]
languageStringen
lastnameString[A-Z]
streetString*
zipString[A-Z][0-9]
cityString[A-Z]
countryStringCountry Code
firstnameString[A-Z]
stateString[A-Z]
emailString[A-Z][0-9][-&_]@[A-Z][0-9].[A-Z]
custom1
### optional ###
String*
custom2
### optional ###
String*
custom3
### mandatory payment reason ###
String*
payment_methodString130 (or 126 if instructed by tech support)
Payment Method Id
phoneString[0-9]
banknameStringBank Name
accountnumberString[A-Z][0-9]
testmode
### only for testing ###
Stringtrue
testmodecallbackstatus
### only for testing ###
String[PENDING-PROCESSED-ACCEPTED-FINISHED-ERROR]
signatureString*

Request string:

POST https://sandbox.payabl.com/pay/backoffice/payment_cft

merchantid=test_merchant&amount=1.23&currency=MXN&orderid=Inatec-Test&language=en&lastname=Mann&
street=An+der+Welle+4&zip=60322&city=Frankfurt&country=DEU&firstname=Muster&state=HE&email=test%
40inatec.com&custom1=&custom2=&custom3=&payment_method=130&document_id=50284414727&document_type=CC&
method=TRANSFIYA&bankcountry=COL&additional_remark=transfer+money&account_type=PHONE&account=5701234
5678910&signature=ff09cfa3b2e01e746ddbf19fbab08b30e31ab313
  1. Response:
transactionid=215456949&transid=215456949&status=2000&errormessage=pending&errmsg=pending&amount=100&
price=100&currency=MXN&orderid=Payabl-Test&payment_method=130

1.1 Error

transactionid=215457170&transid=215457170&status=4001103&errormessage=method%20or%20channel%20is%20
inactive&errmsg=method%20or%20channel%20is%20inactive&amount=2&price=2&currency=MXN&orderid=Payabl-Test&
payment_method=130

1.2 Pending

"transactionid=215437556&transid=215437556&status=2000&errormessage=pending&errmsg=pending&amount=1230&price=1230&currency=MXN&orderid=Inatec-Test&payment_method=126""
  1. Notification:

2.1 Notification example with Error:

errormessage=&bank_code=001&method=BANKTRANSFER&account_holder=Muster+Mann&orderid=Payabl-Test&
errorcode=0&transactionid=215456949&timestamp=1689150492&bank_country=BRA&security=b67f198da9d3
10b956405ff879d098a2e0f8a1728a5ddad6b0e9c4ce3edc9dae&payment_method=130&type=cft

2.2Notification example with Success

errorcode=-5002&method=BANKTRANSFER&account_holder=Muster+Mann&security=389ff24d11207156c43bfc7e9ebc89
3e12726dda4f5a0aaa27544a8c4c986e7c&payment_method=130&bank_country=BRA&errormessage=rejected+by+bank&
orderid=Payabl-Test&type=cft&timestamp=1689154433&bank_code=001&transactionid=215456961

Example of SPEI account

Account TypeAccountText
clabe11223344556677889918 digits
debit112233445566778816 digits
phone552212345610 digits

📘

Mexico document type

Mexican taxpayers could get RFC.
RFCs are 13 digits long for individuals, 12 for companies, and they’re made up of letters and numbers. The first 4 digits for individuals, or 3 for companies, are taken from the name, then there are six numbers denoting the date of birth or when the business was founded, and the end digits are check digits.

Mexican citizen or resident could get CURP.
It’s an 18-digit social security number for people living in Mexico. The 18 characters combine information deriving from your name, date and place of birth, and gender to create a unique code.


Bank in Mexico

Check below the different values that bank_code parameter can take in Mexico.

Bank NameBank Code
ABC CAPITAL40138
ACCENDO BANCO40102
ACTINVER40133
AFIRME40062
AKALA90638
AMERICAN EXPRES40103
ASP INTEGRA OPC90659
AUTOFIN40128
AZTECA40127
BAJIO40030
BANAMEX40002
BANCO FINTERRA40154
BANCO S340160
BANCOMEXT37006
BANCOPPEL40137
BANCREA40152
BANJERCITO37019
BANK OF AMERICA40106
BANKAOOL40147
BANOBRAS37009
BANORTE40072
BANREGIO40058
BANSEFI37166
BANSI40060
BANXICO2001
BARCLAYS40129
BBASE40145
BBVA BANCOMER40012
BMONEX40112
CAJA POP MEXICA90677
CAJA TELEFONIST90683
CB INTERCAM90630
CI BOLSA90631
CIBANCO40143
CoDi Valida90903
COMPARTAMOS40130
CONSUBANCO40140
CREDICAPITAL90652
CREDIT SUISSE40126
CRISTOBAL COLON90680
DEUTSCHE40124
DONDE40151
ESTRUCTURADORES90606
EVERCORE90648
FINAMEX90616
FINCOMUN90634
FOMPED90689
FONDO (FIRA)90685
GBM90601
HDI SEGUROS90636
HIPOTECARIA FED37168
HSBC40021
ICBC40155
INBURSA40036
INDEVAL90902
INMOBILIARIO40150
INTERCAM BANCO40136
INVERCAP90686
INVEX40059
JP MORGAN40110
KUSPIT90653
LIBERTAD90670
MASARI90602
MIFEL40042
MIZUHO BANK40158
MONEXCB90600
MUFG40108
MULTIVA BANCO40132
MULTIVA CBOLSA90613
NAFIN37135
PAGATODO40148
PROFUTURO90620
REFORMA90642
SABADELL40156
SANTANDER40014
SANTANDER290814
SCOTIABANK40044
SHINHAN40157
STP90646
Inteligencia en Finanzas, S.A.P.I. de C.V. (ALBO)90646
TRANSFER90684
UNAGRA90656
VALMEX90617
VALUE90605
VE POR MAS40113
VECTOR90608
VOLKSWAGEN40141