-
-
Rejection sends nothing at PayPal end.
-
Approval can only be one by Manager role.
-
Harmful queries are effectively blocked.AI only queries the view . No data-tables or data is sent to AI.
-
Ask question to AI . AI answers within seconds with SQL generated and output table shown.
-
Timeline shows all payment activities. Proposal, approval and payment
-
Dashboard depicting KPIs and filterable status.
-
On refresh of status from PayPal, invoices gets updated.
Inspiration
At work, I helped build AI for sales orders and purchase orders. It showed me how much faster people move when they can simply ask a question. The payment side was still manual: working out who owes money and writing reminders by hand. So I built the same kind of helper for payments, with one strict rule. The AI never sees the data. It only sees the question and the column names, writes a query, and the app runs that query privately in its own database. A person approves every action before anything reaches PayPal.
What it does
DuePilot helps a small business get paid faster, with a person in control at every step.
- Ask in plain English. "Who owes me the most money?" The AI writes a database query, a safety check validates it, and the answer appears in a table. A "How the AI found this" panel shows the exact query.
- Chase. "Chase the 3 most overdue invoices" turns late invoices into proposals: send a reminder, or send a draft invoice. Each comes with a message whose tone matches how late the invoice is. Nothing is sent yet.
- Approve. A manager approves or rejects each proposal. Approving creates and sends a PayPal invoice in the sandbox, or sends a reminder when the invoice already exists in PayPal.
- Get paid. The client pays on PayPal's invoice page. One click refreshes the status, the invoice turns Paid, and the payment is recorded.
- See everything. An activity timeline shows every proposal, decision and payment.
How we built it
DuePilot is an ASP.NET Core (C#) minimal API with a SQLite database, and a page built with Bootstrap and plain JavaScript.
- PayPal: the Invoicing REST API in the sandbox. The app gets an access token, creates and sends invoices, sends reminders, and reads each invoice's status and pay link.
- AI: Google Gemini turns a question into a database query. It receives only my instructions, which include the column names of one read-only view, and the question. It never receives invoice rows.
- Safety: every AI-written query is checked before it runs: one SELECT only, no comments, only that one view, every other table blocked, and it runs on a read-only connection with a row limit. The AI can only propose. Each proposal can be approved once, only an approved action calls PayPal, and every step is written to an audit log.
Challenges we ran into
- Keeping an AI that writes queries safe. I built a strict validator and tested it with attack queries, such as dropping tables, chaining commands and reading other tables.
- PayPal invoicing details. Invoice numbers must be unique, due dates must be valid, and the sandbox pay flow needs a separate buyer account. Getting sandbox access working in the first place also took several days.
- AI quotas. The free-tier quota ran out during testing, so I switched to a faster model with a bigger allowance.
Accomplishments that we're proud of
- The full loop works end to end: a plain-English question, proposals, a manager's approval, a real sandbox invoice, a payment, and a status update.
- Safety is part of the design, not an afterthought: a read-only query check, one-time approvals and a complete audit trail.
- It was built from scratch during the submission period, and it runs from a fresh clone using the README.
What we learned
An AI helper becomes trustworthy when it can only propose, a person decides, and every step leaves a record. Letting the AI write queries instead of reading data also keeps business data inside your own system.
What's next for DuePilot
- Real sign-in and roles, instead of the demo role switch.
- PayPal webhooks, so paid status updates by itself.
- More currencies.
- Carrying the approved message into newly created invoices as well as reminders.