Tài liệu tích hợp
Trang này chưa có bản Tiếng Việt; bên dưới là bản English.

Collection API compat1 (legacy protocol)

For merchants already integrated with the old system's collection API: merchant ID, key, signature, parameters and responses are all unchanged. Only the gateway address changes to this platform's https://api.xx2system.xyz. Merchants opened on this platform (merchant ID starting with M) use it too, sending the merchant ID as is.

Common rules

APIURLResponse
Create orderhttps://api.xx2system.xyz/api/pay/create_orderapplication/json
Query orderhttps://api.xx2system.xyz/api/pay/query_orderapplication/json
Balancehttps://api.xx2system.xyz/api/account/mch_balancetext/plain;charset=UTF-8
Payer name page (opened by the payer)https://api.xx2system.xyz/api/pay/input_nametext/html;charset=UTF-8
Payer name page submit (by the payer)https://api.xx2system.xyz/api/pay/input_name/submittext/html;charset=UTF-8

Create order create_order

Request parameters

ParameterRequiredRuleDescription
mchIdyesdigits; or a merchant ID issued by this platform (MCH + 5 digits), sent as isMerchant ID
productIdyesdigits onlyExisting merchants keep the one they use today; for the official product ID code, please contact customer service
mchOrderNoyesletters, digits, underscore and hyphen only;at most 60 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Your order number, unique per merchant
amountyesinteger in the currency's minor unit, greater than 0Amount in the currency's minor unit
notifyUrlyesat most 512 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Payment result callback URL (format not checked; no &)
subjectyesat most 64 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Goods title
bodyyesat most 256 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Goods description
signyes32 hex characters, see SignaturesSignature (MD5), see Signatures
param2noat most 64 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Payer name; if omitted, the channel settings decide between a fixed name and the payer name page
param1noat most 64 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Your own value, returned in the callback
extranoat most 512 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Extension data required by a few channels
clientIpnoat most 128 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Payer IP; the request source when omitted
returnUrlnoat most 512 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Page to return to after paying, used by a few channels
devicenoat most 64 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Device information
currencynoat most 3 (UTF-16 code units: an emoji or a rare CJK character counts as 2)Currency, value not checked, cny when omitted
reqTimenoyyyyMMddHHmmssRequest time; the difference from now is not checked
versionnomust be 1.0API version
appIdnodo not send it (a non-empty value is rejected as an unknown app)App ID

Successful response

There are only two payMethod values:

{"retCode":"SUCCESS","sign":"FC72E9A94FE742797A6939FD5975B5D0","payMethod":"formJump","payUrl":"https://cashier.example.com/pay/8a1b2c","payParams":{"payMethod":"formJump","payUrl":"https://cashier.example.com/pay/8a1b2c"}}
{"retCode":"SUCCESS","sign":"299712E3593CB68C0AFF5901493FF777","payMethod":"cardInfo","payParams":{"accountName":"张三","accountNo":"6222021234567890123","bankName":"中国工商银行"}}

When the response is signed, payParams is one value: its first-level keys are sorted and it is written as compact JSON (see Signatures).

Failure response

{"retCode":"FAIL","retMsg":"暂无可用支付通道,请稍后重试"}

Payer name page

When the channel needs the payer's name and you did not send param2, the successful response is a formJump whose payUrl points to this platform's name page https://api.xx2system.xyz/api/pay/input_name?t=…. The payer enters a name there and then goes on to the payment page or sees the card details. The page is in Chinese only. Handle it like any other redirect; no code change is needed.

Example

Example key (fake):demo-key-NOT-REAL-do-not-use-0001

Parameters

mchId=20000001
productId=8001
mchOrderNo=ORDER20260918001
amount=10000
notifyUrl=https://merchant.example.com/notify
subject=goods
body=goods
param1=shop-7
param2=张三
reqTime=20260918120000

String to sign

amount=10000&body=goods&mchId=20000001&mchOrderNo=ORDER20260918001&notifyUrl=https://merchant.example.com/notify&param1=shop-7&param2=张三&productId=8001&reqTime=20260918120000&subject=goods&key=demo-key-NOT-REAL-do-not-use-0001

sign

86032564C62F16F220F9DBAD7D88C690

Request body

mchId=20000001&productId=8001&mchOrderNo=ORDER20260918001&amount=10000&notifyUrl=https%3A%2F%2Fmerchant.example.com%2Fnotify&subject=goods&body=goods&param1=shop-7&param2=%E5%BC%A0%E4%B8%89&reqTime=20260918120000&sign=86032564C62F16F220F9DBAD7D88C690

Query order query_order

Request parameters

ParameterRequiredRuleDescription
mchIdyesdigits; or a merchant ID issued by this platform (MCH + 5 digits), sent as isMerchant ID
mchOrderNoone of twoYour order number, unique per merchant
payOrderIdone of twoOrder number (looked up again as your order number if not found)
executeNotifynotrue: if the order has succeeded, send the callback once more
signyes32 hex characters, see SignaturesSignature (MD5), see Signatures
reqTimenoyyyyMMddHHmmssRequest time; the difference from now is not checked
versionnomust be 1.0API version

Successful response

These 14 fields are always present; missing values are empty strings (empty strings are not signed):

ParameterDescription
retCodeSUCCESS or FAIL
signSignature (MD5)
mchIdMerchant ID
appIdApp ID (normally empty)
productIdFor the official product ID code, please contact customer service
payOrderIdYour order number (as in the old system, this field carries your order number)
mchOrderNoYour order number
amountOrdered amount (minor units)
currencyCurrency
statusOrder status, see the table below
channelUserChannel user
channelOrderNoUpstream order number
channelAttachUpstream extra data
paySuccTimeSuccess time in milliseconds; empty string if none
StatusMeaning
-2Closed
-1Payment failed
0Created (payer has not gone to pay yet)
1Paying
2Paid
3Completed (after your callback reply was success)
4Refunded or reversed
{"retCode":"SUCCESS","sign":"60570E9E22C1CC62C5A425625B2B2260","mchId":"20000001","appId":"","productId":"8001","payOrderId":"ORDER20260918001","mchOrderNo":"ORDER20260918001","amount":"10000","currency":"cny","status":"2","channelUser":"","channelOrderNo":"UP20260918000123","channelAttach":"","paySuccTime":"1789704005000"}

Failure response

Failure texts are mostly English (as in the old system) and unsigned, for example:

{"retCode":"FAIL","retMsg":"支付订单不存在"}

Orders placed before you switched to this platform cannot be found here (you get 支付订单不存在): rely on the callback for those, or look them up in the old portal.

Example

Example key (fake):demo-key-NOT-REAL-do-not-use-0001

Parameters

mchId=20000001
mchOrderNo=ORDER20260918001

String to sign

mchId=20000001&mchOrderNo=ORDER20260918001&key=demo-key-NOT-REAL-do-not-use-0001

sign

23A303C6B04E6C7BD44039988E47DC1C

Request body

mchId=20000001&mchOrderNo=ORDER20260918001&sign=23A303C6B04E6C7BD44039988E47DC1C

Balance mch_balance

Request parameters

ParameterRequiredRuleDescription
mchIdyesdigits; or a merchant ID issued by this platform (MCH + 5 digits), sent as isMerchant ID
signyes32 hex characters, see SignaturesSignature (MD5), see Signatures
reqTimenoyyyyMMddHHmmssRequest time; the difference from now is not checked
versionnomust be 1.0API version

Response

{"mchId":20000001,"balance":500000,"sign":"B7F182CA8F4B91FA5F91A3885B163C86","retCode":"SUCCESS","availableBalance":489800}

Failures are unsigned, and errDes equals retMsg:

{"errCode":"0010","errDes":"验证签名不通过.","retCode":"FAIL","retMsg":"验证签名不通过."}

Example

Example key (fake):demo-key-NOT-REAL-do-not-use-0001

Parameters

mchId=20000001

String to sign

mchId=20000001&key=demo-key-NOT-REAL-do-not-use-0001

sign

7695B044D612C28A79D0E33156A4B593

Request body

mchId=20000001&sign=7695B044D612C28A79D0E33156A4B593