generated from AdobeDocs/dev-site-documentation-template
-
Notifications
You must be signed in to change notification settings - Fork 116
Updates GraphQL for Payment Services with new PDP workflows and details. #484
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c617a39
updated pages as per typo
danidelcar 17fd33c
Updated TOC
danidelcar 789ca97
fixed title
danidelcar 3b953e2
Added workflows for pdp
danidelcar 5510772
Fix note
danidelcar a0fc72d
Updated toc
danidelcar da9deb9
Merge branch 'main' into del-cart-ps-workflow
danidelcar 73090f7
Merge branch 'main' into del-cart-ps-workflow
danidelcar 6e7d689
Merge branch 'main' into del-cart-ps-workflow
danidelcar 8380900
Apply suggestions from code review
danidelcar 92523a9
Merge branch 'main' into del-cart-ps-workflow
danidelcar b662b80
Update src/pages/graphql/payment-services-extension/workflows/cart-pd…
danidelcar 26d4ee4
Apply suggestions from code review
danidelcar d9d15ff
Update src/pages/graphql/payment-services-extension/workflows/cart-pd…
danidelcar 16a14e3
Update src/pages/graphql/payment-services-extension/workflows/cart-pd…
danidelcar d1530e6
Update src/pages/graphql/payment-services-extension/workflows/cart-pd…
danidelcar 88a73b4
Update src/pages/graphql/payment-services-extension/workflows/cart-pd…
danidelcar 393d550
Apply suggestions from code review
danidelcar 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
4 changes: 4 additions & 0 deletions
4
src/pages/_images/graphql/payment-services-pdp-cartinactive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
71 changes: 71 additions & 0 deletions
71
src/pages/graphql/payment-services-extension/workflows/cart-pdp.md
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,71 @@ | ||
| --- | ||
| title: Add product to a new cart in the Product Details Page | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description: Learn how Adobe Commerce uses GraphQL to create a new cart in the Product Details Page with smart buttons (Apple Pay). | ||
| keywords: | ||
| - GraphQL | ||
| - Payments | ||
| --- | ||
|
|
||
| # Payment services minicart workflow | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| <InlineAlert variant="info" slots="text" /> | ||
|
|
||
| This workflow is available only with Apple Pay if you have installed [Payment Services for Adobe Commerce](https://commercemarketplace.adobe.com/magento-payment-services.html) 2.12.0 or higher. | ||
|
|
||
| These steps describe the flow of requests and responses with the [Payment Services](https://experienceleague.adobe.com/docs/commerce-merchant-services/payment-services/guide-overview.html) solution enabled for guests and logged-in customers. This workflow is required to [create a new cart](../mutations/add-products-new-cart.md) in the Product Details Page (PDP) with smart buttons. | ||
|
|
||
| ## Add product to a new cart in a PDP workflow | ||
|
|
||
| These steps describe the use case when a shopper adds a product to the cart in the PDP. | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|  | ||
|
|
||
| 1. Run the [`getPaymentConfig`](../../payment-services-extension/queries/get-payment-config.md) query to fetch the payment configuration needed to render details about PayPal components, such as hosted fields, smart buttons, and Apple Pay. | ||
|
|
||
| 1. Adobe Commerce returns payment configuration information. | ||
|
|
||
danidelcar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 1. Run [`setPaymentMethodOnCart`](../../schema/cart/mutations/set-payment-method.md) to [set the payment method](../../tutorials/checkout/set-payment-method.md). | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 1. Adobe Commerce returns a `Cart` object. | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. Run [`addProductsToNewCart`](../../payment-services-extension/mutations/add-products-new-cart.md) to create a new cart and add the item. | ||
|
|
||
| 1. Commerce returns a `cart` object, which includes the cart `id` field. | ||
|
|
||
| 1. Run [`createPaymentOrder`](../../payment-services-extension/mutations/create-payment-order.md) to begin the authorization process. | ||
|
|
||
| 1. Commerce forwards the request to PayPal. | ||
|
|
||
| If there is an error during the payment process, or the shopper cancels the payment process in the PDP, run [`setCartAsInactive`](../../payment-services-extension/mutations/set-cart-inactive.md) to set a specific `cartId` as inactive and to avoid having multiple active carts for logged-in customers. | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 1. PayPal returns an `id` value. | ||
|
|
||
| 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. | ||
|
|
||
| 1. Run the [`placeOrder`](../../schema/cart/mutations/place-order.md) mutation. | ||
|
|
||
| 1. Commerce sends an authorization request to PayPal. | ||
|
|
||
| 1. PayPal returns the result to Commerce. | ||
|
|
||
| 1. Commerce creates an order. | ||
|
|
||
| ### Payment cancellation while on a PDP workflow | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| These steps describe the use case when a shopper cancels the payment process in the PDP. | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|  | ||
|
|
||
| 1. Run the [`getPaymentConfig`](../../payment-services-extension/queries/get-payment-config.md) query to fetch the payment configuration needed to render details about PayPal components, such as hosted fields, smart buttons, and Apple Pay. | ||
|
|
||
| 1. Adobe Commerce returns payment configuration information. | ||
|
|
||
| 1. Run [`addProductsToNewCart`](../../payment-services-extension/mutations/add-products-new-cart.md) to create a new cart and add the item. | ||
|
|
||
| 1. Commerce returns a `cart` object, which includes the cart `id` field. | ||
|
|
||
| 1. Run [`setCartAsInactive`](../../payment-services-extension/mutations/set-cart-inactive.md) to set a specific `cartId` as inactive. | ||
|
|
||
| 1. Commerce returns a confirmation that a specific `cartId` is inactive. | ||
|
|
||
| 1. If the shopper clicks the smartbutton again, `addProductsToNewCart` mutation runs once more to return a new `cart` object. | ||
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
danidelcar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.