-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
BraintreeGraphQl Workflow #4915
Conversation
An admin must run tests on this PR before it can be merged. |
a8e045f
to
e493d08
Compare
e493d08
to
1f3ed3a
Compare
Corresponds to magento/graphql-ce#392
1f3ed3a
to
618bfb7
Compare
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.
@pmclain Thanks for opening this PR. A lot has changed since you submitted it, most notably:
-
We've been migrating topics from the
reference
directory to themutations
andqueries
directories. I need you to mover thecreateBraintreeClientToken
topic to themutations
directory. -
After going through 5 or 6 PayPal payments methods, I figured out what I want the documentation to look like. Make sure your Braintree and Braintree workflows account for each hop between the client, Magento, and Braintree. The first workflow I wrote for Express Checkout combined multiple hops in a single step because I was mimicking the PayPal docs. I need to create infographics for the two Braintree payment methods, and so the workflow needs to be highly granular. You can view the PayPal infographics in the
common/images/graphql
directory.
|
||
## Braintree Vault workflow | ||
|
||
1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html) |
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.
1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html) | |
1. Use the [`customerPaymentTokens`]({{page.baseurl}}/graphql/queries/customer-payment-tokens.html) query to retrieve the payment tokens the customer has stored in the vault. |
## Braintree Vault workflow | ||
|
||
1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html) | ||
query. |
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.
query. | |
1. Magento returns an array of payment tokens. |
1. Fetch vault payment method for customer with [`customerPaymentTokens`]({{page.baseurl}}/graphql/reference/vault.html) | ||
query. | ||
|
||
2. Customer selects stored Braintree payment method. |
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.
2. Customer selects stored Braintree payment method. | |
1. The client renders the token information, and the customer selects a payment method. |
|
||
2. Customer selects stored Braintree payment method. | ||
|
||
3. When the customer clicks **Place Order**, the PWA uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) |
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.
3. When the customer clicks **Place Order**, the PWA uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) | |
1. When the customer clicks **Place Order**, the PWA uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) |
1. Generate Braintree Client token using the [`createBraintreeClientToken`]({{page.baseurl}}/graphql/reference/braintree-create-client-token.html) | ||
mutation | ||
|
||
2. Initial [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3) |
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.
2. Initial [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3) | |
1. Initialize the [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3) |
Is this direct communication between the PWA client and Braintree?
2. Initial [Braintree hosted fields](https://developers.braintreepayments.com/guides/hosted-fields/overview/javascript/v3) | ||
using the client token to collect and tokenize payment information via a secure iframe. | ||
|
||
3. On the checkout page, the customer selects **Credit Card** as the payment method and enters the credit card |
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.
Maybe mention that the credit card information is in the hosted fields section, while the billing/shipping addresses are on the merchant's storefront?
|
||
9. Magento creates an order and sends an order ID in response to the `placeOrder` mutation. | ||
|
||
## Additional Payment information |
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.
## Additional Payment information | |
## `setPaymentMethodOnCart` mutation |
`is_active_payment_token_enabler` | Boolean! | Required input dictating if payment should be stored in `Magento_Vault` | ||
`device_data` | String | Optional input json encoded device data for Kount integration | ||
|
||
## Example setPaymentMethodOnCart mutation |
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.
## Example setPaymentMethodOnCart mutation | |
## Example usage |
--- | --- | --- | ||
`payment_method_nonce` | String! | Required input for Braintree client-side generated nonce | ||
`is_active_payment_token_enabler` | Boolean! | Required input dictating if payment should be stored in `Magento_Vault` | ||
`device_data` | String | Optional input json encoded device data for Kount integration |
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.
`device_data` | String | Optional input json encoded device data for Kount integration | |
`device_data` | String | Optional. JSON-encoded device data for Kount integration |
running tests |
Hi @pmclain, thank you for your contribution! |
Thanks @pmclain for this major contribution. I'll contact you within a couple of days to shore up the infographics for the workflows. |
Purpose of this pull request
Corresponds with magento/graphql-ce#392
This PR adds workflow documentation for queries and mutations rtequired for setting quote payment methods to Braintree and Braintree CC Vault.
whatsnew
Added the Braintree and Braintree Vault payment methods.