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

# Applying Inflight

> Learn how to hold transactions until a condition is met.

<Info>Available in version 0.6.0 and later.</Info>

***

## Overview

An inflight transaction keeps your transaction on hold until you take further action. When enabled using the `inflight` parameter, transactions follow a specialized workflow that maintains separate balances for pending operations.

It is best used when you want to wait for feedback or authorization before a transaction is applied in your ledger.

***

## Before we start,

Remember that all ledger balances in Blnk have 6 main balance parameters:

1. `balance`: This shows the current value held in the ledger balance.
2. `credit_balance`: This is the total sum of all amounts received by a ledger balance.
3. `debit_balance`: This is the total sum of all amounts sent by a ledger balance.
4. `inflight_balance`: This shows the net amount held inflight for a balance.
5. `inflight_credit_balance`: This is the total sum of all amount waiting to be received by a ledger balance.
6. `inflight_debit_balance`: This is the total sum of all amount waiting to be deducted from a ledger balance.

***

## How Inflight works

This is how inflight transactions work in Blnk:

<Steps titleSize="h3">
  <Step id="record-transaction-with-inflight" title="Record transaction with Inflight">
    First, specify that the transaction should be held inflight by setting `inflight: true`.

    ```json Record inflight {9} theme={"system"}
    {
        "amount": 100,
        "precision": 100,
        "reference": "ref_001adcfgf",
        "currency": "USD",
        "source": "bln_28edb3e5-c168-4127-a1c4-16274e7a28d3",
        "destination": "bln_ebcd230f-6265-4d4a-a4ca-45974c47f746",
        "description": "For vacation",
        "inflight": true
    }
    ```

    When recording a new transaction with Inflight, the system, by default, will:

    1. Initializes the transaction in the `QUEUED` state.
    2. Processes and moves the transaction to `INFLIGHT`.
    3. Maintains the original balances while tracking the pending amounts in inflight balance parameters.
  </Step>

  <Step id="balance-management" title="Balance management">
    Next, understand how Blnk tracks inflight amounts. We use these three balance parameters:

    ```text wrap theme={"system"}
    inflight_credit_balance: Pending credits awaiting processing
    inflight_debit_balance:  Pending debits awaiting processing
    inflight_balance:        inflight (credit - debit)
    ```

    <img src="https://mintcdn.com/blnk/dat3WexQx5twNo5Q/images/step-01-02-using-inflight.png?fit=max&auto=format&n=dat3WexQx5twNo5Q&q=85&s=333a0636300c4a0e8186088e551b31fc" alt="Step 1: How a transaction is processed in Inflight" width="1816" height="1232" data-path="images/step-01-02-using-inflight.png" />

    **For example:** consider an inflight transaction where \$100 is transferred from balance\_A to balance\_B:

    ```text wrap theme={"system"}
    Initial State:
    balance_A: $200 available funds
    balance_B: $0 available funds

    Transaction Amount: $100
    ```

    | `balance_id` | **Main balance** | **Inflight balance** | **Inflight credit** | **Inflight debit** |
    | :----------- | :--------------- | :------------------- | :------------------ | :----------------- |
    | `balance_A`  | 200              | -100                 | 0                   | 100                |
    | `balance_B`  | 0                | 100                  | 100                 | 0                  |

    In this scenario:

    * `balance_A` shows a negative inflight balance (-100) because funds are pending outflow.
    * `balance_B` shows a positive inflight balance (100) because funds are pending inflow.
    * The main balances remain unchanged until the transaction is committed.
  </Step>

  <Step id="updating-inflight" title="Updating Inflight">
    Updating an inflight transaction means telling Blnk what to do with it next: commit or void?

    To update an inflight transaction, use the [Update Inflight](/reference/update-inflight) endpoint:

    <img src="https://mintcdn.com/blnk/dat3WexQx5twNo5Q/images/step-03-using-inflight.png?fit=max&auto=format&n=dat3WexQx5twNo5Q&q=85&s=1a921b38eea3b8bbc55f46c26c6b9718" alt="Scenarios when inflight transactions are finished processing" width="1816" height="1384" data-path="images/step-03-using-inflight.png" />

    ```
    PUT /transactions/inflight/{transaction_id}
    ```

    <Tabs>
      <Tab title="Commit inflight" icon="circle-check">
        1. Indicates transaction conditions are met.
        2. Triggers balance updates, and clears the inflight balances.
        3. Creates new transaction record with `APPLIED` status.

        ```bash cURL {5} wrap theme={"system"}
        curl -X PUT http://localhost:5001/transactions/inflight/{transaction_id} \
          -H 'X-Blnk-Key: <api-key>' \
          -H 'Content-Type: application/json' \
          -d '{
            "status": "commit"
          }'
        ```

        In our example, after commit:

        | `balance_id` | **Main balance** | **Inflight balance** | **Inflight credit** | **Inflight debit** |
        | :----------- | :--------------- | :------------------- | :------------------ | :----------------- |
        | `balance_A`  | 100              | 0                    | 0                   | 0                  |
        | `balance_B`  | 100              | 0                    | 0                   | 0                  |
      </Tab>

      <Tab title="Partial commits" icon="percent">
        1. Only the specified amount is applied to the main balances.
        2. The remaining amount is left inflight.

        <span id="partial-commits" />

        ```bash cURL {5-6} wrap theme={"system"}
        curl -X PUT http://localhost:5001/transactions/inflight/{transaction_id} \
          -H 'X-Blnk-Key: <api-key>' \
          -H 'Content-Type: application/json' \
          -d '{
            "status": "commit",
            "amount": 40
          }'
        ```

        <Note>Partial commit amount must not exceed remaining inflight amount.</Note>

        Our example after a partial commit:

        | `balance_id` | **Main balance** | **Inflight balance** | **Inflight credit** | **Inflight debit** |
        | :----------- | :--------------- | :------------------- | :------------------ | :----------------- |
        | `balance_A`  | 160              | -60                  | 0                   | 60                 |
        | `balance_B`  | 40               | 60                   | 60                  | 0                  |
      </Tab>

      <Tab title="Void inflight" icon="circle-x">
        ```bash cURL {5} wrap theme={"system"}
        curl -X PUT http://localhost:5001/transactions/inflight/{transaction_id} \
          -H 'X-Blnk-Key: <api-key>' \
          -H 'Content-Type: application/json' \
          -d '{
            "status": "void"
          }'
        ```

        * Indicates transaction conditions were not met.
        * Creates new transaction record with `VOID` status.
        * Resets inflight balances without affecting actual balances.
      </Tab>
    </Tabs>
  </Step>
</Steps>

***

## Schedule inflight commits

<Info>Available in version 0.14.1 and later.</Info>

When you create an inflight transaction, Blnk reserves the balance immediately but waits until you tell it to commit or void.

With `inflight_commit_date`, you can specify in your request when you want Blnk to automatically commit an inflight transaction for you.

This is useful when the inflight transaction starts now, but the final commit should happen at a known future time.

<Check>
  For example, you can reserve funds for a hotel booking today and have Blnk commit the transaction automatically on the check-in date.
</Check>

```json Record inflight with commit date {10} theme={"system"}
{
    "amount": 100,
    "precision": 100,
    "reference": "ref_001adcfgf",
    "currency": "USD",
    "source": "bln_28edb3e5-c168-4127-a1c4-16274e7a28d3",
    "destination": "bln_ebcd230f-6265-4d4a-a4ca-45974c47f746",
    "description": "For vacation",
    "inflight": true,
    "inflight_commit_date": "2024-12-21T01:36:46+01:00"
}
```

<Tip>
  Always format the `inflight_commit_date` date input as `YYYY-MM-DDTHH:MM:SS+00:00` (for example, `2024-04-22T15:28:03+00:00`), where `+00:00` is the timezone offset. UTC is used by default when you use `+00:00`.
</Tip>

***

## Schedule inflight expiry

A transaction stays inflight until you commit it, void it manually, or it **expires**. To cap how long funds can remain held inflight, include **`inflight_expiry_date`** when you record the transaction.

* If the transaction is still `INFLIGHT` after the expiry time, Blnk **voids** it automatically (same outcome as [Update Inflight](/reference/update-inflight) with **`void`**).
* Creates a new record with **`VOID`** status.
* Resets inflight balances without changing your settled balances.

```json Record inflight with expiry date {10} theme={"system"}
{
    "amount": 100,
    "precision": 100,
    "reference": "ref_001adcfgf",
    "currency": "USD",
    "source": "bln_28edb3e5-c168-4127-a1c4-16274e7a28d3",
    "destination": "bln_ebcd230f-6265-4d4a-a4ca-45974c47f746",
    "description": "For vacation",
    "inflight": true,
    "inflight_expiry_date": "2024-12-21T01:36:46+01:00"
}
```

<Tip>
  Always format the `inflight_expiry_date` date input as `YYYY-MM-DDTHH:MM:SS+00:00` (e.g., `2024-04-22T15:28:03+00:00`), where `+00:00` specifies the timezone. It is UTC by default.
</Tip>

<Note>
  If you use both **`inflight_commit_date`** and **`inflight_expiry_date`**, set the commit time **before** the expiry time so Blnk can commit the hold before it would auto-void.
</Note>

***

## Verifying inflight statuses

### Via Search API

You can verify transaction status using the Search API by querying with the appropriate transaction ID:

<Tabs>
  <Tab title="When skip_queue = false (default)">
    Use the **queued transaction ID** to search for its child transactions.

    ```bash cURL wrap theme={"system"}
    curl -X POST "http://YOUR_BLNK_INSTANCE_URL/search/transactions" \
      -H "X-Blnk-Key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "q": "<queued_transaction_id>",
        "query_by": "meta_data.QUEUED_PARENT_TRANSACTION",
        "filter_by": "status:[APPLIED, VOID]"
      }'
    ```
  </Tab>

  <Tab title="When skip_queue = true">
    Use the **inflight transaction ID** and search for its child transactions:

    ```bash cURl wrap theme={"system"}
    curl -X POST "http://YOUR_BLNK_INSTANCE_URL/search/transactions" \
      -H "X-Blnk-Key: YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "q": "<inflight_transaction_id>",
        "query_by": "parent_transaction"
      }'
    ```
  </Tab>
</Tabs>

### Via webhooks

The most reliable way to verify if an inflight transaction has been committed or voided is through webhooks. This approach allows you to receive real-time notifications when the transaction status changes:

<Steps>
  <Step title="Add verification reference to metadata">
    Before creating the inflight transaction, generate a unique verification reference and add it to the transaction's metadata:

    <CodeGroup>
      ```json Create inflight with verification ref theme={"system"}
      {
          "amount": 100,
          "precision": 100,
          "reference": "ref_001adcfgf",
          "currency": "USD",
          "source": "bln_28edb3e5-c168-4127-a1c4-16274e7a28d3",
          "destination": "bln_ebcd230f-6265-4d4a-a4ca-45974c47f746",
          "description": "For vacation",
          "inflight": true,
          "meta_data": {
              "verification_ref": "verify_abc123xyz"
          }
      }
      ```
    </CodeGroup>
  </Step>

  <Step title="Handle webhook notifications">
    When the inflight transaction is committed or voided, Blnk sends a webhook notification. The metadata from the parent transaction is passed down to the child transaction, so you can identify your transaction using the verification reference.

    <Tip> Blnk also adds `inflight: true` to the transaction's metadata. </Tip>

    ```json transaction.applied expandable theme={"system"}
    {
        "transaction_id": "txn_e0f5ab98-bb87-4b09-aefe-839ddb11598b",
        "hook_type": "POST_TRANSACTION",
        "timestamp": "2025-02-23T09:43:49.636219+01:00",
        "data": {
            "precise_amount": 20000,
            "amount": 200,
            "rate": 1,
            "precision": 100,
            "transaction_id": "txn_e0f5ab98-bb87-4b09-aefe-839ddb11598b",
            "parent_transaction": "",
            "source": "bln_7f91a1ae-6073-4b7a-952c-23abf94a6634",
            "destination": "bln_59b83b9c-842c-427f-91eb-43cdeaf5c01a",
            "reference": "4rddddd3dd3rredddddddddde3sddddsdddeddeed",
            "currency": "GBP",
            "description": "Testing inflight/rates issue",
            "status": "APPLIED",
            "hash": "623e05ceb7ca7b02a9318092de7b75d8c668628e2db76c42b621b61055b10b3e",
            "allow_overdraft": true,
            "inflight": false,
            "skip_queue": true,
            "created_at": "2025-02-23T09:43:49.623494+01:00",
            "scheduled_for": "0001-01-01T00:00:00Z",
            "inflight_expiry_date": "0001-01-01T00:00:00Z",
            "inflight_commit_date": "0001-01-01T00:00:00Z",
            "meta_data": {
                "verification_ref": "verify_abc123xyz",
                "inflight": true
            }
        }
    }
    ```
  </Step>

  <Step title="Process webhook in your application">
    Finally, check each webhook and verify that the verification reference from the webhook matches the specific inflight transaction you're tracking.

    <Check>You're good to go!</Check>
  </Step>
</Steps>

***

## Inflight for multiple sources/destinations

Multiple sources in Blnk allow you send from multiple sources to a single destination simultaneously, while multiple destinations allow you to send from one source to multiple destinations.

Learn more: [Multiple Sources](/transactions/multiple-sources) and [Multiple Destinations](/transactions/multiple-destinations).

<Steps titleSize="h3">
  <Step title="Initiate inflight">
    When initiating inflight transactions with multiple sources/destinations, enable the inflight feature in your transaction request. Here's how to structure your request:

    ```json Request theme={"system"}
    {
        // ... other transaction details
        "inflight": true
    }
    ```

    When using multiple sources/destinations, each transaction is recorded separately in the ledger.

    However, these transactions are linked together through a `parent_transaction` attribute, which you'll receive in the response to your transaction request. This `parent_transaction` helps you track and manage related transactions as a single unit.
  </Step>

  <Step title="Update Inflight">
    To commit or void all transactions at once, call the [Update Inflight endpoint](/reference/update-inflight) and pass the root-level `transaction_id` from your API response as the path parameter.

    ```bash cURL wrap theme={"system"}
    curl -X PUT http://YOUR_BLNK_INSTANCE_URL/transactions/inflight/{parent_transaction} \
      -H 'X-Blnk-Key: <api-key>' \
      -H 'Content-Type: application/json' \
      -d '{
        "status": "commit"
      }'
    ```
  </Step>
</Steps>

***

## Use cases

Useful applications for `inflight` include:

* **For managing KYC limits:** When an account crosses its KYC limits determined by your application, you can hold all deposits with inflight until the user's KYC is updated.
* **[For escrow](/resources/examples/escrow):** Inflight allows you to easily implement escrow features in your application, allowing your users see the amount being held (but not available to them to spend).
* **For card payouts:** Hold amounts in an inflight balance until the card is authorized by the payment processor for successful payment.
* **For external payouts:** Hold amount in an inflight balance while your payout is being processed by your provider; only release it when the transaction is successful or failed.

## Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool.

To ask questions or discuss issues, please [contact us](mailto:support@blnkfinance.com) or [join our Discord community](https://discord.gg/7WNv94zPpx).

***

<Tip>
  **Tip:** Connect to Blnk Cloud to see your Core data.

  You can view your transactions, manage identities, create custom reports, invite other team members to collaborate, and perform operations on your Core — all in one dashboard.

  [Check out Blnk Cloud →](https://www.blnkfinance.com/products/cloud)
</Tip>
