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
| 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 |
| Code | Payment Type |
|---|---|
| PIX | PIX |
| Bank Code | Bank Name |
|---|---|
| TCB | TECHCOMBANK (TCB) |
| 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'
}
| 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 |
| 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"
}
| 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 |
| 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 |
| Currency Type | Currency Name |
|---|---|
| brl | 巴西雷亚尔 |
| 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"
}
| 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 |
| 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,才会显示) |
|||||||||||||||
|
|||||||||||||||||
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": "全额退款"
}
]
}
| 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 |
| 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 |
| 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 |
| 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'
}