/v1/payments/inquiryPayment

POST /v1/payments/inquiryPayment

The inquiryPayment API is used to inquire about the payment result, usually when not able to receive the payment result after a long period of time. Such as:

Note:

1) After Merchant initiates the payment and cannot receive the payment result after a long period of time, it can poll the Payment Status Inquiry interface.

2) Merchant uses InquiryPayment to determine the Payment status in the asynchronous Payment processing scenario.

Round-robin interval, recommended 5s 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

partnerId

String

Yes

The partner ID, which is allocated by the wallet.

Max. length: 32 characters.

paymentId

String

No

The unique ID of a payment, which is generated by the wallet.

Max. length: 64 characters.

paymentRequestId

String

No

The unique ID of a payment, which is generated by the wallet merchants.

Max. length: 64 characters.

extendInfo

String

No

The extended information that wallets and merchants want to describe.

Max. length: 4096 characters.

copy
{
    "memo": "memo"
}

Response

Property

Data Type

Required

Description

Example

result

Result

Yes

The request result, which contains information related to the request result, such as status and error codes.

paymentId

String 

No

The unique ID of a payment generated by the wallet.

Max. length: 64 characters.

paymentRequestId

String 

No

The unique ID of a payment, which is generated by the wallet merchants.

Max. length: 64 characters.

paymentAmount

Amount

No

Order amount for the display of user consumption records on the payment results page.

paymentTime

String/Datetime

No

Payment success time, which follows the ISO 8601 standard.

paymentStatus

String

No

SUCCESS - order is succeeded.

FAIL - order is failed.

PROCESSING - order is not paid or is paid but not finish.

CANCELLED - order is canceled.

paymentFailReason

String 

No

The fail reason of payment order when paymentStatus is FAIL.

Max. length: 256 characters.

authExpiryTime

String/Datetime

No

Authorization expiry time, which has value only when paymentFactor.isAuthorizationPayment is true.

extendInfo

String

No

The extended information that wallets and merchants want to describe.

Max. length: 4096 characters.

copy
{
    "memo": "memo"
}

Result Process Logic

In the response, the result.resultStatus field indicates the result of processing a request. The following table describes each result status:

Result Status

Description 

S

The payment status inquiry is successful, then check paymentStatus:

  • if paymentStatus is PROCESSING, the order is not paid or is paid but not finish.
  • if paymentStatus is SUCCESS, the order is succeeded.
  • if paymentStatus is FAIL, the order is failed.
  • if paymentStatus is CANCELLED, the order is canceled.

F

The payment status inquiry is failed.

The corresponding result.resultCode  and result.resultMessage may vary based on different situations. For details, see the following Error codes section.

U

The status of the payment is unknown. 

The corresponding result.resultCode is UNKNOWN_EXCEPTION, and 

result.resultMessage is "An API calling is failed, which is caused by unknown reasons". For details, see the Common error codes section.

Error codes

Error Code

Result Status

Error Message

Further Action

SUCCESS

S

Success

ORDER_NOT_EXIST

F

The order does not exist.

EXPIRED_AGENT_TOKEN

F

The access token of mini program is expired.

INVALID_AGENT_TOKEN

F

The access token of mini program is invalid.

Sample

Example: A Russian user (Bob) bought a 100 USD product on the e-commerce platform, paid by credit card, and submitted the payment synchronously, asynchronous polling payment results.

/v1/payments/inquiryPayment
  1. The mini program calls my.tradePay interface to do the payment (Step 1).
  2. The wallet returns the payment result to the mini program (Step 5).
  3. Also the wallet notifies the payment result with paymentNotifyUrl provided by the merchant (Step 4).
  4. Besides the merchant could call /v1/payments/inquiryPayment interface to query the payment result (Step 6).
  5. The wallet will return the payment status inquiry result to the merchant server (step 7).

Request

A. Inquiry By paymentRequestId                  

copy
{
 "paymentRequestId":"1022172000000000001xxxx",
 "partnerId":"20200101234567890132xxxx",
 "extendInfo": "{\"customerBelongsTo\":\"siteNameExample\"}"
}

B. Inquiry By paymentId

copy
{
 "paymentId":"1022172000000000001xxxx",
 "partnerId":"20200101234567890132xxxx",
 "extendInfo": "{\"customerBelongsTo\":\"siteNameExample\"}"
}
  • paymentId the unique Id of a payment generated by the wallet.
  • paymentRequestId the unique Id of a payment generated by the wallet merchants.
  • partnerId is allocated by the wallet.
  • extendInfo, includes key - customerBelongsTo the e-wallet that the customer uses. Corresponding to the field 'siteName' that obtained from the API 'my.getSiteInfo', in the mini program scenario this is mandatory.

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

copy
{
 "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"
}
  • result.resultStatus==S shows that the inquiry is successful.
  • paymentId is the unique ID of a payment generated by the wallet.
  • paymentRequestId the unique ID of a payment generated by the wallet merchants.
  • paymentTime describes the date-time of the successful wallet payment.
  • paymentAmount describes the payment amount.
  • paymentStatus describes the payment status.
  • paymentStatus.PROCESSING order is not paid or is paid but not finish.
  • paymentStatus.SUCCESS  order is succeeded.
  • paymentStatus.FAIL  order is failed.
  • paymentStatus.CANCELLED  order is canceled.
  • paymentFailReason describes the payment fail reason when paymentStatus=FAIL.
  • authExpiryTime  describes the payment authorization expiry time, when payment order is paymentFactor.isAuthorizationPayment=true.