Inflight allows you to hold a transaction until a set condition has been met. It is best applied when your system needs to wait for feedback or verification before a transaction is applied, e.g., waiting for a success notification from your payment partners.

While a transaction is inflight, you can also make sure that the funds are not available for the sender to spend until the transaction has been resolved.

Let’s dig in ✨

Here’s what we’ll cover …

  1. How inflight works
  2. Applying inflight
  3. Inflight statuses
  4. Inflight for multiple sources/destinations
  5. Use cases

1. How inflight works

When you enable inflight on a transaction, the workflow becomes a bit different from the default record-transaction workflow.

Before the conditions are met

When you record a new transaction with inflight, it is added to transaction queue by default. Once it is ready for processing, the transaction status is updated to INFLIGHT.

When the status is INFLIGHT, the respective inflight balances of the specified source and destination are updated.

  • inflight_credit_balance: Total amount of money waiting to be credited.
  • inflight_debit_balance: Total amount of money waiting to be debited.
  • inflight_balance: (inflight_credit_balance - inflight_debit_balance).

In INFLIGHT, the original balances of the source and destination remain untouched. However, the inflight_debit_balance of the source and the inflight_credit_balance of the destination are updated with the transaction amount.

The inflight balances exist to help you keep track of the amounts yet to debited or credited to a specific balance.

During inflight

While a transaction is inflight, it is important to make sure that the source’s original balance is not lower than the amount waiting to be debited to avoid errors when the transaction is committed.

To do this, the source must be prevented from having access to the amount being held in inflight.

  • balance - Total balance of the ledger balance.
  • inflight_debit_balance - Total amount waiting to be deducted from your balance.
  • available_balance - Total amount accessible by the source (balance - inflight_debit_balance). This is computed by you in your application and presented as the balance of the user during inflight.

After the conditions are met

Once you have gotten feedback from your system, Blnk expects one of two instructions — commit or void.

  • Commit: Instructs Blnk to continue with the transaction and apply it to the balances. A new transaction is created that applies the transaction to both balances.

    When a transaction is committed, the amount is debited from the source’s balance to the source’s inflight_balance, and the destination’s balance is credited from the destination’s inflight_balance.

  • Void: Instructs Blnk to stop and void the transaction. This refunds the transaction between both inflight balances, and nothing else needs to be done.

When you commit or void an inflight transaction, a new transaction record is created with the original inflight “transaction_id” as its parent_transaction.

2. Record an inflight transaction

Initiating an inflight transaction

Call the record-transaction endpoint: Include the inflight parameter in the request body and set it to true:

View your transaction in your terminal:

bash
blnk view-transactions

Use the inflight_expiry_date to set when you want the transaction to expire if it hasn’t been committed or voided yet in that time.

Always format the 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.

Committing an inflight transaction

If the transaction meets the set conditions, instruct Blnk to commit with the update-inflight endpoint:

PUT http://YOUR_BLNK_INSTANCE_URL/transactions/inflight/{transaction_id}
Request
{
    "status": "commit"
}

Blnk creates a new transaction record with the details from the original inflight transaction and applies it to the balances.

Partial commits

You can also choose to commit in bits, i.e., you can instruct Blnk to release the held funds in bits. To do this, pass an amount field in your request body:

Request
{
    "status": "commit",
    "amount": 1000
}

Make sure that the amount being passed is less than or equal to the amount remaining in inflight for that transaction.

You can commit as many times as you want as long as the sum of the amount of each commit is less than or equal to the amount being held in inflight for the particular transaction.

View your committed transactions in your terminal:

bash
blnk view-transactions

Voiding an inflight transaction

If the transaction doesn’t meet the set conditions, instruct Blnk to void with the update-inflight endpoint:

PUT http://YOUR_BLNK_INSTANCE_URL/transactions/inflight/{transaction_id}
Request
{
    "status": "void"
}

Blnk creates a new transaction record with the details from the original inflight transaction. However, this time, the status will be VOID; it is not applied to any of the balances, and the source and destination inflight_balances are reset.

View your balances after inflight:

bash
blnk view-balances

You cannot void in bits. When you void a transaction, it means that the inflight transaction didn’t meet the set conditions.

3. Inflight statuses

  1. INFLIGHT: Your transaction status is updated to “inflight” when inflight is enabled for the transaction in the request body. A transaction in inflight will remain there and not be applied until the set condition is satisfied or the transaction expires.

  2. COMMIT: Commit is a status specific to the update inflight endpoint. When you send a “commit” status for an inflight transaction, it means that the transaction has met the set inflight conditions and can now be applied.

  3. VOID: Void is a status also specific to the update-inflight endpoint. When you send a “void” status for an inflight transaction, it means that the transaction didn’t meet the conditions and should not be applied.

  4. EXPIRED: This means the transaction stayed in the INFLIGHT status past the specified expiry date. If an inflight transaction expires, a new transaction record is created with its status saved as EXPIRED and the transaction is discarded.

All transactions in Blnk are immutable. Once a transaction has been applied, committed or voided, you cannot roll back the status to its previous status.

This is important to protect the correctness and accuracy of the transaction and your ledger as a whole.

4. 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 and Multiple Destinations.

You can initiate inflight transactions to multiple destinations from a single source. To do so, enable inflight in your transaction request.

Request
{

    "inflight": true
}

When you use multiple sources, the transactions are recorded separately in the ledger. However, they are grouped with a parent transaction id. This is the id shown in the response of your initial request.

Commit or void inflight transaction

To commit or void all transactions at once, call the inflight endpoint and pass the parent transaction id.

PUT http://YOUR_BLNK_INSTANCE_URL/transactions/inflight/{parent_transaction}

5. 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: 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 or join our Discord community.

Get access to Blnk Cloud.

Manage your Blnk Ledger and explore advanced features (access control & collaboration, anomaly detection, secure storage & file management, etc.) in one dashboard.

Was this page helpful?