A Ledger uses a Schema to define functionality for a specific product and use case. A Schema may be shared across multiple Ledgers. Updating a Schema will trigger migrations to update each Ledger. Use the Ledger designer in the Dashboard to model and store your Schema.
Ledgers track money using:
A Ledger Account has a balance. Changes to a Ledger Account's balance are called Ledger Lines.
There are four types of Ledger Accounts, split into two layers:
State
Change
State Ledger Accounts track your product's financial relationships with your bank, payment systems and users. Balance Sheets are a report of State Ledger Account balances.
Change Ledger Accounts track when and how your product makes a profit or loss. They produce Income Statements.
Within a Schema, the chartOfAccounts
key contains a nested tree of Ledger Accounts, up to a maximum depth of 10:
Ledger Accounts that share a parent require a unique key
, but the same key
can be used in different parts of the tree.
For some Ledger Accounts, you must set additional properties:
linkedAccount
enables reconciliation with an external systemtemplate
allows multiple instances to be created on demandcurrencyMode
configures the account's currency mode, single
or multi
consistencyConfig
configures the whether the Ledger Account's balances and Ledger Lines are strongly or eventually consistentA Ledger Entry is a single update to a Ledger. Define a Ledger Entry type in your Schema for every financial event in your product and bank.
A Ledger Entry must be balanced, which means it follows the Accounting Equation:
How you balance a Ledger Entry depends upon its net effect to the Ledger's balances.
When the net change to the State Ledger Accounts is zero, the financial event being recorded did not change the net worth of the business. In this example, an increase to an asset account is balanced by an increase in a liability account:
When the net change to the State Ledger Accounts is non-zero, the financial event being recorded made a profit or loss. In this example, a difference in asset and liability accounts is balanced by an increase in an income account.