Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 87777c7

Browse files
authored
GraphQL: Add payflow_express and misc payment methods (#5158)
* checkpoint * small fixes * review comments * remove additional_information from EC * remove additional_information from all methods * final adjustments * link errors
1 parent 900bfbe commit 87777c7

File tree

9 files changed

+136
-53
lines changed

9 files changed

+136
-53
lines changed

_data/toc/graphql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,9 @@ pages:
201201

202202
- label: PayPal Express Checkout
203203
url: /graphql/payment-methods/paypal-express-checkout.html
204+
205+
- label: Express Checkout for other PayPal solutions
206+
url: /graphql/payment-methods/payflow-express.html
204207

205208
- label: PayPal Payflow Link
206209
url: /graphql/payment-methods/payflow-link.html

_includes/graphql/payment-methods/payflow-link-workflow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
1. The client displays a payment form in an iframe rendered from the URL specified by the `paypal_url` from the `getPayflowLinkToken` mutation response. When the customer completes the form, the client sends the payment information directly to the PayPal gateway, bypassing the Magento server.
1818

19-
1. After PayPal processes the payment, the gateway runs a silent post request against the Magento server. As a result, Magento sets the order status to pending, and the order is ready to be invoiced.
19+
1. After PayPal processes the payment, the gateway runs a silent post request against the Magento server. As a result, Magento sets the order status to processing, and the order is ready to be invoiced.
2020

21-
1. The PayPal gateway returns control of the customer's browser to the client.
21+
1. The PayPal gateway returns control of the customer's browser to the client.

guides/v2.3/graphql/payment-methods/authorize-net.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,30 @@ The client's browser then posts the nonce to the Magento server along with all t
3030

3131
## Additional payment information
3232

33-
When you set the payment method to `authorizenet_acceptjs` in the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) mutation, the `additional_data` object must contain an `authorizenet_acceptjs` object.
33+
When you set the payment method to `authorizenet_acceptjs` in the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) mutation, the payload must contain an `authorizenet_acceptjs` object.
3434

3535
Attribute | Data Type | Description
3636
--- | --- | ---
3737
`cc_last_4` | Int! | The last four digits of the credit or debit card
3838
`opaque_data_descriptor` | String! | Authorize.Net's description of the transaction request
3939
`opaque_data_value` | String! | The nonce returned by Authorize.Net
4040

41-
## Example setPaymentMethodOnCart mutation
41+
### Example usage
4242

4343
The following example assigns the `authorizenet_acceptjs` payment method to the specified cart.
4444

4545
**Request**
4646

47-
```text
47+
```graphql
4848
mutation {
4949
setPaymentMethodOnCart(input: {
5050
cart_id: "lvdqOLzryManseE2artECZuPClxFgG1o"
5151
payment_method: {
5252
code: "authorizenet_acceptjs"
53-
additional_data: {
54-
authorizenet_acceptjs: {
55-
cc_last_4: 1111
56-
opaque_data_descriptor: "COMMON.ACCEPT.INAPP.PAYMENT"
57-
opaque_data_value: "<nonce_value>"
58-
}
53+
authorizenet_acceptjs: {
54+
cc_last_4: 1111
55+
opaque_data_descriptor: "COMMON.ACCEPT.INAPP.PAYMENT"
56+
opaque_data_value: "<nonce_value>"
5957
}
6058
}
6159
}) {

guides/v2.3/graphql/payment-methods/hosted-pro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ When you set the payment method for a Website Payments Pro Hosted Solution, you
2424

2525
{% include graphql/payment-methods/hosted-pro-attributes.md %}
2626

27-
## Example setPaymentMethodOnCart mutation
27+
### Example usage
2828

2929
The following example shows the `setPaymentMethodOnCart` mutation constructed for the Website Payments Pro Hosted Solution payment method.
3030

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
group: graphql
3+
title: Express Checkout for other PayPal solutions
4+
---
5+
6+
Set the payment method code to `payflow_express` to process Express Checkout transactions when the payment method is set to any of the following:
7+
8+
- Payflow Link
9+
- Payflow Pro
10+
- Payments Advanced
11+
- Payments Pro
12+
13+
PayPal Express Checkout enables customers to pay by credit card or from the security of their personal PayPal accounts. During checkout, the customer is redirected to the secure PayPal site to complete the payment information. The customer is then returned to the store to complete the remainder of the checkout process.
14+
15+
From a GraphQL integration standpoint, this payment method is identical to the [PayPal Express Checkout]({{page.baseurl}}/graphql/payment-methods/payflow-link.html) payment method, with the exception that in the `setPaymentMethodOnCart` mutation, the payment method `code` is set to `payflow_express`.
16+
17+
## PayPal Express Checkout workflow
18+
19+
The following diagram shows the workflow for placing an order when `payflow_express` is the specified payment method.
20+
21+
![PayPal Express Checkout sequence diagram]({{site.baseurl}}/common/images/graphql/paypal-express-checkout.svg)
22+
23+
The following steps describe the flow of calls required to complete a typical PayPal Express Checkout authorization. A successful purchase requires that you send three mutations to PayPal, and the buyer must approve the purchase by logging in to PayPal.
24+
25+
{% include graphql/payment-methods/paypal-express-checkout-workflow.md %}
26+
27+
## `setPaymentMethodOnCart` mutation
28+
29+
When you set the payment method to one of the Express Checkout payment solutions discussed in this topic, you must set the `code` attribute to `payflow_express`. In addition, the payload must contain a `payflow_express` object, which defines the following attributes:
30+
31+
{% include graphql/payment-methods/paypal-express-checkout-attributes.md %}
32+
33+
### Example usage
34+
35+
The following example shows the `setPaymentMethodOnCart` mutation with the `code` set to `payflow_express`.
36+
37+
**Request**
38+
39+
```graphql
40+
mutation {
41+
setPaymentMethodOnCart(input: {
42+
cart_id: "rMQdWEecBZr4SVWZwj2AF6y0dNCKQ8uH"
43+
payment_method: {
44+
code: "payflow_express"
45+
payflow_express: {
46+
payer_id: "<PayPal_PayerID>"
47+
token: "<PayPal_Token>"
48+
}
49+
}
50+
}) {
51+
cart {
52+
selected_payment_method {
53+
code
54+
}
55+
}
56+
}
57+
}
58+
```
59+
60+
**Response**
61+
62+
```json
63+
{
64+
"data": {
65+
"setPaymentMethodOnCart": {
66+
"cart": {
67+
"selected_payment_method": {
68+
"code": "payflow_express",
69+
}
70+
}
71+
}
72+
}
73+
}
74+
```
75+
76+
## Related topics
77+
78+
- [`createPaypalExpressToken` mutation]({{page.baseurl}}/graphql/mutations/create-paypal-express-token.html)
79+
- [`placeOrder` mutation]({{page.baseurl}}/graphql/reference/quote-place-order.html)
80+
- [`setPaymentMethodOnCart` mutation]({{page.baseurl}}/graphql/reference/quote-payment-method.html)

guides/v2.3/graphql/payment-methods/payflow-link.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ When you set the payment method to Payflow Link in the [`setPaymentMethodOnCart`
2121

2222
{% include graphql/payment-methods/payflow-link-attributes.md %}
2323

24-
## Example setPaymentMethodOnCart mutation
24+
### Example usage
2525

2626
The following example shows the `setPaymentMethodOnCart` mutation constructed for the Payflow Link payment method.
2727

2828
**Request**
2929

30-
```text
30+
```graphql
3131
mutation {
3232
setPaymentMethodOnCart(input: {
3333
payment_method: {

guides/v2.3/graphql/payment-methods/payflow-pro.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ title: PayPal Payflow Pro payment method
55

66
Payflow Pro is a payment gateway that processes debit and credit card payments. It is available for customers of the United States, Canada, Australia, and New Zealand.
77

8+
Other PayPal solutions have the same GraphQL workflow as Payflow Pro. The information in this topic also applies to the following PayPal solution:
9+
10+
- Payments Pro
11+
12+
If Payflow Pro has been configured to implement Express Checkout, use the [PayPal Express Checkout for Payflow payment method]({{page.baseurl}}/graphql/payment-methods/payflow-express.html) instead.
13+
814
## Payflow Pro workflow
915

1016
The following diagram shows the workflow for placing an order when Payflow Pro is the selected payment method.
@@ -19,13 +25,13 @@ When you set the payment method to Payflow Pro in the [`setPaymentMethodOnCart`]
1925

2026
{% include graphql/payment-methods/payflow-pro-attributes.md %}
2127

22-
## Example setPaymentMethodOnCart mutation
28+
### Example usage
2329

2430
The following example shows the `setPaymentMethodOnCart` mutation constructed for the Payflow Pro payment method.
2531

2632
**Request**
2733

28-
```text
34+
```graphql
2935
mutation {
3036
setPaymentMethodOnCart(input: {
3137
cart_id: "IeTUiU0oCXjm0uRqGCOuhQ2AuQatogjG"

guides/v2.3/graphql/payment-methods/payments-advanced.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ group: graphql
33
title: PayPal Payments Advanced payment method
44
---
55

6-
The PayPal Payments Advanced payment solution allows merchants to enable their online stores to collect payments directly via credit card, PayPal Express Checkout, or PayPal's PayPal Credit service. From a GraphQL integration standpoint, PayPal Payments Advanced payment method is identical to the PayPal [Payflow Link]({{page.baseurl}}/graphql/payment-methods/payflow-link.html) payment method, with the exception of the payment method `code`. The PayPal [Payments Advanced documentation](https://developer.paypal.com/docs/classic/products/paypal-payments-advanced/) describes other ways in which the payment methods differ.
6+
The PayPal Payments Advanced payment solution allows merchants to enable their online stores to collect payments directly via credit card or from the PayPal Credit service. If Payments Advanced has been configured to implement Express Checkout, use the [PayPal Express Checkout for Payflow payment method]({{page.baseurl}}/graphql/payment-methods/payflow-express.html) instead.
7+
8+
From a GraphQL integration standpoint, PayPal Payments Advanced payment method is identical to the PayPal [Payflow Link]({{page.baseurl}}/graphql/payment-methods/payflow-link.html) payment method, with the exception of the payment method `code`. The PayPal [Payments Advanced documentation](https://developer.paypal.com/docs/classic/products/paypal-payments-advanced/) describes other ways in which the payment methods differ.
79

810
PayPal Payments Advanced is available in the US and Canada only.
911

@@ -17,36 +19,36 @@ The following diagram shows the workflow for placing an order when Payments Adva
1719

1820
## Additional Payment information
1921

20-
When you set the payment method code to `payflow_advanced` in the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) mutation, the `additional_data` object must contain a `payflow_link` object, which defines the following attributes:
22+
## `setPaymentMethodOnCart` mutation
23+
24+
When you set the payment method to PayPal Payments Advanced, you must set the `code` attribute to `payflow_advanced`. In addition, the payload must contain a `payflow_link` object, which defines the following attributes:
2125

2226
{% include graphql/payment-methods/payflow-link-attributes.md %}
2327

24-
## Example setPaymentMethodOnCart mutation
28+
### Example usage
2529

2630
The following example shows the `setPaymentMethodOnCart` mutation constructed for the Payments Advanced payment method.
2731

2832
**Request**
2933

30-
```text
34+
```graphql
3135
mutation {
32-
setPaymentMethodOnCart(input: {
33-
payment_method: {
34-
code: "payflow_advanced"
35-
additional_data: {
36-
payflow_link: {
37-
return_url: "paypal/action/return.html"
38-
error_url: "paypal/action/error.html"
39-
cancel_url: "paypal/action/cancel.html"
40-
}
41-
}
36+
setPaymentMethodOnCart(input: {
37+
payment_method: {
38+
code: "payflow_advanced"
39+
payflow_link: {
40+
return_url: "paypal/action/return.html"
41+
error_url: "paypal/action/error.html"
42+
cancel_url: "paypal/action/cancel.html"
4243
}
43-
cart_id: "IeTUiU0oCXjm0uRqGCOuhQ2AuQatogjG"
44+
}
45+
cart_id: "IeTUiU0oCXjm0uRqGCOuhQ2AuQatogjG"
4446
}) {
4547
cart {
46-
selected_payment_method {
47-
code
48-
title
49-
}
48+
selected_payment_method {
49+
code
50+
title
51+
}
5052
}
5153
}
5254
}

guides/v2.3/graphql/payment-methods/paypal-express-checkout.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ group: graphql
33
title: PayPal Express Checkout payment method
44
---
55

6-
The PayPal Express Checkout payment method enables customers to pay by credit card or from the security of their personal PayPal accounts. During checkout, the customer is redirected to the secure PayPal site to complete the payment information. The customer is then returned to your store to complete the remainder of the checkout process.
6+
The PayPal Express Checkout payment method enables customers to pay by credit card or from the security of their personal PayPal accounts. During checkout, the customer is redirected to the secure PayPal site to complete the payment information. The customer is then returned to the store to complete the remainder of the checkout process.
77

8-
The merchant can use PayPal Express Checkout as a standalone option, or combine it with one of these other PayPal payment solutions:
8+
Some alternate PayPal solutions have the same GraphQL workflow when Express Checkout is enabled. The information in this topic also applies to the following PayPal solutions:
99

10-
- PayPal Payflow Link
11-
- PayPal Payment Standard
12-
- Website Payments Standard (Australia only)
13-
- Website Payments Standard (United Kingdom only)
14-
15-
When these other payment solutions are combined with PayPal Express Checkout, they use the same workflow as PayPal Express Checkout. From the GraphQL perspective, the only difference is the payment method `code` specified in the `setPaymentMethodOnCart` mutation.
10+
- Payments Standard
11+
- Website Payments Standard
1612

1713
## PayPal Express Checkout workflow
1814

@@ -24,13 +20,13 @@ The following steps describe the flow of calls required to complete a typical Pa
2420

2521
{% include graphql/payment-methods/paypal-express-checkout-workflow.md %}
2622

27-
## Additional Payment information
23+
## `setPaymentMethodOnCart` mutation
2824

29-
When you set the payment method code to `paypal_express` in the `setPaymentMethodOnCart` mutation, you must also specify attributes specific to this payment method in `additional_data` object. These attributes are defined in the `paypal_express` object:
25+
When you set the payment method to Express Checkout, you must set the `code` attribute to `paypal_express`. In addition, the payload must contain a `paypal_express` object, which defines the following attributes:
3026

3127
{% include graphql/payment-methods/paypal-express-checkout-attributes.md %}
3228

33-
## Example setPaymentMethodOnCart mutation
29+
### Example usage
3430

3531
The following example shows the `setPaymentMethodOnCart` mutation constructed for the PayPal Express payment method.
3632

@@ -41,14 +37,12 @@ mutation {
4137
setPaymentMethodOnCart(input: {
4238
cart_id: "rMQdWEecBZr4SVWZwj2AF6y0dNCKQ8uH"
4339
payment_method: {
44-
code: "paypal_express"
45-
additional_data: {
46-
paypal_express: {
47-
payer_id: "<PayPal_PayerID>"
48-
token: "<PayPal_Token>"
49-
}
50-
}
40+
code: "paypal_express"
41+
paypal_express: {
42+
payer_id: "<PayPal_PayerID>"
43+
token: "<PayPal_Token>"
5144
}
45+
}
5246
}) {
5347
cart {
5448
selected_payment_method {

0 commit comments

Comments
 (0)