Billing
Invoices, allocations & refunds
Derive invoice state from immutable payment-ledger entries instead of manually toggling paid/unpaid flags.
HTML DEV simulation: allocations and refunds model accounting behaviour only. No external payment provider is contacted.
Payment allocation
Rejects overpayment and writes one settled ledger row for each successful allocation.
Refund safety
Refunds cannot exceed the net amount currently paid, and paid invoices cannot simply be voided.