Balance Types
Balances in Blnk can be configured with different capabilities:- Standard Balance: Basic balance tracking with credit/debit operations
- Tracked Balance: Enables fund lineage tracking to maintain source-of-funds information
- Allocation-Aware: Supports different allocation strategies (FIFO, LIFO, Proportional) for fund lineage
Request Body
The ID of the ledger this balance belongs to. Every balance must be associated with a ledger.
The currency code for this balance (e.g., “USD”, “EUR”, “NGN”). All transactions on this balance must use the same currency.
The ID of the identity (user, customer, merchant) associated with this balance. Required when
track_fund_lineage is enabled.The precision multiplier for currency handling. Determines how many decimal places the balance supports.Examples:
100for cents (2 decimal places)1000for 3 decimal places1for whole units only
Enable fund lineage tracking for this balance. When enabled, Blnk tracks the source of all funds and maintains a detailed breakdown of how funds flow through the balance.Requires
identity_id to be set.The allocation strategy to use when debiting funds from a balance with lineage tracking. Determines which funds are spent first.Options:
FIFO: First In, First Out - spend oldest funds firstLIFO: Last In, First Out - spend newest funds firstPROPORTIONAL: Allocate proportionally across all fund sources
track_fund_lineage is enabled.Custom metadata to attach to the balance. Can store any additional information as key-value pairs.Example:
Response
Unique identifier for the created balance.
The ledger ID this balance belongs to.
The identity ID associated with this balance.
The currency code for this balance.
The current balance amount (credit_balance - debit_balance). Stored as a big integer string for precision.
Total credits applied to this balance. Stored as a big integer string.
Total debits applied to this balance. Stored as a big integer string.
Total balance currently in inflight transactions (pending confirmation).
Credits currently in inflight status.
Debits currently in inflight status.
The precision multiplier for this balance.
Version number for optimistic concurrency control. Incremented with each balance update.
Whether fund lineage tracking is enabled for this balance.
The allocation strategy for fund lineage (FIFO, LIFO, or PROPORTIONAL).
ISO 8601 timestamp when the balance was created.
ISO 8601 timestamp when current inflight transactions expire.
Custom metadata attached to the balance.
Examples
Currency Precision
Blnk uses arbitrary precision arithmetic to handle currency amounts without rounding errors. Theprecision field defines the multiplier:
- Amount
1234with precision100=12.34in display currency - Amount
5000000with precision100=50000.00in display currency - Amount
999with precision1000=0.999in display currency
Fund Lineage Tracking
Whentrack_fund_lineage is enabled:
- Shadow Balances: Blnk creates shadow balances to track funds from each provider
- Provider Tracking: Each credit transaction can specify a provider via metadata
- Allocation Strategies: Debits are allocated based on the configured strategy
- Full Transparency: Query lineage to see exactly which funds came from where