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
mutation: {deletePaymentToken(public_hash) {DeletePaymentTokenOutput}}
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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mutation {
deletePaymentToken(
public_hash: "377c1514e0..."
) {
result
customerPaymentTokens {
items {
details
public_hash
payment_method_code
type
}
}
}
}
Response:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"data": {
"deletePaymentToken": {
"result": true,
"customerPaymentTokens": {
"items": [
{
"details": "{\"type\":\"VI\",\"maskedCC\":\"1111\",\"expirationDate\":\"09\\/2022\"}",
"public_hash": "f5816fe2ab...",
"payment_method_code": "braintree",
"type": "card"
}
]
}
}
}
}
Input attributes
The deletePaymentToken
object must contain the following attributes.
Attribute | Data Type | Description |
---|---|---|
public_hash |
String! |
The public hash of the token |
Output attributes
The top-level DeletePaymentTokenOutput
object is listed first. All child objects are listed in alphabetical order.
DeletePaymentTokenOutput attributes
The DeletePaymentTokenOutput
object returns the result of the operation and details about the remaining customer payment tokens.
Attribute | Data Type | Description |
---|---|---|
customerPaymentTokens |
CustomerPaymentTokens |
Contains an array of customer payment tokens |
result |
Boolean! | A value of true indicates the request was successful |
CustomerPaymentTokens attributes
The CustomerPaymentTokens
output object contains an array of items
.
Attribute | Data Type | Description |
---|---|---|
items |
[PaymentToken]! | Contains an array of customer payment tokens |
PaymentToken attributes
The PaymentToken
object defines characteristics of a token stored in the payment vault.
Attribute | Data Type | Description |
---|---|---|
details |
String | Stored account details |
payment_method_code |
String! | The payment method code associated with the token |
public_hash |
String! | The public hash of the token generated by the vault provider |
type |
PaymentTokenTypeEnum! |
card or account |
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. |