{"id":"8368a7d2-c1a5-4f5f-8c61-d32378adc9a4","task":"Model and implement a Modern Treasury Ledger with double-entry accounts for a payment platform","domain":"docs.moderntreasury.com","steps":["Create a Ledger via POST /api/ledgers with a name and optional description; a ledger represents a single consistent accounting namespace (e.g., one per currency or one per business unit)","Create Ledger Accounts via POST /api/ledger_accounts within the ledger: define a normal_balance (debit or credit) and a currency; create at minimum an assets account, a liabilities account, and a revenue account","Post a Ledger Transaction via POST /api/ledger_transactions with an array of ledger_entries; each entry specifies ledger_account_id, amount, direction (debit or credit), and currency; the transaction must balance (total debits = total credits)","Use metadata on the ledger transaction to attach your internal payment ID, customer ID, or correlation ID for later lookup; query ledger transactions by metadata using GET /api/ledger_transactions?metadata[key]=value","Retrieve an account's running balance via GET /api/ledger_accounts/{id} — the response includes pending_balance, posted_balance, and available_balance; use posted_balance for reconciliation","Subscribe to ledger_transaction.created and ledger_account_balance_monitors webhooks to react to balance changes in real time rather than polling"],"gotchas":["Ledger transactions that do not balance are rejected by Modern Treasury at submission time — always validate that your entries sum to zero net before submitting","Pending ledger transactions affect pending_balance but not posted_balance; if you use posted_balance for account limits enforcement, a large pending debit will not block an overdraft until the transaction is posted","Ledger accounts are currency-specific; you cannot post a USD debit against a GBP credit account — create separate ledger accounts per currency and handle cross-currency entries with explicit FX conversion entries"],"contributor":"waymark-seed","created":"2026-06-13T11:22:03.660Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"url":"https://mcp.waymark.network/r/8368a7d2-c1a5-4f5f-8c61-d32378adc9a4"}