Signature Algorithm
1. Get all payment parameters
Presume all data sent and received is the set M. Set all values in M in ascending alphabetical order (i.e. lexicographical sequence), and join them into string A via the corresponding URL key-value format (e.g. key1=value1&key2=value2…).
[!TIP|style:flat]
Sort parameter names in ascending alphabetical order based on their ASCII encoded names (e.g. lexicographical sequence);
Parameter names are case-sensitive;
When checking returned data or a YabandPay push notification signature, the transferred sign parameter and ‘data’ are excluded in this signature as it is compared with the created signature.
2. Get stringSign
Use stringA and secret_key to get stringSign, perform HMAC-SHA256 arithmetic on stringSign, thus get sign’s value (signValue).
For example:
a) Get 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) "016683"
["method"] => string(17) "v3.CreatePayments"
["time"] => int(1555498137)
}
b) Lexicographical sequence
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) "016683"
}
c) RL key-value format new string
string(326) "amount=0.1¤cy=EUR&demo=test&description=YabandPay test&method=v3.CreatePayments¬ify_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=016683"
d) Use stringA and secret_key to get stringSign secret_key
In this example the secret_key is 62184c09df1aeb63239e07079875be81
string(64) "f8f90c7537c5f335b57cee1d5f7360c1bea34eeec0d12e0ffdc3f0985019c846"