Documentación/Referencia de API

API REFERENCE

Firma

1. Collect all payment parameters

Sea M el conjunto de todos los datos enviados y recibidos. Ordene M alfabéticamente en orden ascendente (lexicográfico) y concatene los parámetros en la cadena A mediante pares clave-valor con formato de URL (por ejemplo, key1=value1&key2=value2…).

Tenga en cuenta lo siguiente:

Ordene los nombres de los parámetros en orden ASCII ascendente (orden lexicográfico).

Los nombres de los parámetros distinguen entre mayúsculas y minúsculas.

Al verificar la firma de los datos devueltos o de una notificación push de YabandPay, excluya los campos “sign” y “data” transmitidos de los datos que se firman.

2. Generate stringSign using stringA and secret_key

Apply HMAC-SHA256 to stringA to obtain the signature value (signValue).

Use stringA and secret_key to get stringSign, perform HMAC-SHA256 arithmetic on stringSign, thus get sign's value (signValue).

For example:

a) Collect all payment parameters
array(13) {
  ["description"] => string(27) "YabandPay test"
  ["timeout"] => string(1) "0"
  ["pay_method"] => string(8) "online"
  ["sub_pay_method"] => string(6) "WeChat Pay"
  ["order_id"] => string(17) "20180902014018888"
  ["amount"] => string(3) "0.1"
  ["currency"] => string(3) "EUR"
  ["redirect_url"] => string(49) "https://www.yabandpay.com"
  ["notify_url"] => string(44) "https://www.yabandpay.com/notify"
  ["demo"] => string(4) "test"
  ["user"] => string(20) "YOUR_CASHIER_UID"
  ["method"] => string(17) "v3.CreatePayments"
  ["time"] => int(1555498137)
}
b) Sort all payment parameters
array(13) {
  ["amount"] => string(3) "0.1"
  ["currency"] => string(3) "EUR"
  ["demo"] => string(3) "test"
  ["description"] => string(27) "YabandPay test"
  ["method"] => string(17) "v3.CreatePayments"
  ["notify_url"] => string(44) "https://www.yabandpay.com/notify"
  ["order_id"] => string(17) "20180902014018888"
  ["pay_method"] => string(8) "online"
  ["redirect_url"] => string(49) "https://www.yabandpay.com"
  ["sub_pay_method"] => string(6) "WeChat Pay"
  ["time"] => int(1555498137)
  ["timeout"] => string(1) "0"
  ["user"] => string(20) "YOUR_CASHIER_UID"
}
c) Concatenate them into a URL-style query string
string(326) "amount=0.1&currency=EUR&demo=test&description=YabandPay test&method=v3.CreatePayments&notify_url=https://www.yabandpay.com/notify&order_id=20180902014018888&pay_method=online&redirect_url=https://www.yabandpay.com&sub_pay_method=WeChat Pay&time=1555498137&timeout=0&user=YOUR_CASHIER_UID"
d) Sign the resulting stringA using secret_key

In this example, secret_key is YOUR_SECRET_KEY

The resulting signature is:

string(64) "YOUR_SIGNATURE"