Alipay+Alipay+

inquiryPaymentACQP → Alipay+

POST /aps/api/v1/payments/inquiryPayment

The inquiryPayment API is used by the Acquiring Service Provider (ACQP) to query the payment result if no payment result is received after a certain period of time. 

Note: In the following sections, Mobile Payment Provider (MPP) is also known as Payment Service Provider. For example, the pspId parameter specifies the ID that identifies an MPP. 

Structure

A message consists of a header and body. The following sections are focused on the body structure. For the header structure, see:

Note: 

Set the data type of each field (except array) as String. This means that you must use double quotation marks (" ") to enclose the field value. Examples:

  • If the data type of a field is Integer and its value is 20, set it as "20".
  • If the data type of a field is Boolean and its value is true, set it as "true". 

Request parameters

paymentRequestId String  

The unique ID that is assigned by the ACQP to identify a payment order.

Note: Required if the paymentId parameter is not specified. 

More information about this field:

  • Maximum length: 64 characters

paymentId String  

The unique ID that is assigned by Alipay+ to identify a payment order.

Note: Required if the paymentRequestId parameter is not specified. 

More information about this field:

  • Maximum length: 64 characters

Response parameters

result Result object REQUIRED

The result of the business processing, including the result status, result code, and result message. For more information about how to handle the result of the inquiryPayment API, see Result processing logic.

Show child parameters

paymentResult Result object 

The result of the payment. See the Payment result codes table below for details.

Note: Returned if the value of the result.resultStatus parameter is S, which means that the inquiry is successful. 

Show child parameters

acquirerId String  

The unique ID that is assigned by Alipay+ to identify an ACQP.

Note: Returned by Alipay+ if the value of the result.resultStatus parameter is S, which means that the inquiry is successful.  

More information about this field:

  • Maximum length: 64 characters

pspId String  

The unique ID that is assigned by Alipay+ to identify an MPP. 

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

More information about this field:

  • Maximum length: 64 characters

paymentRequestId String  

The unique ID that is assigned by the ACQP to identify a payment order.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

More information about this field:

  • Maximum length: 64 characters

paymentId String  

The unique ID that is assigned by Alipay+ to identify a payment order.

Note: This parameter is returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds; otherwise, this parameter may or may not be returned. 

paymentAmount Amount object 

The amount that the ACQP requests to receive from Alipay+. The currency of the amount is the same as the one that the ACQP uses to create the payment order.

Note: Returned if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

Show child parameters

paymentTime Datetime  

The date and time when the payment order reaches a final state.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

More information about this field:

  • The value follows the ISO 8601 standard format. For example, "2019-11-27T12:01:01+08:00".

customerId String  

The unique ID that is assigned by Alipay+ to identify an MPP user.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S and the MPP provides a unique ID that identifies the user. 

More information about this field:

  • Maximum length: 64 characters

walletBrandName String  

The brand name of the MPP that is displayed to the customer.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

More information about this field:

  • Maximum length: 128 characters

transactions Array<Transaction> object 

The list of refund transactions that are related to the queried payment order.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S and at least one refund transaction is linked to the payment order.

More information about this field:

  • Maximum size: Unlimited
Show child parameters

settlementAmount Amount object 

The gross amount that Alipay+ settles to the ACQP. When the settlement currency (specified on the settlementAmount.currency parameter) is different from the payment currency (specified on the paymentAmount.currency parameter), the settlement amount that is specified on the settlementAmount.value parameter is calculated based on the paymentAmount and settlementQuote parameters.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds. 

Show child parameters

settlementQuote Quote object 

The exchange rate between the settlement currency (specified on the settlementAmount.currency parameter) and the payment currency (specified on the paymentAmount.currency parameter).

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S and the settlement currency is different from the payment currency. 

Show child parameters

customsDeclarationAmount Amount object 

The maximum amount that is to be declared by the ACQP to customs. The currency of the amount is the currency used by the MPP's user. For example, if the user uses ALIPAY_CN to pay, the currency is CNY.

Note: Returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S and customs declaration is required by the MPP's local authority (for now this only includes the Chinese Mainland). 

Show child parameters

mppPaymentId String  

The unique ID that is assigned by the MPP to identify a payment order.

This parameter is returned by Alipay+ if the value of the paymentResult.resultStatus parameter is S, which means that the payment succeeds.

More information about this field:

  • Maximum length: 64 characters
API Explorer
Sample CodesRun in Sandbox

Request

URL
Request Body

Response

Response Body

More information

Result processing logic

Alipay+ returns the following two kinds of results:

  • result: specifies whether the inquiryPayment API request is received successfully.
  • paymentResult: specifies the payment result.

You might receive different results from Alipay+. Follow the instructions below to handle the result.  

result.resultStatus

paymentResult.resultStatus

Payment status

Actions

S

S

Payment succeeds

Update the status from your server side.

S

F

If paymentResult.
resultCode
is ORDER_IS_CLOSED, the payment order is closed or cancelled; otherwise, the payment fails.

Take actions according to the result code (specified on the result.resultCode parameter). For more information, see Result code.

S

U

Payment is in processing.

Keep inquiring within the payment expiry time.

  • For User-presented Mode Payment, the inquiry request can be sent 10 to 20 times within the payment expiry time, which is 60 seconds by default.
  • For Merchant-presented Mode Payment, the inquiry request can be sent 30 to 60 times within the payment expiry time, which is 180 seconds by default.
  • For Cashier Payment, keep querying with an incremental frequency within the payment expiry time, which is 10 minutes by default.

If you still receive the same payment result of U after the payment is expired or after the maximun number of inquiries is exceeded, call the cancelPayment API.

F

...

The payment fails or the payment order does not exist.

  • For cases where the payment fails, take actions according to the result code (specified on the result.resultCode parameter or contact the technical support team at connect_support@service.alipay.com.
  • For cases where the payment order does not exist, the reason might be:
    • The payment order ID is incorrect. Use the correct payment order ID to perform inquiries.
    • The payment order is not created in the Alipay+ system yet. Keep inquiring.
      • For User-presented Mode Payment, the inquiry request can be sent 10 to 20 times within the payment expiry time, which is 60 seconds by default.
      • For Merchant-presented Mode Payment, the inquiry request can be sent 30 to 60 times within the payment expiry time, which is 180 seconds by default.
      • For Cashier Payment, keep querying with an incremental frequency within the payment expiry time, which is 10 minutes by default.
    • If you still receive the same result of U after the payment is expired or after the maximun number of inquiries is exceeded, call the cancelPayment API.

U

...

Unknown exception

Keep inquiring within the payment expiry time.

  • For User-presented Mode Payment, the inquiry request can be sent 10 to 20 times within the payment expiry time, which is 60 seconds by default.
  • For Merchant-presented Mode Payment, the inquiry request can be sent 30 to 60 times within the payment expiry time, which is 180 seconds by default.
  • For Cashier Payment, keep querying with an incremental frequency within the payment expiry time, which is 10 minutes by default.

If you still receive the same result of U, after the payment is expired or after the maximun number of inquiries is exceeded, call the cancelPayment API.

No result received

Unknown

Keep inquiring within the payment expiry time.

  • For User-presented Mode Payment, the inquiry request can be sent 10 to 20 times within the payment expiry time, which is 60 seconds by default.
  • For Merchant-presented Mode Payment, the inquiry request can be sent 30 to 60 times within the payment expiry time, which is 180 seconds by default.
  • For Cashier Payment, keep querying with an incremental frequency within the payment expiry time, which is 10 minutes by default.

If still no result is returned after the payment is expired or after the maximun number of inquiries is exceeded, call the cancelPayment API.

 

Result/Error codes

CodeValueMessageFurther action
SUCCESSSSuccess

N/A 

ACCESS_DENIEDFAccess is denied.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

INVALID_CLIENTFThe client is invalid.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

INVALID_SIGNATUREFThe signature is invalid.

Check whether the public key, signed message, and signature algorithm are as expected. 

KEY_NOT_FOUNDFThe key is not found.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

MEDIA_TYPE_NOT_ACCEPTABLEFThe server does not implement the media type that is acceptable to the client.

Use a media type that is accepted by Alipay+

METHOD_NOT_SUPPORTEDFThe server does not implement the requested HTTPS method.

Ensure the HTTP method is POST.

NO_INTERFACE_DEFFAPI is not defined.

Check whether the request URL is correct. Ensure that the endpoint of the called API is correct. 

ORDER_NOT_EXISTFThe order doesn't exist.

Close the order at the ACQP side and call the cancelPayment API. 

PARAM_ILLEGALFIllegal parameters. For example, non-numeric input, invalid date.

Check whether the request parameters, including the header parameters and body parameters, are correct and valid. For more information about the parameters of each API, see Structure of the specific API reference topic. 

PROCESS_FAILFA general business failure occurred. Do not retry.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.

REQUEST_TRAFFIC_EXCEED_LIMITUThe request traffic exceeds the limit.

Reduce the frequency of API calls.

UNKNOWN_EXCEPTIONUAn API call failed, which is caused by unknown reasons.

Try to recall the API.

Payment result codes

CodeValueMessageFurther action
SUCCESSSSuccess

Update the status from the ACQP side. 

BUSINESS_NOT_SUPPORTFThe payment business is not supported.

Check whether the parameter values in the request message, such as merchant ID and transaction currency, conform to the contract. If yes, it is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue; otherwise, correct the parameters to align with the contract. 

CURRENCY_NOT_SUPPORTFThe currency is not supported.

Ensure the currencies used in the request, such as payment currency and settlement currency, conform to the contract. If the issue persists, it is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. 

EXPIRED_CODEFThe code is expired.

Instruct the user to refresh the payment code. 

INVALID_CONTRACTFThe contract is invalid.

Check whether the parameter values in the request message, such as merchant ID and transaction currency, conform to the contract. If yes, it is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue; otherwise, correct the parameters to align with the contract. 

INVALID_TOKENFThe access token is invalid.

Instruct the user to authorize again. 

ORDER_IS_CLOSEDFThe order is closed.

Close the order at the ACQP side. 

PAYMENT_AMOUNT_EXCEED_LIMITFThe payment amount exceeds the limit that is specified by Alipay+.

It is recommended that you inform the user of the error.

PAYMENT_COUNT_EXCEED_LIMITFThe number of payments exceeds the limit.

Wait until the MPP server allows more requests. 

PROCESS_FAILFA general business failure occurred. Do not retry.

It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue.  

RISK_REJECTFThe request is rejected because of the risk control.

It is recommended that you inform the user of the error. 

UNAVAILABLE_PAYMENT_METHODFThe payment method is unavailable.

It is recommended that you inform the user of the error. 

USER_AMOUNT_EXCEED_LIMITFThe payment amount exceeds the payment limit that is specified by the user's digital wallet.

It is recommended that you inform the user of the error. 

USER_BALANCE_NOT_ENOUGHFThe user balance is not enough for the payment.

It is recommended that you inform the user of the error. 

USER_NOT_EXISTFThe user does not exist.

It is recommended that you inform the user of the error. 

USER_STATUS_ABNORMALFThe user status is abnormal.

It is recommended that you inform the user of the error. 

PAYMENT_IN_PROCESSUThe payment is being processed.

Call the inquiryPayment API to inquire about the payment result.