Skip to content

Commit 089bdaa

Browse files
authored
Merge pull request AdobeDocs#400 from AdobeDocs/PAY-5913
PAY-5913: Updates the PS folder with updated workflows for the vaulted card with/without purchase feature
2 parents b7da3e5 + 8cdd11f commit 089bdaa

File tree

7 files changed

+173
-4
lines changed

7 files changed

+173
-4
lines changed

src/data/navigation/sections/graphql.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,6 +1249,14 @@ module.exports = [
12491249
title: "Minicart",
12501250
path: "/graphql/payment-services-extension/workflows/minicart.md",
12511251
},
1252+
{
1253+
title: "Vault a card during a checkout authorization",
1254+
path: "/graphql/payment-services-extension/workflows/vault-with-purchase.md",
1255+
},
1256+
{
1257+
title: "Vault a credit card without a purchase",
1258+
path: "/graphql/payment-services-extension/workflows/vault-without-purchase.md",
1259+
},
12521260
{
12531261
title: "Vaulted card",
12541262
path: "/graphql/payment-services-extension/workflows/vaulted-card.md",

src/pages/_images/graphql/payment-services-vault-with-purchase.svg

Lines changed: 4 additions & 0 deletions
Loading

src/pages/_images/graphql/payment-services-vault-without-purchase.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: Vault a card during a checkout authorization
3+
description: Learn how to vault a credit card during a typical checkout authorization.
4+
keywords:
5+
- GraphQL
6+
- Payments
7+
---
8+
9+
# Vault a card during a checkout authorization
10+
11+
These steps describe the flow of requests and responses required to [vault a credit card](https://experienceleague.adobe.com/en/docs/commerce-merchant-services/payment-services/payments-checkout/vaulting#vaulting-a-payment-method-during-checkout) during a typical checkout authorization with Payment Services enabled.
12+
13+
The following conditions must be true to vault a card during checkout:
14+
15+
* You must have installed [Payment Services for Adobe Commerce](https://commercemarketplace.adobe.com/magento-payment-services.html) 2.10.0 or higher.
16+
* The customer must be logged in.
17+
18+
## Workflow
19+
20+
![Payment Services sequence diagram](../../../_images/graphql/payment-services-vault-with-purchase.svg)
21+
22+
1. Run the [`getPaymentConfig`](../../payment-services-extension/queries/get-payment-config.md) query to fetch the payment configuration needed to render details of hosted fields.
23+
24+
1. Commerce returns the payment configuration information.
25+
26+
1. Run the [`setPaymentMethodOnCart`](../../schema/cart/mutations/set-payment-method.md) mutation to [set the payment method](../../tutorials/checkout/set-payment-method.md).
27+
28+
1. Adobe Commerce returns a `Cart` object.
29+
30+
1. Run the [`createPaymentOrder`](../../payment-services-extension/mutations/create-payment-order.md) mutation with `vaultIntent` set to `true` to begin the authorization process.
31+
32+
1. Commerce forwards the request to PayPal.
33+
34+
1. PayPal returns an `id` value.
35+
36+
1. Adobe Commerce generates a `order_id` and forwards the value in the `mp_order_id` field and the PayPal response in the `id` field.
37+
38+
1. Run [`setPaymentMethodOnCart`](../../schema/cart/mutations/set-payment-method.md) again with [`is_active_payment_token_enabler`](https://developer.adobe.com/commerce/webapi/graphql/payment-services-extension/workflows/checkout/#setpaymentmethodoncartinput-object) set to `true`. This indicates whether a customer-entered credit/debit card should be tokenized for later usage.
39+
40+
1. Adobe Commerce returns a token.
41+
42+
1. (Optional) If hosted fields and the Signifyd integration are enabled, run the [`getPaymentOrder`](../../payment-services-extension/queries/get-payment-order.md) query.
43+
44+
1. (Optional) Adobe Commerce returns details about the payment order.
45+
46+
1. Run the [`placeOrder`](../../schema/cart/mutations/place-order.md) mutation.
47+
48+
1. Commerce sends an authorization request to PayPal.
49+
50+
1. PayPal returns the result to Commerce.
51+
52+
1. Commerce creates an order.
53+
54+
1. Paypal returns a vault token.
55+
56+
1. Commerce stores the vault token for the vaulted card.
57+
58+
## Additional information
59+
60+
It is only possible to vault configuration details for hosted fields. See [`getPaymentConfig`](../../payment-services-extension/queries/get-payment-config.md) query for more information.
61+
62+
### `setPaymentMethodOnCart` mutation example
63+
64+
The following example shows the `setPaymentMethodOnCart` mutation with the attribute `is_active_payment_token_enabler` set to `true`.
65+
66+
**Request:**
67+
68+
```graphql
69+
mutation {
70+
setPaymentMethodOnCart ( input: {
71+
cart_id: "uocGxUi5H97XFAMhY3s66q4aFYG3Bmdr",
72+
payment_method: {
73+
code: "payment_services_paypal_hosted_fields",
74+
payment_services_paypal_hosted_fields: {
75+
payment_source: "cc",
76+
payments_order_id: "mp-order-a4babd34-13d3-4ac0-b1b0-109bb7be1574",
77+
paypal_order_id: "9R90936863877801D",
78+
is_active_payment_token_enabler: true
79+
}
80+
}
81+
}
82+
) {
83+
cart {
84+
id
85+
selected_payment_method {
86+
code
87+
}
88+
}
89+
}
90+
}
91+
```
92+
93+
**Response:**
94+
95+
```json
96+
{
97+
"data": {
98+
"setPaymentMethodOnCart": {
99+
"cart": {
100+
"id": "uocGxUi5H97XFAMhY3s66q4aFYG3Bmdr",
101+
"selected_payment_method": {
102+
"code": "payment_services_paypal_hosted_fields"
103+
}
104+
}
105+
}
106+
}
107+
}
108+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Vaulting a credit card without a purchase
3+
description: Learn how to vault a payment method without a typical checkout authorization.
4+
keywords:
5+
- GraphQL
6+
- Payments
7+
---
8+
9+
# Vaulting a credit card without a checkout authorization
10+
11+
These steps describe the flow of requests and responses required to [vault a payment method](https://experienceleague.adobe.com/en/docs/commerce-merchant-services/payment-services/payments-checkout/vaulting#vaulting-without-purchase) without the typical checkout authorization with Payment Services enabled.
12+
13+
## Workflow
14+
15+
![Payment Services sequence diagram](../../../_images/graphql/payment-services-vault-without-purchase.svg)
16+
17+
1. Run the [`getVaultConfig`](../../payment-services-extension/queries/get-vault-config.md) query to fetch the vault configuration details for the available payment methods. Attribute `is_vault_enabled` set to `true`.
18+
19+
1. Commerce returns the vault configuration details.
20+
21+
1. Run the [`createVaultCardSetupToken`](../../payment-services-extension/mutations/create-vault-card-setup-token.md) mutation to create a temporary `setup_token` associated to the given payment source.
22+
23+
1. Commerce forwards token request to PayPal.
24+
25+
1. PayPal returns the temporary `setup_token` to Commerce.
26+
27+
1. Commerce receives the `setup_token`.
28+
29+
1. PayPal SDK updates the credit card information in the storefront.
30+
31+
1. Run the [`createVaultCardPaymentToken`](../../payment-services-extension/mutations/create-vault-card-payment-token.md) mutation to create a permanent `vault_token_id` and associate it with an optional card description, visible in the storefront.
32+
33+
1. Commerce forwards `setup_token` to PayPal.
34+
35+
1. PayPal returns a permanent `vault_token_id` to Commerce.
36+
37+
1. Commerce vaults the payment method.
38+
39+
## Additional payment information
40+
41+
The setup token is generated with an empty card number in the `payment_source` object purposefully. The PayPal SDK, in conjunction with hosted fields or credit cards field components, securely updates the setup token with payment details.
42+
43+
See [PayPal SDK developer documentation](https://developer.paypal.com/docs/multiparty/checkout/save-payment-methods/purchase-later/js-sdk/cards/) for more information.
44+
45+
To run the `createVaultCardPaymentToken` mutation, use the `setup_token` generated by the [`createVaultCardSetupToken`](../mutations/create-vault-card-setup-token.md) mutation.

src/pages/graphql/payment-services-extension/workflows/vaulted-card.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: Payment Services vault workflow
3-
description: Learn how to use the GraphQL APIs to integrate the Payment Services vault solution.
2+
title: Payment Services vaulted card workflow
3+
description: Learn how to use the GraphQL APIs to integrate the Payment Services into a checkout process with a vaulted card.
44
keywords:
55
- GraphQL
66
- Payments
77
---
88

9-
# Payment Services Vault workflow
9+
# Payment Services vaulted card workflow
1010

1111
The following diagram shows the workflow of a checkout authorization using a vaulted card.
1212

13-
![Payment Services Vault sequence diagram](../../../_images/graphql/payment-services-paypal-vault.svg)
13+
![Payment Services Vault sequence diagram](../../../_images/graphql/payment-services-paypal-vaulted-card.svg)
1414

1515
1. Use the [`customerPaymentTokens`](../../schema/checkout/queries/customer-payment-tokens.md) query to retrieve the payment tokens the customer stored in the vault.
1616

0 commit comments

Comments
 (0)