AR Aging & Dunning Engine
Turn an AR aging export into a reviewed, escalating batch of payment reminders - staged by aging bucket, stopped automatically when an invoice is paid, with a hold-candidate list and a full log. A collector approves every batch before a single email goes out.
Import an aging file, auto-stage reminders by aging bucket with escalating tone, have a collector review and approve the batch, then send dunning emails through Resend, produce a credit-hold candidate list, and log everything - with auto-stop the moment an invoice is marked paid.
Before you start
- A free Supabase account
- A free Resend account with one verified sending domain
- A Vercel account for deploy (optional while building)
- An AR aging export (CSV) from your accounting system - QuickBooks, Xero, NetSuite, Sage, or a spreadsheet
The problem this kills
Overdue invoices slip through the cracks. The aging report says three customers are 60+ days late, but nobody chased them this week because the collector was buried in the 30-day bucket. The reminders that do go out all sound the same polite note whether an invoice is five days late or ninety. And when a customer finally pays, a "FINAL NOTICE" email still goes out the next morning because the chase list never got updated.
So cash sits uncollected, the aging report keeps growing, and the awkward "did we already email them?" question gets asked every Monday. The work is real, but it's manual, repetitive, and easy to drop.
What you'll build
A small internal web app that takes your AR aging export and turns it into a clean, staged batch of reminders - automatically. It reads each open invoice, drops it into the right aging bucket (current, 1-30, 31-60, 61-90, 90+), and picks the matching reminder template, escalating the tone as the invoice ages: a friendly nudge early, a firmer notice in the middle, a final-demand-with-hold-warning at the end.
Then it stops and waits for a human. A collector opens the staged batch, reads through it, edits any wording, removes anyone who shouldn't be chased, and approves. Only then does the tool send the reminders through Resend. Accounts that have aged past your threshold land on a separate credit-hold candidate list for a controller to act on. And every invoice that shows up as paid in the next import automatically drops out of the chase - no more dunning a customer who already paid.
What's inside the Implementation Plan
The plan is a single file you paste into Claude Code (an AI coding agent), and it builds the tool with you step by step. It opens by interviewing you about your business - your aging buckets and day thresholds, the exact column names in your aging export, how your customer and invoice numbers are formatted, your reminder cadence, your escalation tone, and your credit-hold rules - so the tool is tailored to how you actually collect, not a generic template. You confirm a short spec before anything gets built.
Inside you'll find:
- The discovery interview and the tailored spec it produces
- A data model for invoices, dunning steps, batches, and a send log built around your real fields
- Aging-bucket logic and escalating email templates you control
- The collector review-and-approve screen (the human gate)
- Resend wiring for the actual sends, with a dedupe guard so the same reminder can't fire twice
- Auto-stop-on-payment logic driven by each fresh import
- The credit-hold candidate list and a full audit trail
- A no-API fallback so you can run the whole thing today from a Google Sheet or CSV, and export a clean results file
The governance it includes (this is the point)
This isn't a "blast emails" script. It's built like an internal tool a controller can trust:
- Login so only your team can use it.
- Row-level security so each organization only ever sees its own invoices and customers.
- A human-in-the-loop approval gate - the tool drafts the batch, a collector reviews and approves, and only then does anything send or land on the hold list. Nothing touches a customer or a system of record without a person saying yes.
- A complete audit trail - who staged, who edited, who approved, what sent, and when.
- Duplicate guards keyed on invoice + dunning step, so a customer can never get the same reminder twice even if you import twice.
Who it's for
Collections specialists, AR clerks, and controllers who live in the aging report - anyone who needs overdue invoices chased consistently and on schedule, with a clear record and a human firmly in control of every send.
You've got this - paste the first prompt and let the agent interview you.