> ## 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.

# Reauthorization

> Automatically reauthorize an expired authorization in a capture request.

Most card payments happen in two stages. First, an **authorization** reserves the funds with the customer's bank, but no money moves. Then, a **capture** requests those funds for settlement.

An authorization is only valid for a limited period. If you capture after that period has passed, the capture can be declined because the authorization is no longer valid. Reauthorization solves this by creating a new authorization at capture time and capturing that instead, so funds can still be claimed against a stored payment method.

## How it works

When a capture request is made, Gr4vy checks whether reauthorization applies before attempting the capture:

1. **Check that reauthorization is enabled** for your account.
2. **Check the request.** The capture request body must contain `"reauthorize_if_authorization_expired": true`.
3. **Check the payment method.** The transaction must have a stored payment method.
4. **Check the authorization's validity.** Gr4vy checks whether the authorization being captured has passed its validity period, based on the card scheme and environment. See [Validity periods](#validity-periods) below.

If the validity period has passed, Gr4vy creates a new transaction based on the previous transaction and authorizes again:

* **If the new authorization succeeds**, Gr4vy captures the new authorization and returns the new transaction. A new transaction ID is returned in the capture response, and the new transaction has a `reauthorized_from_transaction_id` field set to the ID of the previous transaction. Gr4vy also schedules an asynchronous void of the previous authorization.
* **If the reauthorization fails**, Gr4vy continues to attempt to capture the previous authorization and returns the old transaction in the response.

## Validity periods

The validity period of an authorization depends on the card scheme and the environment. If the authorization being captured is older than the period shown below, it is treated as expired and reauthorization is attempted.

### Production

| Card scheme | Validity period |
| :---------- | :-------------- |
| Amex        | 7 days          |
| Discover    | 10 days         |
| Mastercard  | 7 days          |
| Visa        | 7 days          |

### Sandbox

Sandbox uses the same validity periods as production, except for Mastercard and Visa, which expire almost immediately. This lets you test the reauthorization flow without waiting for the production validity period to pass.

| Card scheme | Validity period |
| :---------- | :-------------- |
| Amex        | 7 days          |
| Discover    | 10 days         |
| Mastercard  | 1 microsecond   |
| Visa        | 1 microsecond   |
