consultTopup
POST /ams/api/v1/topups/consultTopup
Use this API to query the list of available top-up methods and bindable top-up options that the user can top up with.
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 |
requestId | String | Yes | Idempotent for troubleshooting. More information about this field:
| "c70d48fd-37c0-4924-8b97-92a07feb7c11" |
customerId | String | Yes | The customer ID. More information about this field:
| "2162220005743705" |
topupAmount | Yes | The top-up amount. | { "value": 10000, "currency": "SGD" } | |
env | No | The environment information, and data collection for transaction risk. See Env for details. | / |
Response parameters
Field | Data type | Required | Description | Examples |
result | Result | Yes | The request result, which contains information such as status and error codes. | |
topupMethodInfos | List<TopupMethodInfo> | No | List of bounded top-up method info. | [ { "enabled": true, "topUpMethodDetail": "{\"storeValue\":{\"accountNo\":\"21692200051185F81704\",\"availableAmount\":{\"currency\":\"VND\",\"value\":\"0\"},\"frozenAmount\":{\"currency\":\"VND\",\"value\":\"0\"},\"topUpMethodDetailMetadata\":\"{\\\"balanceInfo\\\":\\\"{\\\\\\\"availableAmount\\\\\\\":{\\\\\\\"currency\\\\\\\":\\\\\\\"VND\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"0\\\\\\\"},\\\\\\\"currency\\\\\\\":\\\\\\\"VND\\\\\\\",\\\\\\\"frozenAmount\\\\\\\":{\\\\\\\"currency\\\\\\\":\\\\\\\"VND\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"0\\\\\\\"},\\\\\\\"totalAmount\\\\\\\":{\\\\\\\"currency\\\\\\\":\\\\\\\"VND\\\\\\\",\\\\\\\"value\\\\\\\":\\\\\\\"0\\\\\\\"}}\\\"}\",\"totalAmount\":{\"currency\":\"VND\",\"value\":\"0\"}},\"type\":\"storeValue\"}", "topUpMethodType": "PAYMENT_ACCOUNT", "preferred": false } ] |
topupOptions | List<TopupOption> | No | List of available top-up options. | [ { "amountLimitMap": { "VND": { "singleLimit": { "maxAmount": { "currency": "VND", "value": "999999999999" }, "minAmount": { "currency": "VND", "value": "1" } } } }, "enabled": true, "topUpMethodCategory": "MIXEDCARD", "topUpMethodType": "MIXEDCARD", "topUpOptionDetail": "{\"card\":{\"bankInfos\":[],\"supportCardBrands\":[{\"cardBrand\":\"NAPAS\",\"supportedCurrencies\":[\"VND\"]},{\"cardBrand\":\"MASTERCARD\",\"supportedCurrencies\":[\"VND\"]},{\"cardBrand\":\"JCB\",\"supportedCurrencies\":[\"VND\"]},{\"cardBrand\":\"VISA\",\"supportedCurrencies\":[\"VND\"]}]},\"type\":\"card\"}", "preferred": false, "rank": 4800, "supportedCurrencies": [ "VND" ] } ] |
amountLimitInfo |
Result processing logic
In the response, the result.resultStatus field indicates the result of the consultTopup request. The following table describes each result status:
Result status | Description |
S | The consultTopup request is accepted successfully. The corresponding result.resultCode is |
U | The status of the consultTopup request is unknown. The corresponding result.resultCode is |
F | The consultTopup request failed. The corresponding result.resultCode and result.resultMessage may vary based on different situations. For details, see the following Error codes section. |
Result codes
Result code | Result status | Result message | Further action |
SUCCESS | S | Success | N/A |
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. |
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 to know the specific 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. |
REPEAT_REQ_INCONSISTENT | F | Repeated requests are inconsistent. | Ensure the fields in the requests are the same. |
RISK_REJECT | F | Reject by risk control. | Prompt the user that the request is rejected because the risk control failed. |
RISK_CHALLENGE | F | Risk challenge. | Prompt the user to go through user information verification. |
AML_REJECT | F | AML reject the transaction. | Prompt the user that the request is rejected because of the high risk. |
USER_BALANCE_EXCEED_LIMIT | F | The total balance amount exceeded amount limit. | Consult Alipay Technical Support about the amount limit. |
USER_NOT_KYC | F | The user not complete the KYC. | Prompt the user to complete KYC. |
LOWER_EXCEED_AMOUNT_LIMIT | F | The total amount exceeded min-amount limit. | Consult Alipay Technical Support about the minimum amount. |
UPPER_EXCEED_AMOUNT_LIMIT | F | The total amount exceeded max-amount limit. | Consult Alipay Technical Support about the maximum amount. |
Samples
Request
The merchant sends a request to DWS.
{
"requestId":"999912314213",
"customerId": "2165210039309494",
"topupAmount": {
"value": 10000,
"currency": "SGD"
},
"env": {
"clientIp": "180.74.64.146",
"sessionId": "GZ00x9wKFvPfMf8BaCrKqBPr5iHMn6imobilegwGZ00",
"deviceTokenId": "QMHYNKSPtQkvhh5cj/NDdJpyuLzS1f5+FN+B657n8dB63ZRKfwEAAA",
"terminalType": "IPAY_APP",
"language": "en_MY",
"clientUmid": "null",
"userAgent": "mozilla/5.0 (linux; u; android 11; zh-cn; cph1969 build/rp1a.200720.011) applewebkit/537.36 (khtml,like gecko) version/4.0 chrome/69.0.3497.100 uws/3.22.1.205 mobile safari/537.36 aliapp(la/6.94.3) ucbs/2.11.1.1 ttid/600***@lazada_android_6.94.3 windvane/8.5.0 1080x2228",
"cookieId": "null",
"umidTokenId": "null",
"osType": "android",
"osVersion": "11",
"deviceModel": "unknow",
"deviceVersion": "null",
"appVersion": "6.94.3",
"browserVersion": "4.0",
"browserType": "Android Browser",
"isPastedCard": false,
"operateEntrance": "null",
"longitude": "null",
"latitude": "null",
"imei": "null",
"clientUuid": "null",
"utdId": "null",
"verifyEnvData": "null",
"hideProcessPayment": false
}
}
Response
DWS returns the request result.
{
"topupMethodInfos": [
{
"enabled": true,
"topupMethodDetail": "{\"card\":{\"cardIssuer\":\"MOMO\",\"cardToken\":\"ALIPAYHWuKSBwokmmIZVmVlkRiSbrZRgzKc+SKuKP6Nh2lH5U+UytZNXEsH43GVtfH2uUgecG+d5jFylCRsGrtK8j0YA\u003d\u003d\",\"instUserName\":{},\"topUpMethodDetailMetadata\":\"{\\\"cardIndex\\\":\\\"20210312190279001699I8800024560\\\"}\"},\"type\":\"card\"}",
"topupMethodType": "MIXEDCARD",
"preferred": false
}
],
"topupOptions": [
{
"amountLimitInfoMap": {
"SGD": {
"singleLimit": {
"maxAmount": {
"currency": "SGD",
"value": "999999999999"
},
"minAmount": {
"currency": "SGD",
"value": "1"
}
}
}
},
"enabled": true,
"topupMethodCategory": "MIXEDCARD",
"topupMethodType": "MIXEDCARD",
"topupOptionDetail": "{\"card\":{\"bankInfos\":[],\"supportCardBrands\":[{\"cardBrand\":\"NAPAS\",\"supportedCurrencies\":[\"SGD\"]},{\"cardBrand\":\"MASTERCARD\",\"supportedCurrencies\":[\"VND\"]},{\"cardBrand\":\"JCB\",\"supportedCurrencies\":[\"SGD\"]},{\"cardBrand\":\"VISA\",\"supportedCurrencies\":[\"SGD\"]}]},\"type\":\"card\"}",
"preferred": false,
"rank": 4800,
"supportedCurrencies": [
"SGD"
]
}
],
"result": {
"resultCode": "SUCCESS",
"resultMessage": "success.",
"resultStatus": "S"
}
}