Common Description


Signature Signature

Encryption
The request uses the MD5 encryption algorithm mainly to prevent data tampering during the process of placing an order or querying
The general steps for signature generation are as follows:
Step 1: Set all the data sent or received as set M, sort the non empty parameter values in set M in ascending order of parameter name ASCII code (lexicographic order), and concatenate them into a string A using the format of URL key value pairs (i.e. key1=value1&key2=value2...). Pay special attention to the following important rules:

◆ Parameter names are sorted in ascending order of ASCII code (lexicographic order);
◆ If the value of the parameter is empty, it will not participate in the signature;
◆ Parameter names are case sensitive;
◆ When the verification call returns or actively notifies the signature, the transmitted sign parameter does not participate in the signature, and the generated signature is verified against the sign value.

MD5 method: Step 2, concatenate the key at the end of stringA to obtain the stringSignTemp string, perform MD5 operation on stringSignTemp, and then convert all characters of the obtained string to uppercase to obtain the sign value signValue.
RSA method: In the second step, perform MD5 operation on stringA, and RSA signature is performed using a private key to obtain the sign value signValue.
Example
Assuming the transmitted parameters are as follows:
mch_id:10000000
subject: goods
detail: detail info
nonce: wmg9sL00qFEPdk6M
Step 1: Sort the parameters in key=value format and in ASCII lexicographic order according to their names as follows: stringA="detail=detail info&mch_id=10000000&nonce=wmg9sL00qFEPdk6M&subject=goods

MD5 method: Step 2: Splicing API Keys: stringSignTemp=stringA+"&key=sWlINU9hyWZvdcDZPnyIhVCRdmgRDqmw"

Note: The key is the API key api_key set by the merchant platform
sign=MD5(stringSignTemp).toUpperCase()="D0F7DBB5574FB2C64AE5ABCA66950A3D"//MD5 signature method

RSA method: Step 2: use the private key to perform RSA signature to obtain the sign value signValue.
Note: privateKey refers to the private key corresponding to the public key filled in by the merchant platform
const jsrsasign = require('jsrsasign');
const sig = new jsrsasign.KJUR.crypto.Signature({alg: "SHA256withRSA"});
let signMd5 = CryptoJS.MD5(stringSignTemp).toString()
sig.init(jsrsasign.KEYUTIL.getKey(privateKey));
sig.updateString(signMd5);
// 生成签名并以 Base64 格式输出
const sigValueHex = sig.sign();
const base64Signature = jsrsasign.hextob64(sigValueHex);//RSA signature method
body
Please log in to the merchant's backend to obtain the key.
Signature Decryption
The value of the RSA signature plaintext concatenated string stringA
Example
Step 1: Splicing strings: StringA = mch_id=1525399982&nonce=72c73310646147d2ba385eee40e7e729&pay_url=HTTPS:// QR.ALIPAY.COM/FKX09161NK1RJUSZQBAU98?t=1531223954449&trade_type=ALIH5

MD5 signature method:Step 2: MD5 Encryption: plaintext = MD5(StringA+"&key="+key) = dc4da653b2c751852bfa71a1e0878d3c

RSA signature method:Step 2: RSA2 Signature Verification RSA2.verify(MD5(StringA), sign, publickKey)
Note: publickKey is the public key generated by the merchant platform
For MD5 type signature verification, please directly generate a signature for the response parameter using the MD5 signature generation method, and compare it with the sign field in the response parameter
body
Please log in to the merchant's backend to obtain the key.

Payment API


Request information
Headers
content-type:application/x-www-form-urlencoded OR content-type:application/application/json
parameter
Name Type Required Example Describe
mch_id String(32) Yes 1234567890 Merchant ID assigned by the platform
trade_type string(10) Yes ALIH5 Payment Type - See Number Below
currency string(10) Yes rmb Currency Number - See the supported currency types below
nonce string(32) Yes 7VS264I5K8502SI8Z
NMTM6LTKCH16CQ2
Random string
user_id string(32) No User ID
timestamp string Yes 1524822584 Timestamp
subject String(200) Yes subject Order Name
detail String(500) No detail Product Details
out_trade_no string(32) Yes 20150806125346 The internal order number of the merchant system, within 32 characters
total_fee float Yes 100.00 The total amount,The decimal point can be kept to a maximum of 2 decimal places
spbill_create_ip string Yes 123.12.12.123 Terminal IP
timeout string No 1 Expiration duration
notify_url string Yes Asynchronous URL
return_url string No Return URL
attach string(150) No Return as is during asynchronous notification
sign_type string Yes MD5 Signature type, currently supports RSA and MD5,Suggest using RSA Signature
sign string Yes D0F7DBB5574FB2C64
AE5ABCA66950A3D
Signature Information
version string(10) No 1.0.0 Version
body
All non null fields participate in the signature, and 0 also needs to participate in the signature
Payment Type(trade_type)Code
Code Payment Type
PIX PIX
Bank Code(issuer_id)
Bank Code Bank Name
TCB TECHCOMBANK (TCB)
Currency Type(currency)Code
Currency Type Currency Name
brl 巴西雷亚尔
                                                {
                                                    'result_code':'SUCCESS',
                                                    'result_msg':'message',
                                                    'mch_id':'5221518459409',
                                                    'trade_status': 0,//version = 1.0.1  时返回
                                                    'platform_trade_no': 1539860740682,
                                                    'nonce':'2SI8ZNMTM6L',
                                                    'pay_url':'https://pay.alipay.com/afetaasd',
                                                    'qrcode':'',
                                                    'jump':'',
                                                    'sign_type':'MD5',
                                                    'sign':'D0F7DBB5574FB2C64AE5ABCA66950A3D'
                                                }
                                            
Remarks
Payment query description information
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Describe
mch_id string Yes Merchant ID assigned by the platform
out_trade_no string Optional Merchant order number
trade_no string Optional Platform Order Number
sign string Yes Signature Information
sign_type string No Signature type, currently supports RSA and MD5,Suggest using RSA Signature
version string(10) No Version,1.0.0
body
Return parameters
Name Type Describe
result_code string Return status, SUCCESS or FAIL
result_msg string failure reason
mch_id number(15) Merchant ID assigned by the platform
currency string Currency Type
wallet string(10) Wallet
trade_no number(20) Platform Order Number
out_trade_no string Merchant transfer number(Return as is)
timestamp number(10) Timestamp
evidence string Transaction payment document
eid String(200) Cashin EID,version=1.0.1 will only be displayed
total_fee float The total amount,
pay_total_fee float The payment total amount,
trade_status number(2) 1:成功,4:客服补单成功。别的都是失败
trade_type string
pay_time string 20250720232711,相应国家的时间
nonce string Random string
attach string(150) Return as isIf sometimes a signature needs to be added, it will not be returned if it is not transmitted,version=1.0.1 will only be displayed
sign_type string Signature type,If sometimes it is necessary to add a signature
sign string Signature Information
                                                {
                                                    "result_code": "SUCCESS",
                                                    "result_msg": "返回成功",
                                                    "mch_id": 6076120406304,
                                                    "trade_type": "PIX",
                                                    "nonce": "006cd29afa3099bc2f017635cf6b17c7",
                                                    "timestamp": 1753066070,
                                                    "out_trade_no": "186158452035992471",
                                                    "total_fee": 20,
                                                    "trade_no": "",
                                                    "platform_trade_no": 1746874155232459,
                                                    "pay_time": "20250720232711",
                                                    "trade_status": 1,
                                                    "currency": "brl",
                                                    "sign_type": "MD5",
                                                    "eid": "E18236120202507210227s182b34841c",
                                                    "sign": "B9AF092049E3374D1D483BDB9DFA21A2"
                                                }
                                            
Remarks
trade_status Order status, 0: Pending payment, 1: Successful, 2: Failed, 4: Replenishment result_code,result_msg Do not add signature
Asynchronous notification description information, merchant successfully returns uppercase string SUCCESS
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Describe
result_code string Yes Return status, SUCCESS or FAIL
result_msg string No failure reason
mch_id string Yes Merchant ID assigned by the platform
trade_type string Yes Payment Type
currency string Yes Currency Type
pay_total_fee String(11) Optional The payment total amount,When requesting an order, version=1.0.1 will be returned
trade_status int(1) Optional Order status, 0: Pending payment, 1: Successful, 2: Failed, 4: Replenishment,When requesting an order, version=1.0.1 will be returned
payee_name String(11) Optional 付款人姓名,When requesting an order, version=1.0.1 will be returned
payee_document String(11) Optional 付款人CPF/CNPJ,When requesting an order, version=1.0.1 will be returned
out_trade_no string Yes Merchant order number(Return as is)
total_fee float Yes The total amount,
platform_trade_no string Yes Platform Order Number
trade_no string Yes Platform serial number
nonce string Yes Random string
pay_time string Yes Payment time
timestamp string Yes Timestamp
attach string No Return as isIf sometimes a signature needs to be added, it will not be returned if it is not transmitted
sign_type string No Signature type,If sometimes it is necessary to add a signature
sign string Yes Signature Information
body
Only when the payment is successful will there be asynchronous callback

Transfer API


Parameter description information
The request was not responded to or timed out. Please check the order or contact customer service first. Do not resubmit repeatedly to avoid potential losses.
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Example Describe
mch_id String(32) Yes 1234567890 Merchant ID assigned by the platform
wallet string(10) Yes A A
currency string(10) Yes rmb Currency Number - See the supported currency types below
nonce string(32) Yes 7VS264I5K8502SI8Z
NMTM6LTKCH16CQ2
Random string
timestamp string Yes 1524822584 Timestamp
bank_name String(200) Yes xzxxxx dxxc Bank card name
bank_no String(200) Yes 123456 Bank account
card_type String(200) Yes CPF Card type PIX(CPF/CNPJ/PHONE/EMAIL/EVP),TED(CC/CP),BANK(CHECKING/SAVINGS)
bank_code String(500) Yes PIX Bank Code-See Number Below
province String(200) Yes 22222222222 CPF Code
city String(500) BANK is required 6123456789 Bank account confirmation code
branch String(500) TED/BANK is required xxxxxxxxx Branch number
out_trade_no string(32) Yes 20150806125346 Merchant order number
total_fee float Yes 100.00 The total amount,The decimal point can be kept to a maximum of 2 decimal places
notify_url string Optional Asynchronous URL
sign string Yes D0F7DBB5574FB2C64
AE5ABCA66950A3D
Signature Information
attach string(150) No sss Return as isIf sometimes a signature needs to be added, it will not be returned if it is not transmitted
sign_type string No MD5 Signature type, currently supports RSA and MD5,Suggest using RSA Signature
version string(10) No 1.0.0 Version,1.0.0
body
All non null fields participate in the signature, and 0 also needs to participate in the signature
Currency Type(currency)Code
Currency Type Currency Name
brl 巴西雷亚尔
Bank Code(bank_code)Code
Code Name Card type(card_type) Currency
PIX PIX PIX(CPF/CNPJ/PHONE/EMAIL/EVP) brl
TED TED TED(CC/CP) brl
PICPAY PICPAY brl
BANK BANK BANK(CHECKING/SAVINGS) brl
USDT USDT brl
                                                {
                                                    "result_code": "SUCCESS",
                                                    "result_msg": "提交成功",
                                                    "mch_id": "6076120406304",
                                                    "trade_no": "2926736325558566",
                                                    'trade_status': 0,//version = 1.0.1 时返回
                                                    "nonce": "e82be4957f27c6c75159a040dd834990",
                                                    "out_trade_no": "2bfcc80c-2849-46a9-bf73-a3d6eb733ffa",
                                                    "timestamp": 1731644245,
                                                    "sign": "7DA9C68DCE3AE94327A7D1CDE852B2AA"
                                                }
                                            
Remarks
Transfer query description information
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Describe
mch_id string Yes Merchant ID assigned by the platform
out_trade_no string Optional Merchant order number
trade_no string Optional Platform Order Number
timestamp string Yes Timestamp
sign string Yes Signature Information
sign_type string No Signature type, currently supports RSA and MD5,Suggest using RSA Signature
version string(10) No Version,1.0.0
body
content-type:application/x-www-form-urlencoded
Return parameters
Name Type Describe
result_code string Return status, SUCCESS or FAIL
result_msg string failure reason
mch_id string Merchant ID assigned by the platform
currency string Currency Type
wallet string(10) Wallet
trade_no number(20) Platform Order Number
out_trade_no string Merchant transfer number(Return as is)
timestamp number(10) Timestamp
evidence string Transaction payment document
eid String(200) Cashout EID,version=1.0.1 will only be displayed
recipient String(200) recipient,version=1.0.1 will only be displayed
instituicao String(200) Instituicao,version=1.0.1 will only be displayed
ispb String(200) ispb,version=1.0.1 will only be displayed
attach string Available balance
total_fee float The total amount,
actual_money float The total amount,
trade_status number(2) Transfer status, 0: Pending, 1: Transfer successful, 2: Transfer failed, 3: Channel processing in progress, 11: Full refund,12: Partial refund
bank_code string
present number(10)
nonce string Random string
attach string(150) Return as isIf sometimes a signature needs to be added, it will not be returned if it is not transmitted
sign_type string Signature type, currently supports RSA and MD5,Suggest using RSA Signature,version=1.0.1 will only be displayed
sign string Signature Information
refund_list array 退款列表(version = 1.0.1。而且trade_status == 11 或 12,才会显示)
Name Type Describe
refund_id string 退款ID
refund_amount float(10) 退款金额
refund_time string 2025-07-24 10:20:30,退款时间
refund_msg string 退款备注
                                                SUCCESS Sample Response:
                                                {
                                                    "result_code": "SUCCESS",
                                                    "result_msg": "代付成功",
                                                    "mch_id": "6076120406304",
                                                    "trade_no": 2486874120333527,
                                                    "nonce": "0f27de192c19dcb14645a4db8dfcdb0e",
                                                    "out_trade_no": "185158245036069818",
                                                    "timestamp": 1753027269,
                                                    "total_fee": 10,
                                                    "actual_money": 10,
                                                    "bank_code": "PIX",
                                                    "currency": "brl",
                                                    "wallet": "A",
                                                    "evidence": "https://xxxxx/receipt/2/2486874120333527",
                                                    "attach": "",
                                                    "present": 0,
                                                    "eid": "E3571349120250720155813282b9a7b0",
                                                    "trade_status": 1,
                                                    "sign": "91364C16E4329DA8929F4F9C5F9C64B0"
                                                }
                                                Error Sample Response:
                                                {
                                                    "result_code": "SUCCESS",
                                                    "result_msg": "REJECTED - CONTA NÃO AUTORIZADA PARA PAGAMENTOS ATRAVÉS DO PIX PARA PESSOA JURÍDICA.",
                                                    "mch_id": "6076120406304",
                                                    "trade_no": 2026874980042344,
                                                    "nonce": "320633b309d3feb674e123dc7d7bef12",
                                                    "out_trade_no": "186063654770570821",
                                                    "timestamp": 1753065296,
                                                    "total_fee": 15,
                                                    "actual_money": 0,
                                                    "bank_code": "PIX",
                                                    "currency": "brl",
                                                    "wallet": "A",
                                                    "evidence": "",
                                                    "attach": "",
                                                    "present": 0,
                                                    "eid": "",
                                                    "trade_status": 2,
                                                    "sign": "577D2F8DED97484F89B427043384F875"
                                                }
                                                Refund Sample Response:
                                                {
                                                    "result_code": "SUCCESS",
                                                    "result_msg": "代付成功",
                                                    "mch_id": "6076120406304",
                                                    "trade_no": 2486874120333527,
                                                    "nonce": "0f27de192c19dcb14645a4db8dfcdb0e",
                                                    "out_trade_no": "185158245036069818",
                                                    "timestamp": 1753027269,
                                                    "total_fee": 10,
                                                    "actual_money": 10,
                                                    "bank_code": "PIX",
                                                    "currency": "brl",
                                                    "wallet": "A",
                                                    "evidence": "https://xxxxx/receipt/2/2486874120333527",
                                                    "attach": "",
                                                    "present": 0,
                                                    "eid": "E3571349120250720155813282b9a7b0",
                                                    "trade_status": 11,
                                                    "sign": "91364C16E4329DA8929F4F9C5F9C64B0",
                                                    "refund_list": [
                                                        {
                                                            "refund_id": "3486874120333527",
                                                            "refund_amount": 10,
                                                            "refund_time": "2025-07-24 10:20:30",
                                                            "refund_msg": "全额退款"
                                                        }
                                                    ]
                                                }
                                            
Remarks
trade_status Transfer status, 0: Pending, 1: Transfer successful, 2: Transfer failed, 3: Channel processing in progress, 4: Channel processing failed
Asynchronous notification description information, merchant successfully returns uppercase string SUCCESS
Please URL decoding
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Describe
result_code string Yes Return status, SUCCESS or FAIL
result_msg string No failure reason
mch_id string Yes Merchant ID assigned by the platform
bank_code string Yes Bank Code
actual_money float Yes Actual amount received,The decimal point can be kept to a maximum of 2 decimal places
wallet string(10) Yes Wallet
present float Yes commission
currency float Yes Currency Type
out_trade_no string Yes Merchant transfer number(Return as is)
total_fee float Yes The total amount,
trade_no string Yes Platform Order Number
nonce string Yes Random string
timestamp string Yes Timestamp
attach string(150) No Return as isIf sometimes a signature needs to be added, it will not be returned if it is not transmitted
trade_status string Yes Transfer status, 1: Transfer successful, 2: Transfer failed
sign_type string No Signature type, currently supports RSA and MD5,Suggest using RSA Signature
sign string Yes Signature Information
body
The asynchronous callback will only occur when the final success or failure occurs
RefundAsynchronous notification description information, merchant successfully returns uppercase string SUCCESS
Please URL decoding
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Describe
result_code string Yes Return status, SUCCESS or FAIL
result_msg string No failure reason
mch_id string Yes Merchant ID assigned by the platform
bank_code string Yes Bank Code
actual_money float Yes Actual amount received,The decimal point can be kept to a maximum of 2 decimal places
wallet string(10) Yes Wallet
present float Yes commission
currency float Yes Currency Type
out_trade_no string Yes Merchant transfer number(Return as is)
total_fee float Yes The total amount,
trade_no string Yes Platform Order Number
nonce string Yes Random string
timestamp string Yes Timestamp
attach string(150) No Return as isIf sometimes a signature needs to be added, it will not be returned if it is not transmitted
trade_status string Yes 11:全额退款,12:部分退款
sign_type string No Signature type, currently supports RSA and MD5,Suggest using RSA Signature
sign string Yes Signature Information
body
请在商户后台商户信息开启代付退款回调,有开启才会推送,如果没有设置代付退款回调链接,会回调到代付请求的notify_url链接。
Balance inquiryParameter description information
Headers
content-type:application/x-www-form-urlencoded
parameter
Name Type Required Describe
mch_id string Yes Merchant ID assigned by the platform
currency string(10) No Currency Type -See Number Below
timestamp string Yes Timestamp
sign string Yes Signature Information
sign_type string No Signature type, currently supports RSA and MD5,Suggest using RSA Signature
body
Return parameters
Name Type Describe
result_code string Return status, SUCCESS or FAIL
result_msg string failure reason
mch_id string Merchant ID assigned by the platform
currency string Currency Type
wallet string(10) Wallet
account_balance float Total balance,The decimal point can hold up to 4 decimal places
available_balance float Available balance,The decimal point can hold up to 4 decimal places
unavailable_balance float The amount in Transfer,The decimal point can hold up to 4 decimal places
frozen_presented float The frozen amount,The decimal point can hold up to 4 decimal places
nonce string Random string
sign_type string Signature type, currently supports RSA and MD5,Suggest using RSA Signature
sign string Signature Information
                                                {
                                                    'result_code':'SUCCESS',
                                                    'result_msg':'Message',
                                                    'currency':'rmb',
                                                    'mch_id':'5221518459409',
                                                    'account_balance':22222,
                                                    'available_balance': 3333,
                                                    'unavailable_balance': 0,
                                                    'nonce':'2SI8ZNMTM6L',
                                                    'sign':'D0F7DBB5574FB2C64AE5ABCA66950A3D'
                                                }
                                            
Remarks