This guide is for Blnk versions 0.10.8 and older. For version 0.11.0 and newer, see the updated documentation.
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.
You can also preemptively track the transaction status (via
reference
or parent_transaction
) to know if the transaction was successful or rejected.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
When working with inflight transactions, your system must always consider both the actual balance and any pending inflight amounts. To do this, compute anavailable_balance
for your customers indicating the amount available for them to spend on new transactions:
-
Query the
source
balance, 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.