Auto-cancel unpaid invoices after a merchant-configured TTL.
- Add merchant configuration field:
unpaid_invoice_ttl_minutes(default 60) tomerchantsvia migration. - Implement auto-cancel cron in
InvoicesService:- Add a new
@Cronjob (or update existing one) to setstatus='cancelled'(notexpired) when:- invoice status in (
pending,partial) created_at + merchant.unpaid_invoice_ttl_minutes< NOW()
- invoice status in (
- Dispatch webhook event
merchant.payment_intent.expiredorinvoice.cancelled(per current event model).
- Add a new
- Keep existing
expireInvoices()behavior consistent withexpires_at(optional: rename or separate logic). - Update types (
packages/types) if needed for webhook payload/event typings. - Add/extend unit test(s) for the new cron logic.
- Update docs (
docs/INVOICE_PAYMENT_FLOW.md) if required. - Run
npm run typecheck,npm test.