/v2/payments/inquiryPayment
POST /v2/payments/inquiryPayment
The inquiryPayment
 API is used to inquire about the payment result, usually when merchants cannot receive the payment result after a long period of time.
Note:
- After a merchant initiates a payment, when the merchant cannot receive the payment result after a long period of time, it can poll the Payment Status Inquiry interface.
- Merchants can use the
inquiryPayment
 API to determine the payment status in the asynchronous payment processing scenario. - Round-robin interval, recommended 5 seconds once, up to 1 minute.
Message structure
A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:
Request
Property | Data Type | Required | Description | Example |
paymentId | String | No | The unique ID of payment is generated by the wallet. Max. length: 64 characters. | "20312172123000019xxxx" |
paymentRequestId | String | No | The unique ID of payment is generated by the wallet merchants. Max. length: 64 characters. | "1022172000000000001xxxx" |
extendInfo | String | No | The extended information that wallets and merchants want to describe. Max. length: 4096 characters. | copy
|
Response
Property | Data Type | Required | Description | Example |
result | Yes | The request result, which contains information related to the request result, such as status and error codes. | { Â Â "resultCode":"SUCCESS", Â Â "resultStatus":"S", Â Â "resultMessage":"success" Â } | |
paymentId | String | No | The unique ID of a payment generated by the wallet. Max. length: 64 characters. | "20312172123000019xxxx" |
paymentRequestId | String | No | The unique ID of a payment is generated by merchants. Max. length: 64 characters. | "20200101234567890133333xxxx" |
paymentAmount | No | Order amount on the payment results page, which displays user consumption records. | { Â Â "value":"100", Â Â "currency":"USD" } | |
paymentTime | String/Datetime | No | Payment success time, which follows the ISO 8601Â standard. | "2020-01-01T12:01:01+08:30" |
paymentCreateTime | String/Datetime | No | Payment creation time, which follows the ISO 8601Â standard. | "2020-01-01T11:01:01+08:30" |
paymentStatus | String | No |
| "SUCCESS" |
paymentResultCode | String | No | The payment result code. Max. length: 64 characters. | "S" |
paymentResultMessage | String | No | The payment result message. Max. length: 256 characters. | "Pay Successfully" |
transactions | Array<Transactions> | No | Information about the transaction. | |
extendInfo | String | No | The extended information that wallets and merchants want to describe. Max. length: 4096 characters. | copy
|
Result Process Logic
In the response, the result.resultStatus
field indicates the result of processing a request as follows.
resultStatus | Description |
S | The corresponding It means that the payment status inquiry is successful, then check theÂ
|
U | The corresponding It means that an unknown exception occurs on the wallet side. The merchant/partner can try again. |
F | The corresponding It means that the payment status inquiry is failed. When |
Error codes
Error codes are usually classified into the following categories:
- Common error codes are common for all mini program's OpenAPIs. Â
- API-specific error codes are listed in the following table.
resultStatus | resultCode | resultMessage | Further Action |
F | ORDER_NOT_EXIST | The order does not exist. | |
F | EXPIRED_AGENT_TOKEN | The agent token of a mini program is expired. | |
F | INVALID_AGENT_TOKEN | The agent token of a mini program is invalid. |
Sample
Example: A Russian user (Bob) bought a 100 USDÂ product on the e-commerce platform, paid by credit cards, and submitted the payment synchronously, asynchronous polling payment results.
- The mini program calls my.tradePay interface to do the payment (Step 1).
- The wallet returns the payment result to the mini program (Step 5).
- Also the wallet notifies the payment result with paymentNotifyUrl provided by the merchant (Step 4).
- Besides the merchant could call this
inquiryPayment
 interface to query the payment result (Step 6). - The wallet will return the payment status inquiry result to the merchant server (step 7).
Request
A. Inquiry By paymentRequestId         Â
{
"paymentRequestId":"1022172000000000001xxxx"
}
B. Inquiry By paymentId
{
"paymentId":"20312172123000019xxxx"
}
- paymentId: The unique ID of a payment generated by the wallet.
- paymentRequestId: The unique ID of a payment generated by the wallet merchants.
Note:
This interface support querying with paymentId or paymentRequestId. paymentId has a higher priority than paymentRequestId, which means that if you offer both paymentId and paymentRequestId, we will use paymentId and ignore paymentRequestId.
Response
{
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"success"
},
"paymentId":"20200101234567890133333xxxx",
"paymentRequestId":"20200101234567890133333xxxx",
"paymentTime": "2020-01-01T12:01:01+08:30",
"paymentAmount":{
"value":"100",
"currency":"USD"
},
"paymentStatus":"SUCCESS",
"paymentResultCode":"S",
"paymentResultMessage":"Pay Successfully"
}
- result.resultStatus==S shows that the inquiry is successful.
- paymentId is the unique ID of a payment generated by the wallet.
- paymentRequestId is the unique Id of a payment generated by wallet merchants.
- paymentTime describes the date-time of the successful wallet payment.
- paymentAmount describes the payment amount.
- paymentStatus describes the payment status.
- paymentStatus.PROCESSING means an order is not paid or is paid but not finish.
- paymentStatus.SUCCESS Â means an order is succeeded.
- paymentStatus.FAILÂ means an order is failed.
- paymentStatus.CANCELLEDÂ means an order is canceled.