removePaymentMethod
POST /ams/api/v1/paymentMethods/removePaymentMethod
Use this API to remove a selected payment method from the user's wallet. The user selects a payment method to remove, and a one-to-one correspondence between the payment method and its card token exists.
Note:
- Before calling this API to remove a payment method, the merchant needs to call the queryPaymentMethod API to get the respective card token that will be used to remove this 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 |
requestId | String | Yes | The unique ID that is assigned by a merchant to identify a payment method remove request. DWS uses this field for idempotence control. More information about this field:
Note: This field is an API idempotency field and will be used only when polling. | "faf2a3b3-166b-4c99-a965-5fba9d7249ac" |
customerId | String | No | 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" |
referenceCustomerId | String | No | Customer ID in the merchant system. More information about this field:
| "1572536263" |
paymentMethodDetail | Yes | The details of this payment method. See PaymentMethodDetail for details. | "card":{ "cardToken":"ALIPAYcdvytJ//3s7FA5Nvg+Eqyfe0BClaM4IWFFH9XDVpYLx3s1IKn/9YAfRnRQEyK8chyWCloE4MwfmN48sP1+rSPQ==" }, "paymentMethodDetailType":"card" } | |
env | No | The order environment, such as device information. Note: terminalType must be specified. And when terminalType is specified as APP/WEP, osType must be specified. | / |
Response parameters
Field | Data type | Required | Description | Examples |
result | Yes | The unique ID that is assigned by a merchant to identify a payment method remove request. More information about this field:
| / | |
requestId | String | Yes | This field is used for idempotence control. | "faf2a3b3-166b-4c99-a965-5fba9d7249ac" |
Result processing logic
In the response, the result.resultStatus field indicates the result of the removePaymentMethod request. The following table describes each result status:
Result status | Description |
S | The removePaymentMethod request is accepted successfully. The corresponding result.resultCode is The merchant needs to obtain the real unbinding result through the iPayNotifyRemoveCardResult interface |
U | The status of the removePaymentMethod request is unknown. The corresponding result.resultCode is |
F | The removePaymentMethod 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, 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. |
REPEAT_REQ_INCONSISTENT | F | Repeat request inconsistent. | Ensure the fields in the requests are the same. |
USER_NOT_EXIST | F | The user does not exist. | Contact Alipay Technical Support for detailed reasons. |
USER_STATUS_ABNORMAL | F | The user status is abnormal. | Contact the digital wallet to check the user status. |
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. |
METHOD_NOT_SUPPORTED | F | The server does not implement the requested HTTP method. | Ensure the HTTP method is POST. |
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. |
ACCESS_DENIED | F | Access denied. | Contact Alipay Technical Support for detailed reasons. |
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. |
Samples
Request:
The merchant sends a request to DWS.
{
"customerId":"21661000000635",
"env":{
"clientIp":"200.**.***.**",
"deviceTokenId":"t/dugoanTC9G5ZugwCYfGKu9j9/4meS0UQ8TAFuBoOnZrI/EfwEAAA==",
"language":"es_US",
"sessionId":"***********************************************_al_b_I",
"terminalType":"APP",
"umidTokenId":"YgSi0EEtk2MDAMACYWWfYRFN"
},
"paymentMethodDetail":{
"card":{
"cardToken":"ALIPAYcdvytJ//3s7FA5Nvg+Eqyfe0BClaM4IWFFH9XDVpYLx3s1IKn/9YAfRnRQEyK8chyWCloE4MwfmN48sP1+rSPQ=="
},
"paymentMethodDetailType":"card"
},
"requestId":"faf2a3b3-166b-4c99-a965-5fba9d7249ac"
}
Response:
DWS returns the request result.
{
"requestId": "d5fc622c-d4f2-4499-ba17-22d0424474dc",
"result": {
"resultCode":"SUCCESS",
"resultStatus":"S",
"resultMessage":"success"
}
}