Parameter | Required | Description | Note |
Authorization | Yes | Signature authentication information. | |
Content-Type | Yes | application/json | - |
Property | Type | Required | Description |
out_trade_no | string | Yes | Merchant order number, provided when the merchant places the order. |
Property | Type | Required | Description |
mchid | string | Yes | Merchant ID, provided when the merchant places the order. |
Property | Type | Required | Description |
appid | string | Yes | Mini program appid. |
mch_id | string | Yes | Merchant ID, provided when the merchant places the order. |
out_trade_no | string | Yes | Merchant order number, provided when the merchant places the order. |
transaction_id | string | No | Unique identifier of the payment order, which is returned when the order is paid successfully. |
trade_type | string | No | Transaction type: JSAPI for mini program payments. |
trade_state | string | Yes | Transaction status: WAIT_PAY - Awaiting payment SUCCESS - Payment successful CLOSED - Order closed AUTO_CLOSED - Order automatically closed due to expiration REFUND - Refunded PAY_ERROR - Payment failed |
bank_type | string | No | Bank code. Non-bank card payment types are uniformly marked as OTHERS. |
attach | string | No | Merchant data packet, custom data provided by the merchant when placing the order, not visible to the user, up to 256 characters. If provided, it will be returned as-is in this API, payment success callback notification, and transaction bill. If not provided, it will not be returned. |
success_time | string | No | Payment completion time. It follows the RFC 3339 standard format: YYYY-MM-DDTHH:mm:ss+TIMEZONE. YYYY-MM-DD represents the date; T separates the date and time; HH:mm:ss represents the time; TIMEZONE represents the time zone (e.g., +08:00 for Beijing time). |
payer | payer | No | Information about the payer, returned when the order is paid successfully. |
amount | object | No | Order amount. |
amount.payer_total | string | No | Total order amount (in cents). |
amount.total | integer | No | Actual amount paid by the user, an integer value, in cents. User payment amount = total amount - voucher amount. |
amount.currency | string | No | Currency type, a three-letter code compliant with ISO 4217. |
amount.payer_currency | string | No | Payment currency type, a three-letter code compliant with ISO 4217. |
{"appid": "mpco56h12e6e52hj","mch_id": "mi_7b0a5e40f9","out_trade_no": "2b695106b888d14328d9","transaction_id": "pi1738915449351wbrgic93qlahw34134wjr","trade_type": "JSAPI","trade_state": "SUCCESS","bank_type": "OTHERS","attach": "attach info","success_time": "2025-02-28T10:34:56+08:00","payer": {"openid": "o910d4edeee717377adguZS89513"},"amount": {"payer_total": "88800","total": 88800,"currency": "USD","payer_currency": "USD"}}
Parameter | Required | Description | Note |
Authorization | Yes | Signature authentication information. | |
Content-Type | Yes | application/json | - |
Property | Type | Required | Description |
out_trade_no | string | Yes | Merchant order number, provided when the merchant places the order. |
Property | Type | Required | Description |
mch_id | string | Yes | Merchant ID, provided when the merchant places the order. |
204 No Content
Parameter | Required | Description | Description |
Authorization | Yes | Signature authentication information. | |
Content-Type | Yes | application/json | - |
Property | Type | Required | Description |
appid | string | Yes | Mini program appid. |
description | string | Yes | Product description, up to 127 characters. |
out_trade_no | string | Yes | Internal order number in the merchant system, must be 6-32 characters long, can only include numbers, uppercase and lowercase letters, _-|*, and must be unique within the same merchant ID. |
time_expire | string | Yes | 1. Definition: The payment end time is the last time the user can complete the payment for this order, not the order closing time. After this time, the user will not be able to pay for the order. To close an order, call the order closing API. 2. Format requirements: The payment end time shall follow the RFC 3339 standard format: yyyy-MM-DDTHH:mm:ss+TIMEZONE. YYYY-MM-DD represents the date; T separates the date and time; HH:mm:ss represents the time; TIMEZONE represents the time zone (e.g., +08:00 for Beijing time). 3. Parameters can only be configured when the user first places an order, and subsequent modifications are not allowed, attempts to modify will result in errors. If the actual payment time exceeds the set payment end time, the merchant needs to place a new order with a new merchant order number for the user to pay. If the payment end time has not been exceeded, the original parameters can be used to request the order API again to get the latest prepay_id for payment. The payment end time cannot be earlier than 1 minute after the order time. If the set payment end time is earlier, the system will automatically adjust it to 1 minute after the order time. |
attach | string | No | Custom data packet provided by the merchant when creating the order, not visible to the user, used to store merchant custom information related to the order, with a total length limit of 128 characters. This field will be returned to the merchant in the order query API and payment success callback notification, and will also appear in the transaction bill. |
notify_url | string | Yes | The URL where the merchant receives payment success callback notifications. It must comply with the guidelines for setting notify_url. |
amount | object | Yes | Order amount. |
amount.total | integer | No | Actual amount paid by the user, an integer value, in cents. User payment amount = total amount - voucher amount. |
amount.currency | string | No | Currency type, a three-letter code compliant with ISO 4217. |
payer | object | Yes | Payer information. |
payer.openid | string | No | A unique identifier for each user within a single merchant's mini program appid. The user's openid must be obtained before placing an order. For details, see Mini Program Login |
detail | object | Yes | Discount feature. |
detail.cost_price | integer | No | Original price of the order. |
detail.goods_detail | array[object] | No | List of individual product details. |
detail.goods_detail.merchant_goods_id | string | No | Unified product ID defined by the payment system (optional). |
detail.goods_detail.goods_name | string | No | Actual product name. |
detail.goods_detail.quantity | integer | Yes | Quantity of products purchased by the user. |
detail.goods_detail.unit_price | integer | Yes | Integer, unit: cents. If the merchant offers a discount, the discounted unit price should be provided (e.g., if a user uses a 100-50 coupon on a 100 USD order, the unit price of the promotional product should be the original unit price minus 50). |
Property | Type | Required | Description |
prepay_id | string | Yes | Prepay transaction session identifier, required for JSAPI or mini program payment initiation, valid for 2 hours. If it expires, a new prepay_id must be requested by calling this API again. |
{"prepay_id":"pi173898442419368bhz26jn4rikpwzr1akn"}
Parameter | Description | Note |
Pay-Serial | The serial number of the superapp payment certificate used for verification. | - |
Pay-Signature | Signature verification value. | |
Pay-Timestamp | Timestamp for verification. | - |
Pay-Nonce | Random string for verification. | - |
Property | Type | Required | Description |
id | string | Yes | Unique identifier for the callback notification. |
create_time | string | Yes | The time when the callback notification was created. Format: Follow the RFC 3339 standard format: YYYY-MM-DDTHH:mm:ss+TIMEZONE. YYYY-MM-DD represents the date; T separates the date and time; HH:mm:ss represents the time; TIMEZONE represents the time zone (e.g., +08:00 corresponds to UTC+8). Example: 2015-05-20T13:29:35+08:00 represents 13:29:35 on May 20, 2015 (UTC+8). |
resource_type | string | Yes | Resource data type of the notification. It is fixed as encrypt-resource. |
event_type | string | Yes | Type of payment callback notification. For successful payment notifications, the type is TRANSACTION.SUCCESS. |
pay_model | string | No | Type of payment bank card, OTHERS for non-bank card payments. |
summary | string | Yes | The summary note for callback content in the payment system, limited to 64 characters. |
Resource | object | Yes | Notification resource data. |
resource.original_type | string | Yes | Original callback type: The object type before encryption, which is transaction. |
resource.algorithm | string | Yes | Encryption algorithm type for the callback data ciphertext. It is currently AEAD_AES_256_GCM. Developers need to use the same type of data for decryption. |
resource.ciphertext | string | Yes | Data ciphertext: The Base64-encoded ciphertext of the callback data. Merchants need to Base64 decode and decrypt it. For more information, see Decrypt Callback Messages. |
resource.associated_data | string | No | Additional data for decryption, this field may be empty. |
resource.nonce | string | Yes | Random string involved in decryption. |
Property | Type | Required | Description |
ok | string | Yes | - |
{"ok"}
Property | Type | Required | Description |
appid | string | Yes | Mini program appid. |
merchant_id | string | Yes | Merchant ID. |
out_trade_no | string | Yes | Merchant order number. |
transaction_id | string | Yes | Transaction ID on the superapp side. |
trade_type | string | No | Transaction type: JSAPI for mini program payments. |
trade_state | string | Yes | Transaction status. Valid values: SUCCESS: Payment successful; CLOSED: Closed; PAY_ERROR: Payment failed. |
bank_type | string | No | Bank code. Non-bank card payment types are uniformly marked as OTHERS. |
attach | string | No | |
success_time | string | No | Payment completion time. Format: YYYY-MM-DDTHH:MM:SS+TIMEZONE. |
payer | object | No | Payer information. |
payer.openid | string | No | A unique identifier for each user within a single merchant's mini program appid. |
amount | object | No | Order amount. |
amount.payer_total | string | No | The actual amount paid by the user (in cents). |
amount.total | string | No | Total order amount (in cents). |
amount.currency | string | No | Currency type, a three-letter code compliant with ISO 4217. |
amount.payer_currency | string | No | The currency used by the user for the payment. |
{"appid": "mpco56h12e6e52hj","merchant_id": "mi_7b0a5e40f9","out_trade_no": "2b695106b888d14328d9","transaction_id": "pi1738915449351wbrgic93qlahw34134wjr","trade_type": "JSAPI","trade_state": "SUCCESS","bank_type": "OTHERS","attach": "attach info","success_time": "2025-02-28T10:34:56+08:00","payer": {"openid": "o910d4edeee717377adguZS89513"},"amount": {"payer_total": "88800","total": "88800","currency": "USD","payer_currency": "USD"}}
Error description | Error example |
URL only contains a domain, missing a specific path. | http://www.domain.com |
URL does not start with https:// or http://, missing domain or IP. | ./PayNotify.aspx |
URL contains a local or internal network IP. | http://127.0.0.1/pay/notify.php |
The string entered is not in URL format. | xxxxxxx, 1234567, test |
Parameter | Required | Description | Note |
Authorization | Yes | Signature authentication information. | |
Content-Type | Yes | application/json | - |
Property | Type | Required | Description |
merchant_id | string | Yes | Merchant ID. |
transaction_id | string | No | Transaction ID on the superapp side (Either this or out_trade_no must be provided.) |
out_trade_no | string | No | Merchant order number, either this or transaction_id must be provided. |
out_refund_no | string | Yes | Merchant refund number. Must be unique under the same merchant ID. |
reason | string | No | Refund reason. |
notify_url | string | No | Refund result notification URL. |
amount.refund | integer | Yes | Refund amount (in cents). |
amount.total | integer | Yes | Total amount of the original order (in cents). |
amount.currency | string | Yes | Currency type, a three-letter code compliant with ISO 4217. |
goods_detail[].merchant_goods_id | string | No | Merchant's product code. |
goods_detail[].goods_name | string | No | Product name. |
goods_detail[].unit_price | integer | No | Product unit price (in cents). |
goods_detail[].refund_amount | integer | No | Refund amount (in cents). |
goods_detail[].refund_quantity | integer | No | Number of items refunded. |
Property | Type | Required | Description |
refund_id | string | Yes | Refund ID on the superapp side. |
out_refund_no | string | Yes | Merchant refund number. |
transaction_id | string | Yes | Transaction ID on the superapp side. |
out_trade_no | string | Yes | Merchant order number. |
channel | string | Yes | Refund channel. Valid values: ORIGINAL: Refund to original payment method; BALANCE: Refund to balance; OTHER_BALANCE: Refund to another balance account; OTHER_BANKCARD: Refund to another bank card. |
user_received_account | string | Yes | Account receiving the refund funds. |
success_time | string | No | Refund success time. Returned only when status is SUCCESS. Format: YYYY-MM-DDTHH:mm:ss+TIMEZONE. |
create_time | string | Yes | Refund creation timestamp. |
status | string | Yes | Refund status. Valid values: PROCESSING: Processing; SUCCESS: Succeeded; CLOSED: Closed; ABNORMAL: Abnormal. |
amount.total | integer | Yes | Total order amount (in cents). |
amount.refund | integer | Yes | Refund amount (in cents). |
amount.payer_total | integer | Yes | Amount paid by user (in cents). |
amount.payer_refund | integer | Yes | Refund amount to user (in cents). |
amount.currency | string | Yes | Currency type. |
{"refund_id": "rf17389154493510001","out_refund_no": "refund_2b695106b888","transaction_id": "pi1738915449351wbrgic93qlahw34134wjr","out_trade_no": "2b695106b888d14328d9","channel": "ORIGINAL","user_received_account": "Account receiving the refund funds","create_time": "2025-02-28T11:00:00+08:00","status": "PROCESSING","amount": {"total": 88800,"refund": 44400,"payer_total": 88800,"payer_refund": 44400,"currency": "USD"}}
Parameter | Required | Description | Note |
Content-Type | Yes | application/json | - |
Property | Type | Required | Description |
mch_id | string | Yes | Merchant ID. |
openid | string | Yes | User's openid at the time of order placement. |
transaction_id | string | No | Transaction ID on the superapp side (Either this or out_trade_no must be provided.) |
out_trade_no | string | No | Merchant order number, either this or transaction_id must be provided. |
out_refund_no | string | Yes | Merchant refund number. Uniquely identifies a refund. |
reason | string | No | Refund reason. |
notify_url | string | No | Refund result notification URL. |
amount.refund | integer | Yes | Refund amount (in cents). |
amount.total | integer | Yes | Total amount of the original order (in cents). |
amount.currency | string | Yes | Currency type. |
req_from | string | No | Refund source. Valid values: 1: Customer service-initiated; 2: User-initiated; 3: Other. |
Property | Type | Required | Description |
code | string | Yes | Return code. 0: Request successful. |
messages | string | Yes | Return message. |
request_id | string | Yes | Request ID. |
refund_id | string | Yes | Refund ID on the superapp side. |
out_refund_no | string | Yes | Merchant refund number. |
{"code": "0","message": "success","request_id": "req_xxxx","refund_id": "rf17389154493510002","out_refund_no": "vrefund_2b695106"}
Parameter | Required | Description | Note |
Authorization | Yes | Signature authentication information. | |
Content-Type | Yes | application/json | - |
Property | Type | Required | Description |
out_refund_no | string | Yes | Merchant refund number (path parameter). |
merchant_id | string | Yes | Merchant ID (query parameter). |
Property | Type | Required | Description |
refund_id | string | Yes | Refund ID on the superapp side. |
out_refund_no | string | Yes | Merchant refund number. |
transaction_id | string | Yes | Transaction ID on the superapp side. |
out_trade_no | string | Yes | Merchant order number. |
channel | string | Yes | Refund channel. Valid values: ORIGINAL: Refund to original payment method; BALANCE: Refund to balance; OTHER_BALANCE: Refund to another balance account; OTHER_BANKCARD: Refund to another bank card. |
user_received_account | string | Yes | Account receiving the refund funds. |
success_time | string | No | Refund success time. Returned only when status is SUCCESS. Format: YYYY-MM-DDTHH:mm:ss+TIMEZONE. |
create_time | string | Yes | Refund creation timestamp. |
status | string | Yes | Refund status. Valid values: PROCESSING: Processing; SUCCESS: Succeeded; CLOSED: Closed; ABNORMAL: Abnormal. |
amount.total | integer | Yes | Total order amount (in cents). |
amount.refund | integer | Yes | Refund amount (in cents). |
amount.payer_total | integer | Yes | Amount paid by user (in cents). |
amount.payer_refund | integer | Yes | Refund amount to user (in cents). |
amount.currency | string | Yes | Currency type. |
{"refund_id": "rf17389154493510001","out_refund_no": "refund_2b695106b888","transaction_id": "pi1738915449351wbrgic93qlahw34134wjr","out_trade_no": "2b695106b888d14328d9","channel": "ORIGINAL","user_received_account": "Account receiving the refund funds","success_time": "2025-02-28T11:05:00+08:00","create_time": "2025-02-28T11:00:00+08:00","status": "SUCCESS","amount": {"total": 88800,"refund": 44400,"payer_total": 88800,"payer_refund": 44400,"currency": "USD"}}
Property | Type | Required | Description |
out_refund_no | string | Yes | Merchant refund number (path parameter). |
merchant_id | string | Yes | Merchant ID (query parameter). |
access_token | string | Yes | Mini program API access token (query parameter). |
pay_sig | string | Yes | Virtual payment signature (query parameter). |
Property | Type | Required | Description |
refund_id | string | Yes | Refund ID on the superapp side. |
out_refund_no | string | Yes | Merchant refund number. |
transaction_id | string | Yes | Transaction ID on the superapp side. |
out_trade_no | string | Yes | Merchant order number. |
channel | string | Yes | Refund channel. Valid values: ORIGINAL: Refund to original payment method; BALANCE: Refund to balance; OTHER_BALANCE: Refund to another balance account; OTHER_BANKCARD: Refund to another bank card. |
user_received_account | string | Yes | Account receiving the refund funds. |
success_time | string | No | Refund success time. Returned only when status is SUCCESS. Format: YYYY-MM-DDTHH:mm:ss+TIMEZONE. |
create_time | string | Yes | Refund creation timestamp. |
status | string | Yes | Refund status. Valid values: PROCESSING: Processing; SUCCESS: Succeeded; CLOSED: Closed; ABNORMAL: Abnormal. |
amount.total | integer | Yes | Total order amount (in cents). |
amount.refund | integer | Yes | Refund amount (in cents). |
amount.payer_total | integer | Yes | Amount paid by user (in cents). |
amount.payer_refund | integer | Yes | Refund amount to user (in cents). |
amount.currency | string | Yes | Currency type. |
{"refund_id": "rf17389154493510002","out_refund_no": "vrefund_2b695106","transaction_id": "pi1738915449351wbrgic93qlahw34134wjr","out_trade_no": "2b695106b888d14328d9","channel": "ORIGINAL","user_received_account": "Virtual account","success_time": "2025-02-28T11:05:00+08:00","create_time": "2025-02-28T11:00:00+08:00","status": "SUCCESS","amount": {"total": 100,"refund": 50,"payer_total": 100,"payer_refund": 50,"currency": "CNY"}}
Parameter | Description | Description |
Pay-Serial | The serial number of the superapp payment certificate used for verification. | - |
Pay-Signature | The signature. | |
Pay-Timestamp | Timestamp. | - |
Pay-Nonce | Random string. | - |
Property | Type | Required | Description |
id | string | Yes | Notification ID. |
create_time | string | Yes | Notification creation time. |
resource_type | string | Yes | Notification resource type. Fixed value: encrypt-resource. |
event_type | string | Yes | Event type. Valid values: REFUND.SUCCESS; REFUND.ABNORMAL; REFUND.CLOSED. |
summary | string | Yes | Summary of the callback notification. |
resource.algorithm | string | Yes | Encryption algorithm. AEAD_AES_256_GCM. |
resource.original_type | string | Yes | Original data type. Fixed value: refund. |
resource.ciphertext | string | Yes | Base64-encoded ciphertext data. |
resource.nonce | string | Yes | Random string. |
resource.associated_data | string | No | Associated data. |
Property | Type | Required | Description |
refund_id | string | Yes | Refund ID on the superapp side. |
out_refund_no | string | Yes | Merchant refund number. |
transaction_id | string | Yes | Transaction ID on the superapp side. |
out_trade_no | string | Yes | Merchant order number. |
refund_status | string | Yes | Refund status. Valid values: SUCCESS; CLOSED; ABNORMAL. |
success_time | string | No | Refund success time. |
user_received_account | string | Yes | Account receiving the refund funds. |
amount.total | integer | Yes | Total order amount (in cents). |
amount.refund | integer | Yes | Refund amount (in cents). |
amount.payer_total | integer | Yes | Amount paid by user (in cents). |
amount.payer_refund | integer | Yes | Refund amount to user (in cents). |
amount.currency | string | Yes | Currency type. |
{"code": "SUCCESS", "message": "Succeeded"}
Property | Type | Required | Description |
eventType | string | Yes | Event type. |
event | string | Yes | Event name. |
payMode | string | Yes | Payment mode. |
payload | string | Yes | Encrypted callback data. |
payEventSig | string | Yes | Callback data signature. |
{"code": "SUCCESS", "message": "Succeeded"}
Property | Type | Required | Description |
Refund amount. | Validation | Yes | The refund amount for a single refund must not exceed the original order amount. |
Refund count | Configuration | Limited | The number of refunds per order is limited by the maxRefundCount configuration. |
Refund validity period | Configuration | Limited | Refunds must be submitted within maxRefundDays after payment (default: 365 days). |
Idempotency control | Logic | Auto | Requests with identical merchant_id and out_refund_no are deduplicated. |
Rate limiting | Logic | Auto | The same merchant_id + out_refund_no cannot be submitted again within one minute (standard payment). |
Distributed lock | Logic | Auto | Prevents concurrent duplicate submissions. |
PROCESSING → SUCCESS (Refund succeeded)PROCESSING → ABNORMAL (Refund abnormal)PROCESSING → CLOSED (Refund closed)
フィードバック