Skip to content

Latest commit

 

History

History
75 lines (58 loc) · 2.27 KB

customer-payment-tokens.md

File metadata and controls

75 lines (58 loc) · 2.27 KB
group title redirect_from
graphql
customerPaymentTokens query
/guides/v2.3/graphql/reference/vault.html

When the vault feature is supported by a payment integration and enabled, customers have the option during checkout to save their credit card information. (Braintree supports the vault feature. Third-party payment integrations may support this feature as well.) During subsequent checkouts, the customer is presented with a list of saved payment options. If Instant Purchase is enabled, customers can even by-pass the two-step checkout process and place the order from the product page.

The customerPaymentTokens query returns an array of stored payment methods. Use the deletePaymentToken mutation to delete a payment token from the system.

{:.bs-callout-info} You must specify the customer's authorization token in the header of the call.

Syntax

{customerPaymentTokens{CustomerPaymentTokens}}

Example usage

The following example returns all the current customer's payment tokens. The public_hash output values will be unique to your application.

Request:

query {
  customerPaymentTokens {
    items {
      details
      public_hash
      payment_method_code
      type
    }
  }
}

Response:

{
  "data": {
    "customerPaymentTokens": {
      "items": [
        {
          "details": "{\"type\":\"VI\",\"maskedCC\":\"1111\",\"expirationDate\":\"09\\/2022\"}",
          "public_hash": "377c1514e0...",
          "payment_method_code": "braintree",
          "type": "card"
        },
        {
          "details": "{\"type\":\"DI\",\"maskedCC\":\"1117\",\"expirationDate\":\"11\\/2023\"}",
          "public_hash": "f5816fe2ab...",
          "payment_method_code": "braintree",
          "type": "card"
        }
      ]
    }
  }
}

Output attributes

{% include graphql/customer-payment-tokens.md %}

Errors

Error Description
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.

Related topics

deletePaymentToken mutation