This repository was archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add GraphQL vault documentation #4760
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
--- | ||
group: graphql | ||
title: Vault endpoint | ||
--- | ||
|
||
When the [vault]({{page.baseurl}}/payments-integrations/vault/vault-intro.html) 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. | ||
|
||
## Query | ||
|
||
The `customerPaymentTokens` query returns an array of stored payment methods. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "payment token" is not equal to "payment method" |
||
|
||
{:.bs-callout .bs-callout-info} | ||
You must specify the customer's authorization token in the header of the call. | ||
|
||
### Syntax | ||
|
||
`{customerPaymentTokens{CustomerPaymentTokens}}` | ||
|
||
#### CustomerPaymentTokens attributes | ||
|
||
{% include graphql/customer-payment-tokens.md %} | ||
|
||
### Example usage | ||
|
||
The following example returns all the current customer's payment tokens. | ||
|
||
**Request** | ||
|
||
```text | ||
query { | ||
customerPaymentTokens { | ||
items { | ||
details | ||
public_hash | ||
payment_method_code | ||
type | ||
} | ||
} | ||
} | ||
``` | ||
|
||
**Response** | ||
|
||
```json | ||
{ | ||
"data": { | ||
"customerPaymentTokens": { | ||
"items": [ | ||
{ | ||
"details": "{\"type\":\"VI\",\"maskedCC\":\"1111\",\"expirationDate\":\"09\\/2022\"}", | ||
"public_hash": "f5816fe2ab7d200c3ff84d42804b65144f9cb0a2401ce1dad1b52d3b3115fd1a", | ||
"payment_method_code": "braintree", | ||
"type": "card" | ||
}, | ||
{ | ||
"details": "{\"type\":\"DI\",\"maskedCC\":\"1117\",\"expirationDate\":\"11\\/2023\"}", | ||
"public_hash": "377c1514e0bce7107a9348ddf38bc059b2f1b9e0a8bedf168a98b04807e17ff5", | ||
"payment_method_code": "braintree", | ||
"type": "card" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Mutation | ||
|
||
The `deletePaymentToken` mutation deletes a payment token from the system. | ||
keharper marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
{:.bs-callout .bs-callout-info} | ||
You must specify the customer's authorization token in the header of the call. | ||
|
||
### Syntax | ||
|
||
`mutation: {deletePaymentToken(public_hash) {DeletePaymentTokenOutput}}` | ||
|
||
#### DeletePaymentTokenOutput attributes | ||
|
||
The `DeletePaymentTokenOutput` object contains 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 | ||
|
||
{% include graphql/customer-payment-tokens.md %} | ||
|
||
### Example usage | ||
|
||
The following example deletes the Discover Card listed in the results of the `customerPaymentTokens` query. | ||
|
||
**Request** | ||
|
||
``` text | ||
mutation { | ||
deletePaymentToken( | ||
public_hash: "377c1514e0bce7107a9348ddf38bc059b2f1b9e0a8bedf168a98b04807e17ff5" | ||
) { | ||
result | ||
customerPaymentTokens { | ||
items { | ||
details | ||
public_hash | ||
payment_method_code | ||
type | ||
} | ||
} | ||
} | ||
} | ||
|
||
``` | ||
|
||
**Response** | ||
|
||
```json | ||
{ | ||
"data": { | ||
"deletePaymentToken": { | ||
"result": true, | ||
"customerPaymentTokens": { | ||
"items": [ | ||
{ | ||
"details": "{\"type\":\"VI\",\"maskedCC\":\"1111\",\"expirationDate\":\"09\\/2022\"}", | ||
"public_hash": "f5816fe2ab7d200c3ff84d42804b65144f9cb0a2401ce1dad1b52d3b3115fd1a", | ||
"payment_method_code": "braintree", | ||
"type": "card" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between a "customer payment token" and "customer payment method"? Payment method makes more sense to me. Can we use that throughout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't change the terminology. Tokens are managed here, not payment methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erikmarr , payment token and method are different. The payment token - tokenized on Payment Gateway credit card, payment method - an integration to provide a possibility to make a payment transaction, there are no terms like "customer payment method" because the payment method doesn't belong to any customer.