Applying inflight
Learn how to hold transactions until a condition is met.
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 …
- How inflight works
- Applying inflight
- Inflight statuses
- Inflight for multiple sources/destinations
- 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’sinflight_balance
, and the destination’sbalance
is credited from the destination’sinflight_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:
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.
Committing an inflight transaction
If the transaction meets the set conditions, instruct Blnk to commit with the update-inflight endpoint:
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:
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:
Voiding an inflight transaction
If the transaction doesn’t meet the set conditions, instruct Blnk to void with the update-inflight endpoint:
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:
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
-
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. -
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. -
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. -
EXPIRED
: This means the transaction stayed in theINFLIGHT
status past the specified expiry date. If an inflight transaction expires, a new transaction record is created with its status saved asEXPIRED
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.
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.
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 join our Discord community.
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?