consultAddablePaymentMethod
POST /ams/api/v1/paymentMethods/consultAddablePaymentMethod
Use this API to retrieve the addable payment methods with the corresponding use scenes, such as Bind, Top-up, Pay, and so on. With this API call, the merchant can show the addable payment methods for their users before they want to bind a payment method.
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
Field | Data type | Required | Description | Examples |
customerId | String | Yes | The unique ID that is used to identify a buyer. This field is composed of 16 digits and begins with 21. More information about this field:
| "2162878776333" |
scenes | Array<BusinessSceneCode> | No | A list of the business scenarios that is available for different payment methods. See BusinessSceneCode for details. Note: This field is optional and, in most cases, you can just give a null value. | ["TOPUP"] |
env | Yes | The environment information, and data collection for transaction risk. See Env for details.
| { "appVersion": "6.84.2", "clientIp": "175.***.**.***", "deviceModel": "TECNO LD7", "deviceTokenId": "wiQ5Hlwx3QLMkRS3R3OMtOAnznRWKJ6lFPgs7GDgihiuimC9fQEAAA==", "language": "en-PH", "operateEntrance": "DWS", "osType": "Android", "osVersion": "10", "sessionId": "********************************", "terminalType": "APP", "umidTokenId": "DYQAEhpLPO4XcQN9vXk/RHl6C7oLX+41" }, |
Response parameters
Field | Data type | Required | Description | Examples |
result | Yes | The request result, which contains information such as status and error codes. | / | |
paymentOptions | List<PaymentOption> | No | List of payment options. See PaymentOption for details. | [ { "enabled": true, "paymentMethodCategory": "MIXEDCARD", "paymentMethodType": "MIXEDCARD", "paymentOptionDetail": "{\"card\":{\"bankInfos\":[],\"supportCardBrands\":[{\"cardBrand\":\"MASTERCARD\",\"supportedCurrencies\":[\"PHP\"]},{\"cardBrand\":\"VISA\",\"supportedCurrencies\":[\"PHP\"]}]},\"type\":\"card\"}", "preferred": false, "rank": 5000, "supportedCurrencies": [ "PHP" ] }, { "enabled": true, "paymentMethodCategory": "GCASH_EBANK", "paymentMethodType": "GCASH_EBANK", "paymentOptionDetail": "{\"type\":\"card\",\"card\":{\"bankInfos\":[{\"bankShortName\":\"GNGCASH\",\"cardIssuedCode\":\"GNGCASH\",\"enabled\":false}],\"paymentOptionMetadata\":\"{\\\"isSupportPaySimulate\\\":\\\"true\\\"}\",\"supportCardBrands\":[]}}", "preferred": false, "rank": 4800, "supportedCurrencies": [ "PHP" ] } ], |
Result processing logic
In the response, the result.resultStatus field indicates the result of the consultAddablePaymentMethod request. The following table describes each result status:
Result status | Description |
S | The consultAddablePaymentMethod request is accepted successfully. The corresponding result.resultCode is
|
U | The status of the consultAddablePaymentMethod request is unknown. The corresponding result.resultCode is |
F | The consultAddablePaymentMethod request failed. The corresponding result.resultCode and result.resultMessage may vary based on different situations. For details, see the following Error codes section. |
Error codes
Result code | Result status | Result message | Further action |
SUCCESS | S | Success | / |
PROCESS_FAIL | F | A general business failure occurred. Don't retry. | Human intervention is usually needed. It is recommended that you contact the technical support team to troubleshoot the issue. |
PARAM_ILLEGAL | F | Illegal parameters. For example, non-numeric input, or invalid date. | Check and verify whether the request fields, including the header fields and body fields, are correct and valid. For details on the fields of each API, see the specific API Structure section. |
UNKNOWN_EXCEPTION | U | API failed due to unknown reasons. | Call the interface again to resolve the issue. If the issue persists, contact Alipay Technical Support. |
NO_PAY_OPTIONS | F | No addable payment options found. | Contact Alipay Technical Support. |
USER_STATUS_ABNORMAL | F | The user status is abnormal. | Contact the digital wallet to check the user status. |
USER_NOT_EXIST | F | The user does not exist. | Contact Alipay Technical Support for detailed reasons. |
KEY_NOT_FOUND | F | Key is not found. | Check whether the private key or public key exists. If not, upload the private key in Alipay Developer Center. |
INVALID_API | F | API is invalid (or not active). | Check whether the API name, HTTP method, or request format is correct when sending the request. |
INVALID_CLIENT | F | Invalid client. | Check whether the client ID is correct, or contact Alipay Technical Support for detailed reasons. |
INVALID_SIGNATURE | F | Signature is invalid. | Check whether the private key used to sign a request matches the public key of Alipay Developer Center. |
REQUEST_TRAFFIC_EXCEED_LIMIT | U | Request traffic exceeds the limit. | Call the interface again to resolve the issue. If the issue persists, contact Alipay Technical Support. |
ACCESS_DENIED | F | Access denied. | Contact Alipay Technical Support for detailed reasons. |
SEND_TIMES_EXCEED_LIMIT | F | The send times exceed the limit. | Contact Alipay technical support to know the specific limitation. |
METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTP method. | Ensure the HTTP method is POST. |
Samples
request
The merchant sends a request to DWS.
{
"customerId": "****************",
"env": {
"appVersion": "6.84.2",
"clientIp": "175.***.**.***",
"deviceModel": "TECNO LD7",
"deviceTokenId": "wiQ5Hlwx3QLMkRS3R3OMtOAnznRWKJ6lFPgs7GDgihiuimC9fQEAAA==",
"language": "en-PH",
"operateEntrance": "DWS",
"osType": "Android",
"osVersion": "10",
"sessionId": "********************************",
"terminalType": "APP",
"umidTokenId": "DYQAEhpLPO4XcQN9vXk/RHl6C7oLX+41"
},
"scenes": ["TOPUP"]
}
response
DWS returns the request result.
{
"paymentOptions": [
{
"enabled": true,
"paymentMethodCategory": "MIXEDCARD",
"paymentMethodType": "MIXEDCARD",
"paymentOptionDetail": "{\"card\":{\"bankInfos\":[],\"supportCardBrands\":[{\"cardBrand\":\"MASTERCARD\",\"supportedCurrencies\":[\"PHP\"]},{\"cardBrand\":\"VISA\",\"supportedCurrencies\":[\"PHP\"]}]},\"type\":\"card\",\"businessScenes\": \"[\"BINDCARD\",\"TOPUP\"]\"}",
"preferred": false,
"rank": 5000,
"supportedCurrencies": [
"PHP"
]
},
{
"enabled": true,
"paymentMethodCategory": "GCASH_EBANK",
"paymentMethodType": "GCASH_EBANK",
"paymentOptionDetail": "{\"type\":\"card\",\"businessScenes\": \"[\"BINDCARD\",\"TOPUP\"]\",\"card\":{\"bankInfos\":[{\"bankShortName\":\"GNGCASH\",\"cardIssuedCode\":\"GNGCASH\",\"enabled\":false}],\"paymentOptionMetadata\":\"{\\\"isSupportPaySimulate\\\":\\\"true\\\"}\",\"supportCardBrands\":[]}}",
"preferred": false,
"rank": 4800,
"supportedCurrencies": [
"PHP"
]
}
],
"result": {
"resultCode": "SUCCESS",
"resultMessage": "success.",
"resultStatus": "S"
}
}