Inspiration
In India every shop once had a munim, the accountant who kept the ledger and knew exactly who owed what. Today's freelancers and five-person studios have no munim. They retype invoices from WhatsApp chats, put off awkward payment reminders, and can't tell whether the rent money will be there on the 30th. Late invoices quietly turn into write-offs.
What it does
Munim is the finance employee a small business can't afford to hire, built on PayPal.
- Invoice. Paste an email, a WhatsApp chat (Hindi and Hinglish work) or type "bill Dan $1,200 for October maintenance". Munim pulls out the client, line items, currency and due date, matches the client to someone it already knows, and shows an editable preview. One click on Approve & send via PayPal creates and sends a real PayPal invoice.
- Collect. Every run, Munim scores each open invoice for risk (how late, how big, how that client has paid before) and picks one action: wait, a gentle reminder, a firm reminder, offer a part-payment, or flag it to you. The model proposes, code decides: guardrails cap reminders per invoice, keep a gap between them, respect PayPal's two-reminders-a-day limit, skip weekends and send anything above a threshold to an approval queue with its reason.
- Forecast. Munim learns each client's habits from what they actually paid and projects your balance day by day, next to a second line showing what happens if nobody chases. The gap between the lines is what the reminders are worth.
- Command centre. An AG Studio dashboard with Munim's live widgets ("Munim today" and an approval queue you can act on), the cash forecast, risk per invoice and overdue amounts by client.
- Live updates. PayPal webhooks (signature-verified) update an invoice's timeline and the client's profile within seconds of a payment.
How we built it
- Next.js 16 + React 19 + TypeScript, deployed on Vercel, with Prisma 7 + Postgres for client profiles, actions, runs and an API log.
- PayPal Invoicing v2: next invoice number, create, send, remind, get, list, full update and cancel. PayPal Webhooks with
verify-webhook-signature. PayPal Reporting: balances (the forecast's starting point) and transactions. OAuth client credentials with every call, token included, written to an API log with itsdebug_id. - Google Gemini via the Vercel AI SDK for reading messages (structured output checked against a zod schema), choosing one action per invoice and writing the reminder text and run summary. With no key, the same pipeline runs on rules.
- AG Grid for the editable invoice line items, the activity log (custom badge renderers, quick filter) and the invoices grid with a timeline side panel. AG Studio for the dashboard, with two custom widgets and Munim's data as Studio data sources.
- Idempotency keys on every PayPal write, so a double click never sends two invoices.
Challenges we ran into
- PayPal's shapes are subtle. Part-payment lives at
configuration.partial_payment.allow_partial_payment, notconfiguration.allow_partial_payment. A full PUT emails the client unless you turn that off. When PayPal refuses to update a sent invoice, Munim creates a replacement with part-payment allowed, cancels the original and sends the replacement, in that order, so the client is never left with nothing to pay. - Permissions and token caching. Enabling Transaction Search on the sandbox app didn't take effect, because PayPal kept returning the cached 9-hour token with the old scopes. A fresh app fixed it.
- Webhooks.
INVOICING.INVOICE.PAIDalso fires for part-payments and pending payments, so Munim re-reads the invoice and records one payment per paid amount. The route answers 200 at once and verifies afterwards, and unverified events change nothing. - Free-tier AI capacity. One Gemini model returned "high demand" errors, so we tested the free models and picked one that answers reliably.
Accomplishments that we're proud of
- A Hinglish WhatsApp message ("bhai 2 logo variations aur ek banner bana do, total 15000, payment next friday tak") becomes a correct PayPal invoice in one click.
- Every decision Munim makes is saved with a one-sentence reason and the name of any guardrail that changed it, so you can always see why it acted.
- It runs end to end on real PayPal sandbox accounts, live on Vercel.
What we learned
Letting an AI write the message is easy. Letting it act on someone's money safely is the real work: the model should propose, and plain code with clear limits should decide.
What's next for Munim
UPI and GST-ready invoices for Indian businesses, reminders sent over WhatsApp, multi-currency forecasts, and moving from the sandbox to live PayPal accounts.
Built With
- ag-grid
- ag-studio
- google-gemini
- next.js
- paypal
- paypal-invoicing-api
- paypal-reporting-api
- paypal-webhooks
- postgresql
- prisma
- react
- typescript
- vercel
- vercel-ai-sdk
- zod