# OTB Billing Design Notes ## Current Version 0.0.2 ## Purpose OTB Billing is the billing and payment tracking component for OutsideTheBox. It is intended to: - track clients - track services - issue invoices - record payments - support bookkeeping visibility - integrate with outsidethedb while keeping billing records logically separate ## Supported payment directions - Square - Interac e-Transfer - Crypto ## Multi-currency design The schema supports multi-currency from day one. Current intended currencies: - CAD - ETHO - EGAZ - ALT ### Rule Store both: - actual payment currency and amount - CAD-equivalent snapshot when relevant Example: - payment_currency = EGAZ - payment_amount = 12.50000000 - cad_value_at_payment = 47.82 This keeps both crypto-native records and bookkeeping-friendly reporting. ## Core tables - clients - services - invoices - invoice_items - payments - audit_log ## Relationship flow client -> service -> invoice -> invoice_items -> payment ## Notes - services are linked to clients - invoices are linked to clients and optionally to services - invoice items can optionally reference services - payments reference both invoice and client - audit_log provides change history for future accountability and troubleshooting ## Planned future additions - recurring invoice generation - reminders / overdue handling - dashboard counts - service suspension workflow - integration hooks to outsidethedb - client verification records