Inspiration
Chasing a late invoice is a small job that eats a lot of time. You send a reminder, the customer says "I'll pay next week", you note it somewhere, and a week later you check three places to learn whether anything happened. Some customers say they paid when they have not. Some dispute the amount and need a human, and a template reminder only makes that worse. I wanted something that handles the reading and the checking and leaves the decisions to the person who owns the invoice.
What it does
Tallyo is an overdue-invoice dashboard built around PayPal.
- Shows what is really paid. Every invoice shows how late it is, and whether payment was confirmed by PayPal or only marked as paid by hand. The two are never mixed up.
- Reads customer replies. "I'll pay in two days" becomes a recorded promise with a date. "I already paid" triggers a real PayPal check. "The total is wrong" pauses chasing and flags the invoice for a person. A request for a payment plan goes to the owner, because that is not a decision for software.
- Drafts the follow-up. The draft opens in an editor, and one click opens it in Gmail with recipient, subject and message filled in. There is also a mail-app button and a copy button. Tallyo never sends an email itself.
- Has a chat agent inside the dashboard that answers questions about the data, builds widgets, drafts reminders and checks PayPal.
How I built it
PayPal. Invoices are created and sent through the PayPal Invoicing API in the Sandbox. Payments are detected by a signed webhook (verified against PayPal's signature) and by a manual sync. Either way the invoice is read again from PayPal before anything is recorded, and a payment only counts as verified when PayPal reports a transaction made through PayPal.
AI. Gemini reads each customer reply and returns structured JSON (what the customer wants, any promised date, a one-line summary, a draft answer), and it powers the chat agents. The model only describes. Plain code decides what happens, so a confusing or hostile message cannot mark an invoice paid or change an amount. The Gemini key stays on the server.
AG Studio. The dashboard is a single AG Studio component fed by related tables. I wrote a custom widget ("Who still owes you"), custom cell renderers for the payment check and action columns, a theme and a four-page report. For the Agent Framework I wrote an adapter that sends each turn through my own server to Gemini, and added a custom agent with three tools of its own (read new replies, draft a reminder, check PayPal) next to Studio's built-in agents.
The rest. React, TypeScript and Vite on the front; Node, Express and SQLite behind it.
Challenges
- The model invented data. An early chat agent answered "who is always late?" with customers and amounts that did not exist, because a helper agent's lookup had failed and the lead agent filled the gap. A stronger model for the agents fixed the lookup, and the lead agent now says so when a helper fails instead of guessing.
- Gemini 3 tool-call signatures. The API wants a "thought signature" for every earlier tool call, and some of Studio's history has none stored, so I send Google's documented placeholder.
- Free-tier overload. Gemini sometimes hangs or returns 503, so the server times out and falls back to another model.
- Draft quality. Early reminders declined a payment plan on the owner's behalf and claimed to be "checking bank records". I tightened the rules until drafts stopped deciding things or claiming actions.
Accomplishments I'm proud of
- The line between what the AI reads and what the code decides. A customer who says "I paid" gets a PayPal check, not a green tick.
- A real Sandbox payment showing up as "PayPal verified" with its transaction ID, and the webhook doing the same with nobody pressing a sync button.
- A dashboard whose look comes from the thing it replaces, an accountant's aging report, instead of a template.
What I learned
Free-tier models handle one-shot jobs well and struggle with long tool definitions, so model choice for an agent matters more than I expected. Hostile or confusing customer text is a normal input for this product, which is why the model never gets to act on it directly.
What's next
Connect a real inbox, reminder schedules that pause on a promise and resume when it is missed, multiple businesses and accounts, partial payments and refunds through PayPal, and a hosted demo.
Built With
- ag-grid
- ag-studio
- express.js
- google-gemini-api
- node.js
- paypal-invoicing-api
- paypal-sandbox
- paypal-webhooks
- react
- sqlite
- typescript
- vite