> For the complete documentation index, see [llms.txt](https://airvend.gitbook.io/airgate-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://airvend.gitbook.io/airgate-documentation/integration-guide/time-based-checkout.md). Agents can also search and read this documentation through its [MCP server](https://airvend.gitbook.io/airgate-documentation/~gitbook/mcp).

# Time Based Checkout

This section walk you through how to use the time based hosted checkout.

{% hint style="warning" %}
Ensure you have fulfilled the steps in the [<mark style="color:blue;">**previous**</mark> ](https://airvend.gitbook.io/airgate-documentation/integration-guide/hosted-checkout.md)section before proceeding
{% endhint %}

Airgate allows you to set a time limit for your hosted payment checkout. This ensures that a payment session automatically expires if the user does not complete the transaction within a specified time window. Below is how you can implement this feature

1. **Add the `time_out` field to the Payment Initiation Request**\
   \
   When sending a payment initiation request to the `/payment_initiate_hosted` endpoint, make sure to include the `time_out` field in your payload. If you're unfamiliar with how to initiate a payment, please refer to the [**previous** ](https://airvend.gitbook.io/airgate-documentation/integration-guide/hosted-checkout.md)section for detailed instructions.\
   \
   By adding the `time_out` field, your final request payload should look like this<br>

   ```json
   {
       "amount": <AMOUNT>,
       "user": {
           "name": <CUSTOMER_NAME>,
           "phone": <CUSTOMER_PHONE>,
           "email": <CUSTOMER_EMAIL>
       },
       "callback_url": <YOUR_CALLBACK_URL>,
       "customer_transaction_ref": <YOUR_UNIQUE_REFERENCE>,// optional
       "time_out": <YOUR_TIME_OUT> // integer (represented in minute)
   }
   ```

{% hint style="warning" %}
**`time_out`   Field Specifications**

* **Type**: Integer
* **Unit**: Minutes
* **Description**: The number of minutes after which the checkout will expire automatically if not completed.<br>

**Examples:**

* `time_out: 1` – Expires after 1 minute.
* `time_out: 15` – Expires after 15 minutes.

<br>
{% endhint %}

2. **Handling Timeout Redirection**\
   \
   Once the specified `time_out` duration elapses without the payment process reaching a completed state, Airgate will automatically redirect the customer back to your `callback_url` . The URL will include a query parameter indicating the status of the transaction as `timeout`. You can then handle the rest of your business logic accordingly.\
   \
   Refer to [this ](https://airvend.gitbook.io/airgate-documentation/integration-guide/callback-url-statuses.md)section to view the complete list of statuses that may be returned as query parameters to your callback URL.
