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

Commit f39b1d5

Browse files
authored
Add documentation for Payflow Link payment processor (#4861)
* review draft * Check in updated graphic * another try at the graphic * delete extraneous file * Apply suggestions from code review Co-Authored-By: Erik Marr <45772211+erikmarr@users.noreply.github.com> * Apply suggestions from code review
1 parent 805c859 commit f39b1d5

File tree

5 files changed

+173
-0
lines changed

5 files changed

+173
-0
lines changed

_data/toc/graphql.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ pages:
2222
- label: GraphQL Caching
2323
url: /graphql/caching.html
2424

25+
- label: Payment methods
26+
children:
27+
- label: PayPal Payflow Link
28+
url: /graphql/payment-methods/payflow-link.html
29+
2530
- label: Development
2631
children:
2732
- label: Define the GraphQL schema for a module
@@ -62,6 +67,9 @@ pages:
6267
- label: Paypal endpoint
6368
url: /graphql/reference/paypal.html
6469

70+
- label: Payflow getPayflowLinkToken query
71+
url: /graphql/reference/paypal-get-payflow-link-token.html
72+
6573
- label: Products endpoint
6674
url: /graphql/reference/products.html
6775
children:

guides/v2.3/graphql/images/paypal-payflow-link.svg

Lines changed: 2 additions & 0 deletions
Loading
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
group: graphql
3+
title: PayPal Payflow Link payment method
4+
---
5+
6+
PayPal [PayFlow Link](https://developer.paypal.com/docs/classic/payflow/integration-guide/) is available for merchants in the United States and Canada only. Customers are not required to have a personal PayPal account. Instead, customers enter their credit card information in a form that is hosted by PayPal.
7+
8+
The Payflow gateway uses a secure token to send non-credit card transaction data to the Payflow server for storage in a way that cannot be intercepted and manipulated maliciously. This token secures the data for a one-time transaction and is valid for 30 minutes. When the AWS client runs the `placeOrder` mutation, Magento requests a secure token. The Payflow server returns the token as a string of up to 32 alphanumeric characters.
9+
10+
## Payflow Link workflow
11+
12+
The following diagram shows the workflow for placing an order when Payflow Link is the selected payment method.
13+
14+
![PayPal Payflow Link sequence diagram]({{page.baseurl}}/graphql/images/paypal-payflow-link.svg)
15+
16+
1. The PWA client uses the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) mutation to set the payment method to `payflow_link`.
17+
18+
2. The mutation returns a `Cart` object.
19+
20+
3. The client runs the [`placeOrder`]({{page.baseurl}}/graphql/reference/quote-place-order.html) mutation, which creates an order in Magento and begins the authorization process.
21+
22+
4. Magento requests a secure token from the Payflow Link gateway.
23+
24+
5. The gateway response includes a secure token, a secure token ID, and the URL to use for requesting the Payflow form in step 9.
25+
26+
6. The `placeOrder` mutation returns an order ID. Magento does not return secure token information. The order has the status `payment pending`.
27+
28+
7. The client runs the [`getPayflowLinkToken`]({{page.baseurl}}/graphql/reference/paypal-get-payflow-link-token.html) mutation to retrieve the secure token information.
29+
30+
8. Magento returns the token information.
31+
32+
9. The client displays a payment form in an iframe rendered from the URL specified by the `paypal_url` from `getPayflowLinkToken` mutation response. When the customer completes the form, the client sends the payment information directly to the Payflow gateway, bypassing the Magento server.
33+
34+
10. 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.
35+
36+
11. The Payflow gateway returns control of the customer's browser to the client.
37+
38+
## Additional Payment information
39+
40+
You must set the following attributes when setting the payment method to `payflow_link`:
41+
42+
Attribute | Data Type | Description
43+
--- | --- | ---
44+
`cancel_url` | String! | The URL PayPal will redirect back to upon payment cancellation
45+
`error_url` | String! | The URL PayPal will redirect back to upon payment error
46+
`return_url` | String! | The URL PayPal will redirect back to upon payment success
47+
48+
## Example setPaymentMethodOnCart mutation
49+
50+
The following example shows the [`setPaymentMethodOnCart`]({{page.baseurl}}/graphql/reference/quote-payment-method.html) mutation constructed for the Payflow Link payment method.
51+
52+
**Request**
53+
54+
``` text
55+
mutation {
56+
setPaymentMethodOnCart(input: {
57+
payment_method: {
58+
code: "payflow_link"
59+
additional_data: {
60+
payflow_link: {
61+
return_url: "https://www.example.com/payflow/test/return",
62+
error_url: "https://www.example.com/payflow/test/error",
63+
cancel_url: "https://www.example.com/payflow/test/cancel"
64+
}
65+
}
66+
}
67+
cart_id: "IeTUiU0oCXjm0uRqGCOuhQ2AuQatogjG"
68+
}) {
69+
cart {
70+
selected_payment_method {
71+
code
72+
title
73+
}
74+
}
75+
}
76+
}
77+
```
78+
79+
**Response**
80+
81+
```json
82+
{
83+
"data": {
84+
"setPaymentMethodOnCart": {
85+
"cart": {
86+
"selected_payment_method": {
87+
"code": "payflow_link",
88+
"title": "PayPal Payflow Link"
89+
}
90+
}
91+
}
92+
}
93+
}
94+
```
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
group: graphql
3+
title: getPayflowLinkToken query
4+
---
5+
6+
The `getPayflowLinkToken` query retrieves PayPal payment credentials for a PayPal Payflow transaction. You must run this query after you [set the payment method]({{ page.baseurl}}/graphql/reference/quote-payment-method.html) and [place the order]({{ page.baseurl}}/graphql/reference/quote-place-order.html).
7+
8+
See [Paypal Payflow Link payment method]({{page.baseurl}}/graphql/payment-methods/payflow-link.html) for detailed information about the workflow of PayPal Payflow Link transactions.
9+
10+
## Syntax
11+
12+
`getPayflowLinkToken(input: PayflowLinkTokenInput): PayflowLinkToken`
13+
14+
## Example
15+
16+
The following example requests a token in a Payflow Link transaction.
17+
18+
**Request**
19+
20+
```text
21+
{
22+
getPayflowLinkToken(input: {cart_id: "123"}) {
23+
secure_token
24+
secure_token_id
25+
mode
26+
paypal_url
27+
}
28+
}
29+
```
30+
31+
**Response**
32+
33+
```json
34+
{
35+
"data": {
36+
"getPayflowLinkToken": {
37+
"secure_token": "<token-value>",
38+
"secure_token_id": "<token-value-id>",
39+
"mode": "TEST",
40+
"paypal_url": "https://pilot-payflowlink.paypal.com"
41+
}
42+
}
43+
}
44+
```
45+
46+
## Input attributes
47+
48+
### PayflowLinkTokenInput {#PayflowLinkTokenInput}
49+
50+
The `PayflowLinkTokenInput` object defines the attributes required to receive a Payflow Link token from PayPal.
51+
52+
Attribute | Data Type | Description
53+
--- | --- | ---
54+
`cart_id` | String! | The unique ID that identifies the customer's cart
55+
56+
## Output attributes
57+
58+
### PayflowLinkToken
59+
60+
The `PayflowLinkToken` object contains a token returned by PayPal and a set of URLs that allow the buyer to authorize payment and adjust checkout details.
61+
62+
Attribute | Data Type | Description
63+
--- | --- | ---
64+
`mode` | `PayflowLinkMode` | The mode for the Payflow Link payment. Must be `LIVE` (actual transaction) or `TEST` (sandbox transaction)
65+
`paypal_url` | String | The PayPal URL used for requesting a Payflow form
66+
`secure_token` | String | Secure token generated by PayPal
67+
`secure_token_id` | String | Secure token ID generated by PayPal

guides/v2.3/graphql/reference/quote-payment-method.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Credit Card (Authorize.Net) | `authorizenet_acceptjs`
1414
No Payment Information Required | `free`
1515
[PayPal Express Checkout]({{ page.baseurl}}/graphql/reference/paypal.html) | `paypal_express`
1616
[PayPal Express Checkout Payflow Edition]({{ page.baseurl}}/graphql/reference/paypal.html) | `payflow_express`
17+
PayPal Payflow Pro | `payflowpro`
18+
PayPal Payflow Link | `payflow_link`
1719
Purchase Order | `purchaseorder`
1820

1921
Apply the `setPaymentMethodOnCart` mutation after setting the shipping address, shipping method, and after applying any discounts to the cart.

0 commit comments

Comments
 (0)