deletePaymentToken mutation
The deletePaymentToken
mutation deletes a payment token from the system. Use the customerPaymentTokens query to retrieve all stored payment methods associated with a particular customer.
You must specify the customer's authorization token in the header of the call.
Syntax
Copied to your clipboardmutation {deletePaymentToken(public_hash: String!) {DeletePaymentTokenOutput}}
Reference
The deletePaymentToken
reference provides detailed information about the types and fields defined in this mutation.
Example usage
The following example deletes the Discover Card listed in the results of the customerPaymentTokens
query. The public_hash
you specify will be unique to your application.
Request:
Copied to your clipboardmutation {deletePaymentToken(public_hash: "377c1514e0...") {resultcustomerPaymentTokens {items {detailspublic_hashpayment_method_codetype}}}}
Response:
Copied to your clipboard{"data": {"deletePaymentToken": {"result": true,"customerPaymentTokens": {"items": [{"details": "{\"type\":\"VI\",\"maskedCC\":\"1111\",\"expirationDate\":\"09\\/2022\"}","public_hash": "f5816fe2ab...","payment_method_code": "braintree","type": "card"}]}}}}
Errors
Error | Description |
---|---|
Could not find a token using public hash: xxxxxxxx | The customer token specified in the public_hash argument does not exist in the vault_payment_token table. |
The current customer isn't authorized. | The current customer is not currently logged in, or the customer's token does not exist in the oauth_token table. |