Architecture
Proposed stack: Next.js interfaces, TypeScript/NestJS modular backend, PostgreSQL/Prisma, managed background workers, AWS Sydney and a regulated Australian payment/banking partner. This is provisional and subject to provider integration capabilities.
Financial integrity rules
A bill, payment, payment attempt, collection and payout are separate records. All financial operations are idempotent. Ledger postings are immutable, balanced per currency and use integer minor units. Reconcile internal ledger to provider statements and actual bank movements. Do not disburse based only on authorisation or capture success. Payouts must reserve eligible funds atomically to prevent double allocation.
Operational design
Prefer daily aggregated merchant payouts with per-bill allocations and references. Treat refunds, disputes, delayed settlements, webhook duplication and unknown provider outcomes as first-class workflows. Keep a complete audit trail of financial and administrative changes.