-
When the buyer clicks a PayPal button, the frontend executes the
createPaypalExpressTokenmutation. -
The application requests a secure token from PayPal. The application gathers information in the specified cart and sends this information to PayPal as part of a request for a secure token.
-
If the token request succeeds, PayPal returns a token. You must include this token in subsequent steps.
-
The application sends the token to the client. The
createPaypalExpressTokenresponse includes the token and the PayPal URLs to be used in the next step. -
Redirect the customer to PayPal for approval. Depending on your implementation, the customer is either redirected to the PayPal login screen, or the customer enters their credentials in-context.
-
If the customer approves the payment, PayPal redirects the customer back to the payment confirmation page. The response includes the secure token and payer ID as GET parameters.
-
Set the payment method. The frontend runs the
setPaymentMethodOnCartmutation. The payload includes the PayPal token, the payer ID, and the cart ID. The cart may have been updated since the token was requested, as shipping costs, taxes, and other adjustments might have been applied to the cart. The application submits the updated cart to PayPal. -
The application returns a
Cartobject. -
Place the order with the
placeOrdermutation. -
The application sends the secure token, payer ID, and final cart information to PayPal.
-
PayPal captures the payment by transferring the funds from the customer account to the appropriate merchant account.
-
The application creates an order, ready for fulfillment.