API REFERENCE
Signing
1. Collect all payment parameters
Let M be the set of all data sent and received. Sort M in ascending alphabetical (lexicographical) order, then concatenate the parameters into string A using URL-style key-value pairs (for example, key1=value1&key2=value2…).
Please note:
Sort parameter names in ascending ASCII order (lexicographical order).
Parameter names are case-sensitive.
When verifying the signature of returned data or a YabandPay push notification, exclude the transmitted “sign” and “data” fields from the signing data.
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¤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=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"
