# Time Based Checkout

{% hint style="warning" %}
Ensure you have fulfilled the steps in the [<mark style="color:blue;">**previous**</mark> ](https://callphone.gitbook.io/airgate-documentation/integration-guide/hosted-checkout)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://callphone.gitbook.io/airgate-documentation/integration-guide/hosted-checkout)section for detailed instructions.\
   \
   By adding the `time_out` field, your final request payload should look like this\\

   ```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.\\

**Examples:**

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

\\

{% 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://callphone.gitbook.io/airgate-documentation/integration-guide/callback-url-statuses)section to view the complete list of statuses that may be returned as query parameters to your callback URL.
