Overview
The Ledger Engine maintains multiple balance types for each account to provide accurate financial information:- Account Balance: Total balance including all transactions
- Available Balance: Funds available for new transactions
- Lien Amount: Funds frozen or held
- Overdraft Balance: Amount of overdraft currently used
Balance Types
Account Balance
The account balance represents the total balance of the account, including all debits and credits.Available Balance
The available balance is the amount that can be used for new transactions. It excludes:- Lien Amount: Funds placed on lien (frozen)
- Holds: Temporary holds on funds
- Pending Debits: Debits that are pending but not yet finalized
Available balance is what you should check before allowing new transactions to ensure sufficient funds.
Lien Amount
A lien is a legal claim or hold on funds in an account, making them unavailable for transactions.- Funds on lien cannot be debited
- Lien can be placed by administrators
- Lien can be released when conditions are met
Overdraft Balance
Overdraft allows accounts to have a negative balance up to a specified limit.- Overdraft Limit: Maximum negative balance allowed
- Used Overdraft: Current amount of overdraft being used
- Available Overdraft: Remaining overdraft capacity
Balance Calculation Flow
Real-Time Updates
Balances are updated in real-time with every transaction:Balance Query Process
When querying account balance:Account Balance API
View the complete API documentation for balance queries.
Balance Components
Account Balance Response
When querying an account balance, you receive:- accountBalance: Total account balance
- availableBalance: Available funds for transactions
- totalLienAmount: Total amount on lien
- overDraftLimit: Maximum overdraft allowed
- newOverDraftBalance: Current overdraft used
- accountStatus: Current account status
- currencyCode: Account currency
Balance Updates
After Debit Transaction
When money is debited from an account:After Credit Transaction
When money is credited to an account:With Lien
When a lien is placed on funds:With Overdraft
When account uses overdraft:Balance Validation
Before Transaction
Before processing a debit transaction, the system validates:- Account Status: Account must be ACTIVATED
- Available Balance: Must be sufficient (or overdraft available)
- Lien Check: Account must not be fully on lien
- Currency Match: Transaction currency must match account currency
Insufficient Balance Handling
When balance is insufficient:- Transaction is rejected
- No balance changes occur
- Error returned:
INSUFFICIENT_FUNDS
Balance Tracking
Transaction History
Every transaction records balance changes:- previousAccountBalance: Balance before transaction
- newBalance: Balance after transaction
- transactionAmount: Amount of the transaction
Ledger History API
View transaction history to track balance changes.
Balance Reconciliation
To reconcile account balances:- Get Current Balance: Query account balance
- Get Transaction History: Retrieve all transactions
- Calculate Expected Balance: Sum all credits and debits
- Compare: Current balance should match calculated balance
Multi-Currency Balances
Each account maintains balances in a specific currency:- Currency-Specific: Each currency has its own balance
- No Cross-Currency: Cannot debit NGN and credit USD in same transaction
- Separate Accounts: Different currencies require separate accounts
Best Practices
1. Always Check Available Balance
Before debiting, always check available balance, not just account balance.2. Handle Negative Balances
If overdraft is allowed, handle negative balances appropriately.3. Monitor Lien Amounts
Be aware of lien amounts that reduce available balance.4. Track Balance Changes
Use transaction history to track how balances change over time.5. Reconcile Regularly
Periodically reconcile balances with transaction history.Account Balance API
Query account balances with the API.
View Process Flow
Understand the complete balance query flow.
