Ledger tables
op_ledger_accounts- Account definitions (Cash, Merchant Payable, Platform Fee Revenue)op_ledger_transactions- Journal entries linking to payment eventsop_ledger_entries- Individual debit and credit line items
Journal balance constraint
Every ledger entry must post balanced debits and credits. The system validates usingbccomp() at 4-decimal precision and throws InvalidArgumentException on unbalanced journals.
Account directionality
Balances adjust according to standard GAAP accounting rules:Brand isolation
Ledger accounts are strictly bound to a brand/merchant context:Double-post prevention
The system usesSELECT ... FOR UPDATE on (merchant_id, reference_type, reference_id, description) to guard against double-posting.
Reconciliation
Daily reconciliation
- Compare OwnPay transactions with gateway
- Verify amounts match
- Check for discrepancies
- Report any mismatches
Reconciliation tool
Best practices
- Never manually modify
op_ledger_accounts.balance - Always go through
LedgerServicefor ledger operations - Run daily balance verification checks
- Monitor the
BalanceVerificationJobalerts
Further reading
- Balance verification - Run reconciliation audits from the admin dashboard
- Reports - Generate financial reports and analytics
- Transactions - View individual payment details and ledger entries