Skip to content

Deposit Spei (MXN) h2h

SPEI – interbank transfer in Mexico via CLABE for fast and secure online payments.

Headers:

Field Description
X-Merchant unique merchant identifier;
X-Sign digital signature using the merchant key. All fields in the request body are used. Hashed as HMAC with SHA256;

Request contains fields:

Field Description
order transaction number in the merchant system;
amount transaction amount in currency, decimal separator “.”;
currency transaction currency, can be MXN;
user_id customer identifier in the merchant system;
first_name payer’s first name;
last_name payer’s last name.

Important

Request strings must contain only Latin letters and numbers.

POST /api/v2/spei/host2host/create
https://<provided_url>
/api/v2/spei/host2host/create
PHP Request Example:

X-Merchant: BCSPXMGIDSKUB
X-Sign: XXXXXXXXXXXXXXXXXX
$url = "https://{provided_url}/api/v2/spei/host2host/create";
$merchant = "BCSPXMGIDSKUB";
$secret_key = "XXXXXXXXXXX";
$order_id = "12456789";
$data = [
    "order" => $order_id,
    "amount" => "10.99",
    "currency" => "MXN",
    "user_id" => "492235",
    "first_name" => "Alex",
    "last_name" => "Gold",
];

$request = json_encode($data, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
$hashHex = hash_hmac('sha256', $request, $secret_key);
$signature = base64_encode($hashHex);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'Content-Type: application/json',
    'X-Merchant: ' . $merchant,
    'X-Sign: ' . $signature)
);
$result = curl_exec($ch);

On successful request, response contains fields:

Field Description
status request status (success);

Important: this is the request status, not the transaction status. It shows that the data has been correctly received by the server but does not reflect the actual transaction result;
transactionId unique transaction number;
merchantUuid unique merchant identifier;
uuid unique transaction identifier, use it for searching or contacting support if necessary;
order transaction number in the merchant system (same as request);
description transaction description;
clabe bank account identifier;
beneficiary recipient.
Example Response:

application/json

{
  "status": "success",
  "transactionId": 44938834,
  "merchantUuid": "BCSPXMGIDSKUB",
  "uuid": "FUHKN7RRPWFB3",
  "order": "12456789",
  "description": "success",
  "clabe": "71096900095810",
  "beneficiary": "Finance ltd"
}

On failed request, response contains fields:

Field Description
status request status (fail);
transactionId unique transaction number;
merchantUuid unique merchant identifier;
uuid unique transaction identifier, use it for searching or contacting support if necessary;
order transaction number in the merchant system (same as request);
description transaction description;
clabe bank account identifier;
beneficiary recipient.
Example Response:

application/json

{
    "status": "fail",
    "transactionId": 0,
    "merchantUuid": "",
    "uuid": "",
    "order": "",
    "description": "The order already exists",
    "clabe": "",
    "beneficiary": ""
}

Important

Status is not the final payment status. Please wait for callback.

Final Status (Callback)

To notify the merchant that the transaction received its final status (for example, from “Pending” to “Success”), a callback mechanism is used.

See section “Callbacks” for details.