Signing API Parameters
Signing the API parameters is a feature that allows you to secure your Yuansfer API calls, by using MD5 encryption and authenticated hash.
You will need to retrieve your API token from the Yuansfer Dashboard in order to build the parameters of your API calls. API parameters must be signed with MD5 encryption.
Building the API parameter signature
To sign the API parameters, you need to follow these steps:
Sort the parameters alphabetically according to the parameter name.
Concatenate the parameter names and values using '=' and '&' character.
Append the MD5 hash value of your API token to the end of your parameters with the '&' prefix.
Calculate the MD5 hash value of the Step 3 result.
EXAMPLE
Consider the following parameters:
amount = '1.00'
storeNo = '300014'
currency = 'USD'
merchantNo = '200043'
callbackUrl = 'https://wx.yuansfer.yunkeguan.com/wx'
terminal = 'ONLINE'
ipnUrl = 'https://wx.yuansfer.yunkeguan.com/wx'
reference = 'seq_1525922323'
vendor = 'alipay'
goodsInfo = '[{"goods_name":"Yuansfer","quantity":"1"}]'
timeout = '120'
1. Sort the parameters alphabetically
amount = '1.00'
callbackUrl = 'https://wx.yuansfer.yunkeguan.com/wx'
currency = 'USD'
goodsInfo = '[{"goods_name":"Yuansfer","quantity":"1"}]'
ipnUrl = 'https://wx.yuansfer.yunkeguan.com/wx'
merchantNo = '200043'
reference = 'seq_1525922323'
storeNo = '300014'
terminal = 'ONLINE'
timeout = '120'
vendor = 'alipay'
2. Concatenate the parameter names and values using '=' and '&' character
amount=1.00&callbackUrl=https://wx.yuansfer.yunkeguan.com/wx& currency=USD&goodsInfo=[{"goods_name":"Yuansfer","quantity":"1"}]&ipnUrl=https://wx.yuansfer.yunkeguan.com/wx&merchantNo=200043&reference=seq_1525922323&storeNo=300014&terminal=ONLINE&timeout=120&vendor=alipay
3. Append MD5 hash value of API token with '&' prefix.
When the API token is 5cbfb079f15b150122261c8537086d77a, the MD5 hash value is 186abea4b8610d7ff03768255588597a.
So the result string is :
amount=1.00&callbackUrl=https://wx.yuansfer.yunkeguan.com/wx& currency=USD&goodsInfo=[{"goods_name":"Yuansfer","quantity":"1"}]&ipnUrl=https://wx.yuansfer.yunkeguan.com/wx&merchantNo=200043&reference=seq_1525922323&storeNo=300014&terminal=ONLINE&timeout=120&vendor=alipay&186abea4b8610d7ff03768255588597a
4. Calculate the MD5 hash value of Step 3 result string.
MD5 hash value is b6bfd66531ae7c9499115c7480a2c8aa
Last updated