consultPaymentACQP → Alipay+
The consultPayment API is used by the Acquiring Service Provider (ACQP) to retrieve available payment methods from Alipay+. Currently, this API is used in the Cashier Payment and Auto Debit scenarios.
When a consumer places an order and gets redirected to the cashier page, the merchant must display the available payment methods to the consumer. The ACQP sends a request to Alipay+ on behalf of the merchant to consult the available payment methods. After receiving the response, the ACQP returns the payment method list to the merchant, who then displays the available payment methods on the cashier page.
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
paymentAmount Amount object REQUIRED
The amount that the ACQP requests to receive from Alipay+. The currency of the amount must be specified to the one that the ACQP uses to create the payment order.
Note: If the payment amount cannot be provided, set the value of the paymentAmount.value parameter to 0
and specify a value for the paymentAmount.currency parameter.
userRegion String
This parameter is used to sort the payment method list in descending order based on the relevance between the MPP and the user region on the Alipay+ checkout page. The value of this parameter is a 2-letter country/region code according to ISO 3166 Country Codes.
For example, you might receive ALIPAY_CN
and KAKAOPAY
as supported MPPs in the result. However, you find out that the user is from South Korea based on the user's IP address or selection. In this case, KaKaoPay
is placed higher on the list even though both MPPs support the transaction.
Note: Required if the ACQP wants to sort the payment method list on the Alipay+ checkout page based on the user region.
More information:
- Maximum length: 2 characters
paymentFactor PaymentFactor object REQUIRED
Factors that impact payment-related items such as service fee, interchange fee (also known as interpartner fee), and regulatory reporting. This parameter is used to identify the payment scenario.
Note:
- In the Auto Debit scenario, the following child parameters must be set to the specific values as shown below:
- isAgreementPayment: set the value to
true
- In the Cashier Payment scenario, the following child parameters must be set to the specific values as shown below:
- isInStorePayment: set the value to
false
- isCashierPayment: set the value to
true
- presentmentMode: set the value to
TILE
if the tile mode is used and set the value toBUNDLE
if the bundle mode is used.
settlementStrategy SettlementStrategy object REQUIRED
The settlement strategy that is applied to the payment order, for example, the currency that the ACQP wants to be settled against.
merchant Merchant object REQUIRED
The merchant information, including the merchant ID, merchant name, merchant category code, and so on.
referenceUserId String
The unique ID of the user that is assigned by the merchant.
More information:
- Maximum length: 64 characters
env Env object REQUIRED
The environment information about the device that is used by the user to place orders.
Note: The following child parameters must be specified as follows:
- terminalType
- osType if the value of env.terminalType is
APP
orWAP
Response parameters
result Result object REQUIRED
The result of the business processing, including the result status, result code, and the result message. For more information about how to handle the result of the consultPayment API, see Result processing logic.
paymentOptions Array<PaymentOption> object
The list of payment options.
Note: Returned by Alipay+ if the value of the result.resultStatus parameter is S
, which means that the consultation succeeds. In this case, apart from the required child parameters, the following optional child parameter is also returned:
- brandName
- logo
More information:
- Maximum size: 1 element
Request
Response
More information
Request conditionality
The following parameters must be specified to the same values as those of the parameters specified in the pay API request: paymentAmount.currency, settlementStrategy, and env.
Result process logic
result.resultStatus | result.resultCode | Payment status | Actions |
S | SUCCESS | The consultation initiation succeeds. The paymentOptions parameter that contains the Alipay+ payment method information is returned in the response. | Render the merchant's cashier page. |
F | ... | Consultation fails. | Take actions according to the result code (specified on the result.resultCode parameter). For more information, see the Result code section. |
U | ... | Consultation is in processing. | Retry the same request. Ensure that the parameters are the same as the previous ones. |
No result received | Unknown. | Retry the same request. Ensure that the parameters are the same as the previous ones. |
Sample
Request
The Acquiring Partner sends a request to Alipay+.
Response
- Response of a successful consultation, where the value of result.resultStatus is
S
.
- Response of a failed consultation, where the value of result.resultStatus is
F
, and resultCode and resultMessage indicate the detailed reason for the failure.
- Response of a consultation with an unknown result, where the value of result.resultStatus is
U
.
Result/Error codes
Code | Value | Message | Further action |
---|---|---|---|
SUCCESS | S | SUCCESS. | Render the merchant's cashier page. |
ACCESS_DENIED | F | Access is denied. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
INVALID_CLIENT | F | The client is invalid. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
INVALID_SIGNATURE | F | The signature is invalid. | Check whether the public key, signed message, and signature algorithm are as expected. |
KEY_NOT_FOUND | F | The key is not found. | It is recommended that you contact connect_support@service.alipay.com to troubleshoot the issue. |
MEDIA_TYPE_NOT_ACCEPTABLE | F | The server does not implement the media type that is acceptable to the client. | Use a media type that is accepted by Alipay+. |
METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTPS method. | Ensure the HTTP method is POST. |
NO_INTERFACE_DEF | F | API is not defined. | Check whether the request URL is correct. Ensure that the endpoint of the called API is correct. |
NO_PAY_OPTIONS | F | No payment option exists. | N/A |
PARAM_ILLEGAL | F | Illegal 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 the Structure section of the specific API reference topic. |
PROCESS_FAIL | F | A 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_LIMIT | U | The request traffic exceeds the limit. | Reduce the frequency of API calls. |
UNKNOWN_EXCEPTION | U | An API call failed, which is caused by unknown reasons. | Try to recall the API. |