This document is for partners who have applied for the channel number channelId and private key at us.
Partner requirements: Provide channel name, register account.
① The developer calls us to create a payment order procotol and creates a payment order;
② Our link that returns to the payment page, and the user makes a payment;
③ to obtain payment results, the following two ways are doable: a. The developer provides a payment completion notification protocal, and after the user completes the payment, we call the protocal to notify; b. The developer can take the protocol of order status to get the status of the order payment result.
Request type
Request method
Description
POST application/json
api/pay/createPayOrder
Create a payment order
POST application/json
api/pay/queryPayOrder
Check order status
POST application/json
Provided by the developer
Payment completion notice
The partner calls the protocol to create a payment order.
Parameter name
Is it necessary
Type of data
description
Defaults
Ranges
channelId
Y
String
Channel number
Provided by us,eg:payaaa201903212028
channelName
Y
String
Channel short name
eg:xxMall
sign
Y
String
Signature
See "Signature Generation"
timestamp
Y
Long
Timestamp
Millisecond timestamp
channelOrderId
N
String
Channel order number
Developer customization
channelUserNo
N
String
Channel username
Developer customization
coinCode
Y
String
Payment currency name
eg:ETH
amount
Y
String
Payment currency amount
eg:1
remark
N
String
Remark
Remark of order
Payment order status protocol
Parameter name
Is it necessary
Type of data
description
Defaults
Ranges
payId
Y
String
Payment order number
eg : Nlt0OnQP
channelId
Y
String
Channel number
eg:payaaa201903212028
sign
Y
String
Signature
See "Signature Generation"
timestamp
N
String
Timestamp
Millisecond timestamp
Order payment completion notification protocol
Parameter name
Is it necessary
Type of data
description
Defaults
Ranges
payId
Y
String
Payment order number
eg: Nlt0OnQP
status
Y
String
Payment order status
valid,complete,invalid
sign
Y
String
Signature
timestamp
Y
String
Timestamp
Millisecond timestamp
Error code
Explanation
800
Success
900
Servers busy, please try later
213
Illegal Request
214
Currency does not exist
216
Amount illegal
907
Required field is empty
1002
Order doesn’t exist
1017
Third-party channels or account does not exist
1018
Third-party channels have not been set up on the account.
1019
Third-party channel number has not been set up yet.
1031
The note is longer than 50 characters
1032
Third-party channel payment page address has not been set up yet.
The parameter names are sorted according to the order of the ASCII code, converted into a json string, signed with a private key, and HMAC-SHA256 encryption should be used.
First step:
Let's assume all the data sent or received to be the set M, and sort the parameters of the non-empty parameter values in the set M according to the parameter name ASCII code from small to large (dictionary order), using the format of the URL key-value pair (ie key1=value1&key2=value2) ...) stitched into a string stringA.
Pay special attention to the following important rules:
The parameter name ASCII code is sorted from small to large (dictionary order);
app_id, timestamp is a required parameter; timestamp is the last five minutes timestamp, which is invalid for more than 5 minutes;
If the value of the parameter is null, it does not participate in the signature;
Parameter names are case sensitive;
The transmitted sign parameter does not participate in the signature, and the generated signature will be checked based on the sign value.
The Second step:
The string is finally stitched to get the stringSignTemp string, and the stringSignTemp is programmed according to HMAC-SHA256, and then all the characters of the obtained string are converted to uppercase, then the signvalue is set.
Pseudo code example
Assume that the parameters transmitted are as follows: channelId: mttest timestamp : 1516320000 body : test
Code example
The parameters and order in which the code participates in encryption are:
channelId=test91021071617412&orderId=my_test_id×tamp=1547987604644&secret=my_secret