-
-
Authentication screen with demo auto-fill and clean branding.
-
Main dashboard with real-time cash flow stats, status tabs, and invoice list.
-
Natural language prompt input showing Google Gemini invoice extraction.
-
Single invoice view showing PayPal Invoice ID, direct Sandbox payment link, and send/reminder buttons.
-
Immutable audit history tracking every action, actor, timestamp, and IP address.
-
Policy configuration page showing $10,000 threshold, duplicate detection, and cooling-off reminder limits.
Inspiration
Freelancers lose hours every month on billing: drafting invoices, chasing late payments, and writing awkward reminders. Chatbots can write text, but nobody should let an AI model send invoices or decide what counts as "paid". We wanted an agent that removes the busywork while keeping a human and PayPal in control of the money.
What it does
FinPilot lets a freelancer type a plain sentence like "Bill Acme Corp $1,500 for brand guidelines, due in 2 weeks." The AI turns it into a structured invoice draft. A policy engine checks it (amount limits, duplicate detection), the freelancer reviews and explicitly approves it, and FinPilot creates and sends a real invoice through the PayPal Invoicing API (sandbox). It then tracks payment, drafts tone-adaptive reminders (gentle, firm, urgent), and marks an invoice as paid only after PayPal confirms it.
Our core principle: AI proposes. Code and PayPal decide.
How PayPal is used
| FinPilot step | PayPal capability |
|---|---|
| Create the invoice | Invoicing API: create draft invoice |
| Send to the client | Invoicing API: send invoice, with a payer payment link |
| Track status | Invoicing API: show invoice details |
| Follow up on unpaid invoices | Invoicing API: send reminder |
| Detect payment | Webhooks (INVOICING.INVOICE.PAID) with signature verification |
PayPal is the source of truth. When a payment webhook arrives, we verify its signature, then re-fetch the invoice from PayPal and mark it paid only if PayPal confirms the status is PAID and nothing is left due. This matters because the paid event can also fire for partial or pending payments.
How we built it
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Backend: Node.js, Fastify, Prisma with SQLite, Zod validation. It owns the state machine (PROPOSED, APPROVED, CREATED, SENT, PAID or OVERDUE), the policy engine, an append-only audit log, and all PayPal calls.
- AI service: a separate Python service (FastAPI, Pydantic) using Google Gemini ([gemini-3.1-flash-lite]). It has only two jobs, parsing text into invoice items and drafting reminders. It has no access to PayPal, the database, or any payment action.
- Safety by design: the backend validates every AI response against a strict schema, the AI cannot trigger any state change, and nothing is sent without an explicit approval click. If the AI service is unavailable, the backend falls back to a deterministic mock service.
- We used Google Antigravity as an AI coding assistant for the web application, and wrote and tested the AI service ourselves.
Challenges
- Making AI output safe to build on: users' text is untrusted (including prompt-injection attempts), so we validate in code, never guess missing fields, and flag them for the user.
- PayPal's paid webhook can fire for partial or pending payments, so we added a mandatory re-fetch before marking anything paid.
- Handling duplicate webhook deliveries without duplicating state changes or audit entries.
- Keeping reminder behavior inside policy limits (maximum reminders and a cooldown between them).
What we learned
Trustworthy financial agents come from a clear split of responsibility: the model handles language, deterministic code handles rules, and the payment platform handles truth. Testing the failure paths mattered more than testing the happy path.
What's next for Finpilot
Recurring invoices, multi-currency support, an accounting export, and a dashboard that predicts which invoices are likely to be paid late. Everything runs in the PayPal sandbox, and FinPilot has not been used with live money.
Built With
- fastapi
- fastify
- google-gemini
- nextjs
- node.js
- paypal-invoicing-api
- paypal-webhooks
- prisma
- pydantic
- python
- react
- sqlite
- tailwindcss
- typescript
- zod