From a100f0c323f779f0a4e66c7d3fe48a73851955af Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Wed, 12 Jun 2019 15:52:46 -0500 Subject: [PATCH 1/3] checkpoint --- .../graphql/reference/vault-delete-token.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 guides/v2.3/graphql/reference/vault-delete-token.md diff --git a/guides/v2.3/graphql/reference/vault-delete-token.md b/guides/v2.3/graphql/reference/vault-delete-token.md new file mode 100644 index 00000000000..81ef05e9900 --- /dev/null +++ b/guides/v2.3/graphql/reference/vault-delete-token.md @@ -0,0 +1,58 @@ +--- +group: graphql +title: deletePaymentToken mutation +--- + +The `deletePaymentToken` mutation + +## Syntax + +`mutation: {deletePaymentToken(public_hash) {DeletePaymentTokenOutput}}` + +## Example usage + +The following example sets the shipping method to Best Way. + +**Request** + +``` text + +``` + +**Response** + +```json + +``` + +## Input attributes + +The top-level `setShippingMethodsOnCartInput` object is listed first. All child objects are listed in alphabetical order. + +### setShippingMethodsOnCartInput object {#setShippingMethodsOnCartInput} + +Attribute | Data Type | Description +--- | --- | --- +`cart_id` | String! | The unique ID that identifies the customer's cart +`shipping_methods` | [ShippingMethodInput!](#ShippingMethodInput) | The shipping address for a specific cart + +### ShippingMethodInput object {#ShippingMethodInput} + +Attribute | Data Type | Description +--- | --- | --- +`carrier_code` | String! | A string that identifies a commercial carrier or an offline shipping method +`method_code` | String! | A string that indicates which service a commercial carrier will use to ship items. For offline shipping methods, this value is similar to the label displayed on the checkout page + +## Output attributes + +The `ShippingMethodOutput` object contains the `Cart` object. + +Attribute | Data Type | Description +--- | --- | --- +`cart` |[ Cart!](#CartObject) | Describes the contents of the specified shopping cart + +### Cart object {#CartObject} + +{% include graphql/cart-object.md %} + +[Cart query output]({{page.baseurl}}/graphql/reference/quote.html#cart-output) provides more information about the `Cart` object. From ef968cd89dd1c0d31ad390e2cf05ad7f9bef71bb Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Fri, 14 Jun 2019 15:28:10 -0500 Subject: [PATCH 2/3] review draft --- _data/toc/graphql.yml | 3 + _includes/graphql/customer-payment-tokens.md | 16 +++ .../graphql/reference/vault-delete-token.md | 58 -------- guides/v2.3/graphql/reference/vault.md | 136 ++++++++++++++++++ 4 files changed, 155 insertions(+), 58 deletions(-) create mode 100644 _includes/graphql/customer-payment-tokens.md delete mode 100644 guides/v2.3/graphql/reference/vault-delete-token.md create mode 100644 guides/v2.3/graphql/reference/vault.md diff --git a/_data/toc/graphql.yml b/_data/toc/graphql.yml index 55a5f970293..b7d72938b43 100644 --- a/_data/toc/graphql.yml +++ b/_data/toc/graphql.yml @@ -138,6 +138,9 @@ pages: - label: UrlRewrite endpoint url: /graphql/reference/url-resolver.html + - label: Vault endpoint + url: /graphql/reference/vault.html + - label: Wishlist endpoint url: /graphql/reference/wishlist.html diff --git a/_includes/graphql/customer-payment-tokens.md b/_includes/graphql/customer-payment-tokens.md new file mode 100644 index 00000000000..22f15fd70f5 --- /dev/null +++ b/_includes/graphql/customer-payment-tokens.md @@ -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 +`type` | `PaymentTokenTypeEnum` | `card` or `account` \ No newline at end of file diff --git a/guides/v2.3/graphql/reference/vault-delete-token.md b/guides/v2.3/graphql/reference/vault-delete-token.md deleted file mode 100644 index 81ef05e9900..00000000000 --- a/guides/v2.3/graphql/reference/vault-delete-token.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -group: graphql -title: deletePaymentToken mutation ---- - -The `deletePaymentToken` mutation - -## Syntax - -`mutation: {deletePaymentToken(public_hash) {DeletePaymentTokenOutput}}` - -## Example usage - -The following example sets the shipping method to Best Way. - -**Request** - -``` text - -``` - -**Response** - -```json - -``` - -## Input attributes - -The top-level `setShippingMethodsOnCartInput` object is listed first. All child objects are listed in alphabetical order. - -### setShippingMethodsOnCartInput object {#setShippingMethodsOnCartInput} - -Attribute | Data Type | Description ---- | --- | --- -`cart_id` | String! | The unique ID that identifies the customer's cart -`shipping_methods` | [ShippingMethodInput!](#ShippingMethodInput) | The shipping address for a specific cart - -### ShippingMethodInput object {#ShippingMethodInput} - -Attribute | Data Type | Description ---- | --- | --- -`carrier_code` | String! | A string that identifies a commercial carrier or an offline shipping method -`method_code` | String! | A string that indicates which service a commercial carrier will use to ship items. For offline shipping methods, this value is similar to the label displayed on the checkout page - -## Output attributes - -The `ShippingMethodOutput` object contains the `Cart` object. - -Attribute | Data Type | Description ---- | --- | --- -`cart` |[ Cart!](#CartObject) | Describes the contents of the specified shopping cart - -### Cart object {#CartObject} - -{% include graphql/cart-object.md %} - -[Cart query output]({{page.baseurl}}/graphql/reference/quote.html#cart-output) provides more information about the `Cart` object. diff --git a/guides/v2.3/graphql/reference/vault.md b/guides/v2.3/graphql/reference/vault.md new file mode 100644 index 00000000000..a7a868e8ab5 --- /dev/null +++ b/guides/v2.3/graphql/reference/vault.md @@ -0,0 +1,136 @@ +--- +group: graphql +title: Vault endpoint +--- + +When the vault feature is enabled in the payment method configuration for Braintree, customers have the option during checkout to save their credit card information. 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. + +{:.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. + +{:.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" + } + ] + } + } + } +} +``` From 895e998d56861f440e27e4d72ad1623a91f0bed2 Mon Sep 17 00:00:00 2001 From: Kevin Harper Date: Mon, 17 Jun 2019 11:09:06 -0500 Subject: [PATCH 3/3] developer comments --- _includes/graphql/customer-payment-tokens.md | 4 ++-- guides/v2.3/graphql/reference/vault.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_includes/graphql/customer-payment-tokens.md b/_includes/graphql/customer-payment-tokens.md index 22f15fd70f5..281ced0f6a2 100644 --- a/_includes/graphql/customer-payment-tokens.md +++ b/_includes/graphql/customer-payment-tokens.md @@ -12,5 +12,5 @@ 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 -`type` | `PaymentTokenTypeEnum` | `card` or `account` \ No newline at end of file +`public_hash` | String | The public hash of the token generated by the vault provider +`type` | `PaymentTokenTypeEnum` | `card` or `account` diff --git a/guides/v2.3/graphql/reference/vault.md b/guides/v2.3/graphql/reference/vault.md index a7a868e8ab5..42dcdf6d7a1 100644 --- a/guides/v2.3/graphql/reference/vault.md +++ b/guides/v2.3/graphql/reference/vault.md @@ -3,7 +3,7 @@ group: graphql title: Vault endpoint --- -When the vault feature is enabled in the payment method configuration for Braintree, customers have the option during checkout to save their credit card information. 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. +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