The General Ledger is created by default when you deploy your Blnk server.
1: What are internal balances?
An internal balance is a ledger balance owned by your organization, e.g., revenue, fees, loans, etc. You can use an internal balance to track interactions between your own accounts as an organization and your customers accounts managed by your application. For instance, you own an online e-commerce app that assigns a wallet to every signed up user. Two things happen:- Every time a user pays for something on your app with their wallet, their balance is debited and you earn revenue.
- Every time a user funds their wallet, a fee is debited from the user’s wallet and paid somewhere (the e-commerce startup or the payment processor).
@ indicators as the source or destination when you record a transaction.
2: Creating an internal balance
If you reference an@ indicator in a transaction and that balance does not exist yet, Blnk still creates it automatically and processes the transaction. The new balance uses the currency from the transaction.
Starting from 0.15.3, you can create an internal balance manually. Call the Create balance endpoint with ledger_id set to general_ledger_id and the indicator you want to use.
Continuing our earlier example, you create @Revenue like this:
201 Created
@Revenue as the source or destination in a transaction. The same indicator and currency pair can only exist once; a duplicate create request returns 409.
3: Naming conventions
When choosing names for your internal balances, it’s important to use consistent and descriptive naming schemes. This ensures easy recall and reduces the risk of errors when posting transactions. Here are some things to note when naming your internal balances:- Always use the
@prefix so the balance is stored in the General Ledger. - Use names that clearly describe the balance’s purpose, e.g.,
@Revenue,@Fees,@World, etc. - Avoid using the same name for internal balances that serve the same function but represent different asset classes. For example, instead of naming two balances
@Revenue-onein EUR and the other in USD, name them@RevenueUSDand@RevenueEURfor better clarity and easier reference in your integration. - Use camel case (
@OnlineRevenue) or underscores (@online_revenue) to separate words for better readability. Avoid including spaces to prevent formatting issues. - Keep it short to facilitate easier referencing.