consultPayment (Cashier Payment)
The consultPayment API is used by the Acquiring Partner (ACQP) to retrieve available payment methods from Alipay+.
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 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.
paymentFactor PaymentFactor 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 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
UNIFIED
.
settlementStrategy SettlementStrategy 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 REQUIRED
The merchant information, including the merchant ID, merchant name, merchant category code, and so on.
env Env 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 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>
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
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: the paymentAmount.currency, settlementStrategy, and env parameters.
Result processing logic
You might receive different results from Alipay+. Follow the instructions below to handle the result.
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 inquiry if no aggregated logos are preconfigured. In this case, the default Alipay+ logo is returned.
Response of a successful inquiry if aggregated logos are preconfigured. In this case, a list of aggregated logos is returned.
Response of a failed query, where the value of result.resultStatus is U
, and resultCode and resultMessage indicate the detailed reason for the failure:
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. |