Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAY-5702: Adds docs for the updated vault feature in Payment Services #386

Merged
merged 48 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
92c435d
Adds folder for vault and its queries and mutations
danidelcar Dec 13, 2024
281bf39
reviewed attributes for vaultconfig
danidelcar Dec 16, 2024
c24ddf4
reviewed input and output attributes of the endpoints
danidelcar Dec 16, 2024
e130fa8
Merge branch 'main' into del-PAY-5702-vault
danidelcar Dec 16, 2024
bf1fd65
Update getVaultConfig.md
danidelcar Dec 16, 2024
0fce780
Update src/pages/graphql/schema/vault/index.md
danidelcar Dec 16, 2024
f8e446c
Update src/pages/graphql/schema/vault/index.md
danidelcar Dec 16, 2024
ea231b5
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 16, 2024
6b6c195
Update src/pages/graphql/schema/checkout/mutations/create-payment-ord…
danidelcar Dec 17, 2024
62a81fb
Update src/pages/graphql/schema/vault/index.md
danidelcar Dec 17, 2024
cb99d24
Update src/pages/graphql/schema/vault/index.md
danidelcar Dec 17, 2024
24863f4
Update src/pages/graphql/schema/vault/index.md
danidelcar Dec 17, 2024
7aa556d
Update src/pages/graphql/schema/vault/queries/getVaultConfig.md
danidelcar Dec 17, 2024
dd4fc3c
Update src/pages/graphql/schema/vault/queries/getVaultConfig.md
danidelcar Dec 17, 2024
5dbb9f8
Update src/pages/graphql/schema/vault/queries/getVaultConfig.md
danidelcar Dec 17, 2024
2d84735
Update src/pages/graphql/schema/vault/queries/getVaultConfig.md
danidelcar Dec 17, 2024
36e1f1e
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
ca4f939
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
b85d496
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
d904c15
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
00fd449
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
f0e3dcd
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
300b482
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
1f9ba6c
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
8f82da4
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
b5b0ca0
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
5a7844f
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
e0a625b
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
3ebb959
Update src/pages/graphql/schema/vault/mutations/createVaultCardPaymen…
danidelcar Dec 17, 2024
ea7d378
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
f359c7d
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
67d8a92
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
7f34a29
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
7878bab
Update src/pages/graphql/schema/vault/mutations/createVaultCardSetupT…
danidelcar Dec 17, 2024
87b0b19
Reviewed changes after peer review
danidelcar Dec 17, 2024
6417439
fixed link
danidelcar Dec 17, 2024
c65d459
updated workflow tutorial with latest vault updates
danidelcar Dec 17, 2024
aac77e2
new folder for payment services extension, reestructure all graphQL
danidelcar Dec 18, 2024
ba65c70
fix links
danidelcar Dec 18, 2024
b696a1f
fix links in workflows
danidelcar Dec 18, 2024
03a3b7a
adds description metadata to files
danidelcar Dec 18, 2024
c9566bf
fix issue
danidelcar Dec 18, 2024
7a44758
Update src/pages/graphql/payment-services-extension/index.md
danidelcar Dec 18, 2024
cb24ebe
Update src/pages/graphql/payment-services-extension/index.md
danidelcar Dec 18, 2024
c57b7f4
Update src/pages/graphql/payment-services-extension/mutations/create-…
danidelcar Dec 19, 2024
26f8e2f
Update src/pages/graphql/payment-services-extension/mutations/create-…
danidelcar Dec 19, 2024
a18ab2f
moved workflows menu
danidelcar Dec 19, 2024
05ead8f
removed all trailing periods
danidelcar Dec 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/graphql/schema/checkout/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: Checkout

The checkout schema helps complete the customer checkout process by managing and retrieving payment tokens and checkout agreements.

The checkout workflow differs for each online payment time. See the following topics for more information.
The checkout workflow differs for each online payment type. See the following topics for more information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

* [Braintree](../../payment-methods/braintree.md)
* [Braintree vault](../../payment-methods/braintree-vault.md)
Expand Down
20 changes: 10 additions & 10 deletions src/pages/graphql/schema/checkout/mutations/create-payment-order.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ The `CreatePaymentOrderinput` object contains the following input attributes:

Attribute | Data Type | Description
--- | --- | ---
`cartId` | String! | The unique ID of the cart
`cartId` | String! | The unique ID of the cart.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
`location` | PaymentLocation! | The origin location for that payment request. The possible values are
PRODUCT_DETAIL, MINICART, CART, CHECKOUT, ADMIN
`methodCode` | String! | The code for the selected payment method
`paymentSource` | String! | The payment source for the payment method. The possible values are credit card (`cc`), PayPal (`paypal`), and Apple Pay (`applepay`)
`vaultIntent` | Boolean | Indicates whether the payment information should be vaulted. This attribute is only applicable to the `hosted_fields` payment method. The default value is `false`
`PRODUCT_DETAIL`, `MINICART`, `CART`, `CHECKOUT`, `ADMIN`.
`methodCode` | String! | The code for the selected payment method.
`paymentSource` | String! | The payment source for the payment method. The possible values are credit card (`cc`), PayPal (`paypal`), and Apple Pay (`applepay`).
`vaultIntent` | Boolean | Indicates whether the payment information should be vaulted. This attribute is only applicable to the `hosted_fields` payment method. The default value is `false`.

## Output attributes

The `CreatePaymentOrderOutput` object contains the payment order details that are needed to fulfill a payment.

Attribute | Data Type | Description
--- | --- | ---
`id` | String | The unique order ID generated by PayPal
`mp_order_id` | String | The unique order ID generated in Commerce if Payment Services is enabled after PayPal returns the `id`
`status` | String | The status of the payment order. See [order status](https://experienceleague.adobe.com/docs/commerce-admin/stores-sales/order-management/orders/order-status.html) for more information
`amount` | Float | The amount of the payment order
`currency_code` | String | The currency code of the payment order
`id` | String | The unique order ID generated by PayPal.
`mp_order_id` | String | The unique order ID generated in Commerce if Payment Services is enabled after PayPal returns the `id`.
`status` | String | The status of the payment order. See [order status](https://experienceleague.adobe.com/docs/commerce-admin/stores-sales/order-management/orders/order-status.html) for more information.
`amount` | Float | The amount of the payment order.
`currency_code` | String | The currency code of the payment order.

See [PayPal currency codes](https://developer.paypal.com/reference/currency-codes/) documentation for more information.
40 changes: 20 additions & 20 deletions src/pages/graphql/schema/checkout/queries/get-payment-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This query is available only if you have installed [Payment Services for Adobe C

The `getPaymentConfig` query returns the payment configuration details from locations in the storefront and Admin where the payment method can be set.

The query can return details about the following supported payment methods in [Payment Services](https://experienceleague.adobe.com/docs/commerce-merchant-services/payment-services/payments-checkout/payments-options.html): :
The query can return details about the following supported payment methods in [Payment Services](https://experienceleague.adobe.com/docs/commerce-merchant-services/payment-services/payments-checkout/payments-options.html):

* Apple Pay
* Google Pay
Expand Down Expand Up @@ -262,10 +262,10 @@ The `PaymentConfigOutput` contains details about each configured payment method:

Attribute | Data Type | Description
--- | --- | ---
`ApplePayConfig` | String! | Apple Pay payment method configuration
`GooglePayConfig` | String! | Google Pay payment method configuration
`HostedFieldsConfig` | String! | PayPal Hosted fields payment method configuration
`SmartButtonsConfig` | String! | PayPal Smart Buttons payment method configuration
`ApplePayConfig` | String! | Apple Pay payment method configuration.
`GooglePayConfig` | String! | Google Pay payment method configuration.
`HostedFieldsConfig` | String! | PayPal Hosted fields payment method configuration.
`SmartButtonsConfig` | String! | PayPal Smart Buttons payment method configuration.

Each of these output attributes implements the `PaymentConfigItem` interface.

Expand All @@ -275,7 +275,7 @@ The `PaymentConfigItem` interface contains the fields that are common to all the

Attribute | Data Type | Description
--- | --- | ---
`code` | String | The payment method code as defined in the payment gateway
`code` | String | The payment method code as defined in the payment gateway.
`is_visible` | Boolean | Indicates whether the payment method is shown.
`payment_intent` | String | Defines the payment intent. The possible values are `Authorize` or `Capture`.
`sdk_params` | SDKParams | PayPal parameters required to load the PayPal JavaScript SDK.
Expand All @@ -297,11 +297,11 @@ The `ApplePayConfig` payment method configuration has a `button_styles` object c

Attribute | Data Type | Description
--- | --- | ---
`color` | String | The button color
`height` | Int | The button height in pixels
`label` | String | The button label
`layout` | String | The button layout
`shape` | String | The button shape
`color` | String | The button color.
`height` | Int | The button height in pixels.
`label` | String | The button label.
`layout` | String | The button layout.
`shape` | String | The button shape.
`tagline` | Boolean | Indicates whether the tagline is displayed.
`use_default_height` | Boolean | Defines if button uses default height. If the value is `False`, the value of `height` is used.

Expand Down Expand Up @@ -364,11 +364,11 @@ The `SmartButtonsConfig` payment method configuration has a `ButtonStyles` objec

Attribute | Data Type | Description
--- | --- | ---
`color` | String | The button color
`height` | Int | The button height in pixels
`label` | String | The button label
`layout` | String | The button layout
`shape` | String | The button shape
`color` | String | The button color.
`height` | Int | The button height in pixels.
`label` | String | The button label.
`layout` | String | The button layout.
`shape` | String | The button shape.
`tagline` | Boolean | Indicates whether to display the PayPal tagline.
`use_default_height` | Boolean | Defines if button uses default height. If the value is `False`, the value of `height` is used.

Expand All @@ -378,16 +378,16 @@ The `SmartButtonsConfig` payment method configuration has a `MessageStyles` obje

Attribute | Data Type | Description
--- | --- | ---
`layout` | String | The message layout
`logo` | String | The message logo
`layout` | String | The message layout.
`logo` | String | The message logo.

#### `SDKParams` attributes

The `SDKParams` object provides details about the SDK parameters:

Attribute | Data Type | Description
--- | --- | ---
`name` | String | The name of the SDK parameter
`value` | String | The value of the SDK parameter
`name` | String | The name of the SDK parameter.
`value` | String | The value of the SDK parameter.

These values come from [PayPal JavaScript SDK](https://developer.paypal.com/sdk/js/reference/).
15 changes: 15 additions & 0 deletions src/pages/graphql/schema/vault/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Rename the directory to payment-services.
  2. Move the existing Payment Services queries and mutations to this new directory.
  3. Update the TOC file to include these new queries/mutations and the files you moved.
  4. Also update the index files under the checkout directory to point to this new index file.
  5. Create a DEVSITE Jira ticket to enable redirection. You can use DEVSITE-956 as template.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we would move mutations and queries related to the checkout process to this folder. Vault existed before, now simply it has more features, thus new query and mutations, that are related to vaulting without a purchase, that is, outside of a checkout process, see credit card vaulting in PS

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied a huge restructure for the payment services extension, might be the only thing needed is redirects

title: Vault
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
---

# Vault
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

<InlineAlert variant="info" slots="text" />

danidelcar marked this conversation as resolved.
Show resolved Hide resolved
This query is available only if you have installed [Payment Services for Adobe Commerce](https://commercemarketplace.adobe.com/magento-payment-services.html) 2.10.0 or higher.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

The vault schema provides GraphQL information to generate **vault** (stored payment details) information endpoints. This schema also provides mutations for modifying a payment token.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Once vaulted, a payment method can be reused as many times as possible without your customer needing to re-enter or authenticate their payment information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

These endpoints can be used to vault stored payment details without a purchase, but tt is possible to [vault a payment method during checkout](https://developer.adobe.com/commerce/webapi/graphql/payment-services/vault/), see the [`customer-payment-tokens`](https://developer.adobe.com/commerce/webapi/graphql/schema/checkout/queries/customer-payment-tokens/) query for more information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
title: createVaultCardPaymentToken mutation
---

# createVaultCardPaymentToken mutation

<InlineAlert variant="info" slots="text" />

This mutation is available only if you have installed [Payment Services for Adobe Commerce](https://commercemarketplace.adobe.com/magento-payment-services.html) 2.10.0 or higher.

The `createVaultCardPaymentToken` mutation creates a permanent `vault_token_id` and associates an optional card description, visible in the storefront.

To run the `createVaultCardPaymentToken` mutation, you need the `setup_token` generated with the `createVaultCardSetupToken` mutation.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

## Syntax

```graphql
mutation {
createVaultCardPaymentToken(
input: CreateVaultCardPaymentTokenInput!
) CreateVaultCardPaymentTokenOutput
}
```

## Example usage

The following example runs the `createVaultCardPaymentToken` mutation to create a permanent `vault_token_id` for the given payment method.

## Request

```graphql
mutation {
createVaultCardPaymentToken(
input: {
setup_token_id: "23N11484TX9371211"
card_description: "My New Card"
}
) {
vault_token_id
payment_source {
card {
brand
last_digits
expiry
}
}
}
}
```

## Response

```json
{
"data": {
"createVaultCardPaymentToken": {
"vault_token_id": "745bf41a-4196-41a6-a17a-0234f89118fc",
"payment_source": {
"card": {
"brand": "VISA",
"last_digits": "0004",
"expiry": "2027-02"
}
}
}
}
}
```

## Input attributes

The `createVaultCardPaymentToken` object contains the following input attributes:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`setup_token_id` | String! | The `setup_token` obtained with the `createVaultCardSetupToken` endpoint.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
`card_description` | Boolean | The description of the vaulted card.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

## Output attributes

The `createVaultCardSetupToken` object contains the following attributes:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`vault_token_id` | String! | The vault payment token information.
`payment_source` | [PaymentSourceOutput]! | The payment source information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

### `PaymentSourceOutput` attributes

The `PaymentSourceOutput` object describes the payment source information. Requires the following attribute:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`card` | [CardPaymentSourceOutput]! | The card payment source information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

### `CardPaymentSourceOutput` object

The `CardPaymentSourceOutput` object describes the card payment source information. Requires the following attributes:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`brand` | String | The brand of the card.
`last_digits` | String | Last digits of the card.
`expiry` | String | The expiry date of the card.
127 changes: 127 additions & 0 deletions src/pages/graphql/schema/vault/mutations/createVaultCardSetupToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
---
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
title: createVaultCardSetupToken mutation
---

# createVaultCardSetupToken mutation

<InlineAlert variant="info" slots="text" />

This mutation is available only if you have installed [Payment Services for Adobe Commerce](https://commercemarketplace.adobe.com/magento-payment-services.html) 2.10.0 or higher.

The `createVaultCardSetupToken` mutation creates a temporary `setup_token` associated to the given payment source.

Use this token to create a permanent token with the `createVaultCardPaymentToken` mutation. The permanent token represents a payment method that is saved to the customer's vault.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

This setup token is generated with an empty card number in the `payment_source` object purposefully. In combination of PayPal SDK, hosted fields or credit cards fields components use this token to securely update the setup token with payment details.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

See [Paypal SDK developer documentation](https://developer.paypal.com/docs/multiparty/checkout/save-payment-methods/purchase-later/js-sdk/cards/) for more information.

## Syntax

```graphql
mutation {
createVaultCardSetupToken(
input: CreateVaultCardSetupTokenInput!
) CreateVaultCardSetupTokenOutput
}
```

## Example usage

The following example runs the `createVaultCardSetupToken` mutation to create a setup token for the given payment details.

**Request:**

```graphql
mutation {
createVaultCardSetupToken(
input: {
setup_token: {
payment_source: {
card: {
name: "John Doe",
billing_address: {
address_line_1: "123 Main Street",
address_line_2: "Apt 4B",
region: "California",
city: "San Jose",
postal_code: "90001",
country_code: "US"
}
}
}
},
three_ds_mode: "SCA_ALWAYS"
}
) {
setup_token
}
}
```

**Response:**

```json
{
"data": {
"createVaultCardSetupToken": {
"setup_token": "11M29729J2618171X"
}
}
}
```

## Input attributes

The `createVaultCardSetupToken` mutation must contain the following input attributes:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`setup_token` | [VaultSetupTokenInput]! | The setup token information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
`three_ds_mode` | Boolean | Indicates which 3D Secure authentication mode is in use. The possible values are `OFF`, `SCA_WHEN_REQUIRED`, `SCA_ALWAYS`.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

### `VaultSetupTokenInput` attribute

The `VaultSetupTokenInput` object describes the variables needed to create a vault card setup token. Requires the following attribute:

Attribute | Data Type | Description
--- | --- | ---
`payment_source` | [PaymentSourceInput]! | The payment source of the payment method.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

### `PaymentSourceInput` attribute

The `PaymentSourceInput` object describes the payment source information of the payment method.

Attribute | Data Type | Description
--- | --- | ---
`card` | [CardPaymentSourceInput]! | The card payment source information.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

### `CardPaymentSourceInput` object

The `CardPaymentSourceInput` object describes the card payment source information.

Attribute | Data Type | Description
--- | --- | ---
`billing_address` | [BillingAddressPaymentSourceInput]! | The billing address of the card.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
`name` | String! | The cardholder's name.

### `BillingAddressPaymentSourceInput` object

The `BillingAddressPaymentSourceInput` object includes the billing address information. Requires the following attributes:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`address_line_1` | String | The first line of the address.
`address_line_2` | String | The second line of the address.
`region` | String | The region of the address.
`city` | String | The city of the address.
`postal_code` | String | The postal code of the address.
`country_code` | String! | The country code of the address.

## Output attributes

The `createVaultCardSetupTokenOutput` object must contain the following attributes:
danidelcar marked this conversation as resolved.
Show resolved Hide resolved

Attribute | Data Type | Description
--- | --- | ---
`setup_token` | String! | The setup token id.
danidelcar marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading