Quick Pay API
This API can be used to query all WeChat Pay orders. Merchants can use the Query Order API to query the order status and then complete subsequent business logic.
This API can be used to query all WeChat Pay orders. Merchants can use the Query Order API to query the order status and then complete subsequent business logic.
Applicable object: Common mode Institutional mode
Request URL: https://apihk.mch.weixin.qq.com/v3/global/micropay/transactions/pay
Request method: POST
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
APPID | appid | string[1,32] | Yes | Body APPID corresponding to the Service Account applied for by the merchant on the WeChat Official Accounts Platform Note:Only forCommon mode Example: wx8888888888888888 |
Merchant ID | mchid | string[1,32] | Yes | Body Merchant ID assigned by WeChat Pay Note:Only forCommon mode Example: 1900000109 |
Organization APPID | sp_appid | string[1,32] | Yes | Body APPID corresponding to the Service Account applied for by the institution on the WeChat Official Accounts Platform Note:Only forInstitutional mode Example: wx8888888888888888 |
Sub-merchant APPID | sub_appid | string[1,32] | No | Body APPID corresponding to the Service Account applied for by the sub-merchant on the WeChat Official Accounts Platform Note:Only forInstitutional mode Example: wx8888888888888888 |
Institution's Merchant ID | sp_mchid | string[1,32] | Yes | Body Institution's Merchant ID assigned by WeChat Pay Note:Only forInstitutional mode Example: 1900000109 |
Sub-merchant ID | sub_mchid | string[1,32] | Yes | Body Sub-merchant ID assigned by WeChat Pay Note:Only forInstitutional mode Example: 1900000109 |
Merchant order No. | out_trade_no | string[1,32] | Yes | Body The order No. in the merchant system with a length of not more than 32 characters, including letters. If the authorization code changes, a new merchant order No. must be used. For more information, see Merchant Order No. Example: 1217752501201407033233368018 |
Transaction type | trade_type | string[1,16] | Yes | Body Transaction type MICROPAY:Quick Pay Example: MICROPAY |
Merchant data | attach | string[1,127] | No | Body Additional data, which will be returned unchanged in the query API and payment notifications. This field is mainly used for the custom data in the orders of the merchant. Example: Custom data |
Product description | description | string[1,128] | Yes | Body Brief description of the product or payment order in the following format: Name of the store brand - Name of the city branch - Name of the actual product. Example: Tencent Image Store- Shenzhen Tencent Building - QQ Doll |
Product tag | goods_tag | string[1,32] | No | Body The product tag, which is a parameter for the voucher or discount feature. For more information, see Vouchers or Discounts. Example: WXG |
Payment method | limit_pay | string[1,32] | No | Body no_credit: Credit card cannot be used for payment Example: no_credit |
MCC code | merchant_cat egory_code | string[1,16] | Yes | Body Merchant Category Code Example: 4111 |
Payer | payer | object | Yes | Body Payer information. For more information, see the description below. |
Order amount | amount | object | Yes | Body Information on the order amount. For more information, see the description below. |
Scenario information | scene_info | object | No | Body The scenario information object. For more information, see the description below. |
Discount feature | detail | array | No | Body Discount feature info. For more information, see the description below. |
{
"sp_appid": "wxdace645e0bc2c424",
"sp_mchid": "10000100",
"sub_mchid": "20000100",
"out_trade_no": "20150806125346",
"merchant_category_code": "4111",
"payer": {
"auth_code": "134650720866361395"
},
"trade_type": "MICROPAY",
"amount": {
"total": 1,
"currency": "HKD"
},
"attach": "Payment Test",
"description": "Image Store - Tencent Building in Shenzhen - QQ Doll",
"goods_tag": "1234",
"limit_pay": "no_credit",
"detail": [{
"cost_price": 1,
"receipt_id": "1234",
"goods_detail": [{
"goods_id": "iphone6s_16G",
"wxpay_goods_id": "3405",
"goods_name": "iPhone6s 16G",
"quantity": 1,
"price": 1
}]
}],
"scene_info": {
"payer_client_ip": "14.23.150.211",
"device_ip": "59.37.125.32",
"device_id": "013467007045764",
"operator_id": "P001",
"store_info": {
"id": "SZTX001",
"name": "Tencent Building Branch",
"address": "Nanshan District, Shenzhen, Guangdong"
}
}
}
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
WeChat Pay order No. | id | string[1,32] | Yes | WeChat Pay order No. Example: 1217752501201407033233368018 |
APPID | appid | string[1,32] | Yes | APPID corresponding to the Service Account applied for by the merchant on the WeChat Official Accounts Platform Note:Only forCommon mode Example: wx8888888888888888 |
Merchant ID | mchid | string[1,32] | Yes | Merchant ID assigned by WeChat Pay Note:Only forCommon mode Example: 1900000109 |
Institution APPID | sp_appid | string[1,32] | Yes | APPID corresponding to the Service Account applied for by the institution on the WeChat Official Accounts Platform. WeChat Pay will configure the binding relationship when the institution applies for merchant features. Note:Only forInstitutional mode Example: wx8888888888888888 |
Sub-merchant APPID | sub_appid | string[1,32] | No | APPID corresponding to the Service Account applied for by the sub-merchant on the WeChat Official Accounts Platform. WeChat Pay will configure the binding relationship when the sub-merchant applies for merchant features. Note:Only forInstitutional mode Example: wx8888888888888888 |
Institution's Merchant ID | sp_mchid | strin[1,32] | Yes | Institution's Merchant ID assigned by WeChat Pay Note:Only forInstitutional mode Example: 1900000109 |
Sub-merchant ID | sub_mchid | string[1,32] | Yes | Sub-merchant ID assigned by WeChat Pay Note:Only forInstitutional mode Example: 1900000109 |
Merchant order No. |
out_trade_no | string[1,32] | Yes | Returned merchant's order No. Example: 1217752501201407033233368018 |
Transaction type | trade_type | string[1,16] | Yes | Transaction type MICROPAY:Quick Pay Example :MICROPAY |
Transaction status | trade_state | string[1,32] | Yes | SUCCESS:Payment successful REFUND:Transferred to refund NOTPAY:Unpaid CLOSED:Closed REVOKED:Revoked (Quick Pay) USERPAYING:Payment in progress PAYERROR:Payment failed (other reasons, for example, failed to be returned by the bank) Example: SUCCESS |
Transaction status description | trade_state_d esc | string[1,256] | Yes | Descriptions on the current order status and instructions for the next operation. Example: Payment failed. Place another order and pay it again. |
Paying bank | bank_type | string[1,32] | Yes | Bank type, which is the bank ID in string format. See Bank Type for the list of values. Example: CMC |
Merchant data | attach | string[1,127] | No | Additional data, which will be returned unchanged in the query API and payment notifications. This field is mainly used for the custom data in the orders of the merchant. Example: Custom data |
Payment completion time | success_time | string[1,64] | Yes | Order payment completion time, in RFC3339 format. For example, 2018-06-08T10:34:56+08:00 represents BJT 10:34:56 June 8, 2018. Example: 2018-06-08T10:34:56+08:00 |
Payer | payer | object | Yes | Body Payer information. For more information, see the description below. |
Order amount | amount | object | Yes |
Information on the order amount. For more information, see the description below. Example: 1900000109 |
Discount feature | promotion_detail | array | No | Discount feature info. For more information, see the description below. |
Name | Variable Name | Type | Required | Description |
---|---|---|---|---|
Returned status code | code | string[1,32] | Yes | Error code. See the error code list for the enumerated values. |
Returned information | message | string[1,256] | Yes | Returned message. It indicates the reason for the error if not empty. |
Detailed error description | detail | object | No | It is returned when code is PARAM_ERROR. Details will be described below. |
{
"id": "1008450740201411110005820873",
"sp_appid": "wx2421b1c4370ec43b",
"sub_appid": "",
"sp_mchid": "10000100",
"sub_mchid": "20000100",
"out_trade_no": "20150806125346",
"payer": {
"sp_openid": "oUpF8uN95-Ptaags6E_roPHg7AG0",
"sub_openid" : ""
},
"amount" : {
"total": 528800,
"currency": "HKD",
"payer_total": 518799,
"payer_currency": "CNY",
"exchange_rate" : {
"type": "SETTLEMENT_RATE",
"rate": 80000000
}
},
"trade_type": "MICROPAY",
"trade_status": "SUCCESS",
"trade_state_desc": "Payment successful",
"bank_type": "CCB_DEBIT",
"attach": "Payment test",
"success_time": "2018-06-08T10:34:56+08:00",
"promotion_detail":
[{
"promotion_id":"109519",
"name":"Single-item discount-6",
"scope":"SINGLE",
"type":"DISCOUNT",
"amount":1,
"currency": "CNY",
"activity_id":"931386",
"wechatpay_contribute_amount":1,
"merchant_contribute_amount":0,
"other_contribute_amount":0,
"goods_detail":
[{
"goods_id":"iphone6s_16G",
"goods_remark":"Product remarks",
"quantity":1,
"price":528800
}]
}]
}
Error Message | Description | Solution |
---|---|---|
INVALID_REQUEST | Invalid request | Check your program based on the error message returned by the API. |
TRADE_ERROR | Transaction failed | Prompt the user to change payment method |
SYSTEM_ERROR | System error | Call the payment API again with the original request parameters to confirm the result. If SYSTEMERROR is returned again, call the Revoke API and inform the user to change the payment method. |
PARAM_ERROR | Incorrect request parameter | Check your program based on the error message returned by the API. |
NOT_ENOUGH | Insufficient balance | Prompt the user that the balance is insufficient or to change the payment method |
AUTH_CODE_INVALID | Invalid payment code |
Check if it is a WeChat payment code. Then initiate the payment again after replacing out_trade_no and the payment code. |
Customer Service Tel
Business Development
9:00-18:00
Monday-Friday GMT+8
Technical Support
WeChat Pay Global
ICP证