1. Automatic rejection
When a transaction is posted where thesource balance has insufficient funds, Bink automatically handles this scenario to maintain ledger integrity. Blnk checks only the balance amount to determine if it is sufficient for the transaction amount being processed.
If funds are insufficient, Blnk:
- Rejects the transaction.
- Records this rejection in your ledger using the same state tracking mechanism (i.e.
QUEUED→REJECTED). Learn more about transaction lifecycle. - Sends a webhook notification to inform your system of the state change and new ledger record.
2. Proactive balance verification
Instead of waiting for atransaction.rejected webhook, you can implement a preemptive available balance check in your workflow. Here’s how:
First, query the balance of the sender using:
cURL
- If the available balance is sufficient, proceed with posting your transaction.
- If the available balance is insufficient, you can gracefully handle this scenario in your application by notifying the customer immediately, avoiding the need for webhook handling.
Queued balances
Learn how queued balances work
3. Insufficient funds for inflight transactions
Starting from version 0.11.0, Blnk now includes inflight balances in the insufficient funds check. The manual checks described below are only necessary for versions 0.10.8 and older.
available_balance for your customers indicating the amount available for them to spend on new transactions:
-
Query the
sourcebalance, and compute theavailable_balance: -
Compare the new transaction amount against
available_balance:- If amount ≤ available_balance: Proceed with transaction.
- If amount > available_balance: Handle gracefully in your application by notifying the customer of insufficient funds.
- You ensure that pending inflight transactions will always be committed when they need to.
- Customers are prevented from spending funds that are waiting to be deducted from their balance.