Luong Truong
Luong Truong

Reputation: 2153

react native - payment with PayPal v2/orders

I am implementing PayPal in React Native, following the documentation for PayPal Payments v2 API

Here is the step by step of my checkout:

  1. Use https://api.sandbox.paypal.com/v1/oauth2/token to get token.
  2. Use https://api.sandbox.paypal.com/v2/checkout/orders to create an order
  3. Use approve link for clients to accept payment
  4. I set the return_url to be https://www.google.com/. After clients accept the payment, I receive the return_url https://www.google.com/?token=<order_id>&PayerID=<payer_id>

At this point I'm stuck: how can I use the information order_id and payer_id?

Upvotes: 1

Views: 557

Answers (1)

Preston PHX
Preston PHX

Reputation: 30377

The next step is to do a v2/orders capture of that order_id

Assuming success, the response's payments -> capture -> id value is what you should persist in your database for accounting purposes, as this is what will be searchable as the Transaction ID in the paypal.com account.

(The order_id has no accounting value, and should only be kept around ~1 month for debug purposes.)

Upvotes: 1

Related Questions