SPEI
Learn how to accept SPEI, a common payment method in Brazil.
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 type | Bank transfer |
Market | Mexico |
Customers currencies | MXN |
Processing currencies | MXN |
Settlement currencies | EUR |
Refunds | No |
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 - 126.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.country
: Customer country in ISO Alpha-2 format. Supported countries: MEX.email
: The customer's email address.custom2
: The name of payment method - spei.
You can see a full list of parameters in Pre-Authorization.
Request example
powercash21-3-2/backoffice/payment_preauthorize&merchantid=ala&amount=5000¤cy=MXN&orderid=Payabl-Test
&language=en&gender=&lastname=Mann&street=An+der+Welle+4&zip=60322&city=Sao+Pablo&country=MEX
&customerid=&salutation=&title=&firstname=Muster&company=Payabl&birthday=07071971&house=19&
postbox=&state=&email=test%40inatec.com&phone=XXXXXXXXXX8501&fax=&mobile=&customerip=127.0.0.1&
custom1=&custom2=spei&custom3=&url_return=http%3A%2F%2Fdev-sim-ng.inatec.local%2F%7Esimdad%
2FInatecResponse%2Fredirect_response.php&url_success=http%3A%2F%2Fdev-sim-ng.inatec.local
%2F%7Esimdad%2FInatecResponse%2Fsuccess.php&url_failed=http%3A%2F%2Fdev-sim-ng.inatec.local%2F%
7Esimdad%2FInatecResponse%2Ffailed.php¬ification_url=https%3A%2F%2Fapi.powercash.de%2Fsimulation%
2Fbilling_response.php&payment_method=126&&signature=ac1c499123858b20dc7951497aa8b89d7461fc10
Step 2. Handle the redirect
To complete the payment, you need to redirect the customer to the correct URL in the response.
Response
transactionid=215153751&transid=215153751&status=2000&errormessage=pending&errmsg=pending&amount=5000&price=5000¤cy=MXN&orderid=Payabl-Test&payment_method=126&user_id=1519926&redirect_url=https%3A%2F%2Fapi.gateway.payretailers.com%2Fv2%2Fpublic%2Ftransactions%2Fgateway%2F7cecdc7b-6479-489a-a2d6-42460d978d15
Step 3. Transaction states
If the customer successfully completed the transaction, you will receive a notification with confirmation.
Notification example (successful transaction):
"payment_state=APPROVED&payretailers_method_id=c7f3169e-f493-4591-ab8c-a29a9fc7c324&errorcode=0&
type=capture&orderid=Payabl-Test&uid=eb4bf6b1-91a3-41d9-ba59-dc1d61b81077&
payretailers_method_name=SPEI&payment_method=126&payretailers_method_type=Online&
national_id=13475444534&transactionid=213919072&errormessage=×tamp=1662387058&
security=9dd3204d369e98b836c0a535ba410b85aef8b817645775312d61fc36ea9df169" "https://www.notification_url"
If the customer initiated the transaction but didn't finalize it, you will receive a failed notification.
Notification example with error:
"type=order&payment_state=EXPIRED×tamp=1662386398&orderid=Payabl-Test&errorcode=-5003&security=1c9d6d30797aefc58c90d872ed54f4996ad0795383011f0c91530dc480fb87dd&payretailers_method_name=SPEI&errormessage=Payment+aborted+by+customer&payretailers_method_id=c7f3169e-f493-4591-ab8c-a29a9fc7c324&payment_method=126&uid=1fedae1a-e96d-40bf-862b-a04d6f544184&transactionid=213919227&national_id=13475444534&psp_transaction_id=2622483" "https://www.notification_url"
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.
N.B.: Payouts can only be sent to the banks of this list: https://bank-codes.es/swift-code/mexico/
Field | Value Format | Accepted Values |
---|---|---|
merchantid | String | [A-Z][0-9] |
amount | Float | 0.00 |
currency | String | BRL |
orderid | String | [0-9] |
language | String | en |
lastname | String | [A-Z] |
street | String | * |
zip | String | [A-Z][0-9] |
city | String | [A-Z] |
country | String | Country Code |
firstname | String | [A-Z] |
state | String | [A-Z] |
String | [A-Z][0-9][-&_]@[A-Z][0-9].[A-Z] | |
custom1 ### optional ### | String | * |
custom2 ### optional ### | String | * |
custom3 ### mandatory payment reason ### | String | * |
payment_method | String | 126 Payment Method Id |
phone | String | [0-9] |
bankname | String | Bank Name |
accountnumber | String | [A-Z][0-9] |
testmode ### only for testing ### | String | true |
testmodecallbackstatus ### only for testing ### | String | [PENDING-PROCESSED-ACCEPTED-FINISHED-ERROR] |
signature | String | * |
Request string:
POST /powercash21-3-2/backoffice/payment_cft
merchantid=ala&amount=70¤cy=MXN&orderid=Inatec-Test&language=en&lastname=Mann&street=Address+4&zip=60322&city=City&country=MEX&firstname=Muster&state=HE&email=test%40inatec.com&custom1=&custom2=&custom3=payment+reason&payment_method=126&phone=43543435435&bankname=341&accountnumber=0001&testmode=true&testmodecallbackstatus=FINISHED&nationalid=00183562658&signature=f3527a736f94e971dc8d91e2466f549f6aba996c
- Response:
transactionid=215439108&transid=215439108&status=2000&errormessage=pending&errmsg=pending&amount=70&price=70¤cy=MXN&orderid=Inatec-Test&payment_method=126
1.1 Error
transactionid=215439106&transid=215439106&status=-1320&errormessage=National%20Id%20wrong%20or%20missing&errmsg=National%20Id%20wrong%20or%20missing&amount=70&price=70¤cy=MXN&orderid=Inatec-Test&payment_method=126
1.2 Pending
"transactionid=215437556&transid=215437556&status=2000&errormessage=pending&errmsg=pending&amount=1230&price=1230¤cy=MXN&orderid=Inatec-Test&payment_method=126""
- Notification:
2.1 Notification example with Error:
Updated 4 months ago