feat(billing): Usage & Billing API for the peergos-flutter app (+ commit live ns1 drift) #2
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/usage-billing-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds the backend for the peergos-flutter Usage & Billing screen. George approved building, merging and deploying this on 2026-10-06.
Commits
chore: commit live drift. These files were running on ns1 but were never in git:src/jobs/send-invoices.ts, the overdue email HTML, the portal#billingdeep link, and thesend-invoicesnpm script. Without this commit, a deploy from git would regress them.feat(billing). Adds the/portal/api/billing/*routes (summary, usage, estimate, invoices, pay-now with server-side confirm, payment methods via SetupIntent/Checkout, PO info) and the staff routes (storage samples, PO attach/renew). Full spec indocs/USAGE-BILLING-API.md.Safety
storage_samplesandpurchase_orders, created withCREATE TABLE IF NOT EXISTS. No existing table or column is altered.Tests: 9 new; the full suite passes 283/283 (it was 274 before this PR).
/portal/api/billing/{summary,usage,estimate,invoices,invoices/:id/pay[/confirm], payment-methods[/setup-intent|/checkout-session|/:id|/:id/default],po} behind the portal session; staff routes for storage samples and purchase orders. Additive tables storage_samples and purchase_orders (CREATE TABLE IF NOT EXISTS). Card routes 503 without a real Stripe key; nothing charges without customer confirmation. 9 new tests; full suite 283/283.