> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gr4vy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Handling redirects

Requests that require a redirect return a `status` of `buyer_approval_pending` with a `payment_method.approval_url`.  In this situation, it's required to redirect the buyer to this approval URL.

```json theme={"system"}
{
    "type": "transaction",
    "id": "0c41c8df-27f4-480e-97f0-9401558ae25e",
    "status": "buyer_approval_pending",
    "payment_method": {
        "type": "payment-method",
        "method": "paypal",
        "mode": "redirect",
        "approval_url": "https://www.sandbox.paypal.com/checkoutnow?token=7NP38594266148058",
        ...
    },
   ...
}
```

Approval may be needed for cards to facilitate 3-D Secure, and for non-cards to get the buyer to grant account payment authentication.

## Start the approval

The app needs to redirect the customer to the `payment_method.approval_url`, where they are required to authenticate the payment. The exact way of this authentication depends on the payment method.

After they've authenticated themselves, the customer is redirected back to the `redirect_url` that was set when creating the transaction.

<Warning>
  If the customer abandons the checkout or somehow experiences network connection issues, the transaction state can get out of sync between the app and the system.
  The following [best practices](/guides/best-practices/overview) are recommended for handling these situations.
</Warning>

## Handle the return to the app

When a customer is redirected back to the site, the transaction status is not known. The app therefore needs to call the API to get the latest transaction status. The next step shows how to do this. To do this, the `redirect_url` is appended with the `transaction_id` and status of the transaction.

```
[redirect_url]?transaction_id=2f37e0d0-5549-42c4-9c5c-e03d5fa97148&transaction_status=capture_succeeded
```

<Warning>
  Although the `transaction_status` is provided in this callback, fetching the latest status via the API is also recommended, as the status may have changed since.
</Warning>

After handling the redirect, display a message to the customer letting them know the result of the transaction.

## Summary

In this step you:

* Sent a customer to the approval URL
* Handled the customer returning to the redirect URL
