consult (Cashier Payment)
Use the consult API to initiate a payment consultation request to Alipay. This request is returned to the merchant with information on the different payment methods and its corresponding amount, country, currency, rules, and configuration.
The consult API enables merchants to:
- Provide consumers with multiple payment methods without bearing any additional costs caused by a change in these payment methods, or managing the logic of selecting and sorting these payment methods.
- Automate the selection and sorting of multiple payment methods.
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
productCode String REQUIRED
Represents the payment product that is being used. The payment product that can be used is stipulated in the contract. The fixed value is:
CASHIER_PAYMENT
: Indicates that this API is used for the Cashier Payment scenario.
More information:
- Maximum length: 3 characters
paymentAmount Amount REQUIRED
The payment amount that the merchant requests to receive in the order currency.
userRegion String
The 2-letter country or region code. For more information, see ISO 3166 Country Codes standard. The payment methods will be sorted based on payment method relevance for the given user's region.
More information:
- Maximum length: 2 characters
merchantRegion String
The country or region where the merchant operates the business. The parameter is a 2-letter country or region code that follows ISO 3166 Country Codes standard.
Some possible values are US
, SG
, HK
, PK
, JP
, CN
, BR
, AU
, and MY
.
This parameter is required when you use the Global Acquirer Gateway (GAGW) product.
More information:
- Maximum length: 2 characters
settlementStrategy SettlementStrategy
The settlement strategy.
allowedPaymentMethodRegions Array<String>
A list of region codes that represent the countries or regions of payment methods. The value of this parameter is a 2-letter ISO country code or GLOBAL
.
Specify this parameter if you want available payment methods from specific regions to be returned. For example, if you pass in GLOBAL
, global cards Visa and Mastercard are returned.
More information:
- Maximum length: 6 characters
env Env REQUIRED
Information about the environment where the order is placed, such as the device information.
Response parameters
result Result REQUIRED
The request result that contains information such as status and error codes.
Note: This field doesn't indicate the payment result. This field only indicates whether the consult interface is called successfully.
paymentOptions Array<PaymentOption>
The payment option list.
Request
Response
Result/Error codes
Code | Value | Message | Further action |
---|---|---|---|
SUCCESS | S | Success | The consultation is successful. No further action is needed. |
CURRENCY_NOT_SUPPORT | F | The currency is not supported. | Change the currency used in the request. If the issue persists, contact Alipay Technical Support for detailed reasons. |
MERCHANT_NOT_REGISTERED | F | The merchant is not registered. | Please register the merchant by using the registration interface. Contact Alipay Technical Support if failed to call the registration interface. |
NO_PAY_OPTIONS | F | No payment options are available. | Contact Alipay Technical Support. |
PARAM_ILLEGAL | F | The required parameters are not passed, or illegal parameters exist. For example, a non-numeric input, an invalid date, or the length and type of the parameter are wrong. | Check and verify whether the required request fields (including the header fields and body fields) of the current API are correctly passed and valid. |
PROCESS_FAIL | F | A general business failure occurred. | Do not retry. Human intervention is usually needed. It is recommended that you contact Alipay Technical Support to troubleshoot the issue. |
SETTLE_CONTRACT_NOT_MATCH | F | No matched settlement contract can be found. | Check the following for a solution:
|
UNKNOWN_EXCEPTION | U | An API call has failed, which is caused by unknown reasons. | Call the interface again to resolve the issue. If not resolved, contact Alipay Technical Support. |