A transaction can be created for a PayPal account by calling the
POST /transactions API. The call requires an
payment_method with a
Using Gr4vy Embed
There is little need to use these APIs directly if you are using [Gr4vy Embed] instead. [Gr4vy Embed] automatically creates transactions against these APIs and can even bind them to a previously created buyer.
Transacting with a PayPal account is a 2-step process that requires a buyer-redirect to get explicit authorization.
The first step is to initialize a new PayPal transaction. A
to be provided to redirect the user back to your application after they have
approved access to their PayPal account.
The API returns a new
transaction resource for which the
status is set to
See our guide on transaction statuses for more details.
For the next step, you will need to redirect the buyer to the URL specified in
details.approval_url field of the response.
The buyer then logs in to their PayPal account and authorizes it to be used by
Gr4vy. After this, the buyer is redirected back to the
specified earlier. For example:
transaction_id query parameter represents the ID of the transaction and
transaction_status represents the new status of the transaction.
Finally, you could make an optional API call to confirm the transaction has been successfully authorized or captured.
The API will return the same
transaction resource with its updated status.