Inspiration
I wanted to explore how AI could do more than just answer questions. What if it could actually help someone complete a real business task?
Invoicing felt like an interesting place to start. For small businesses and freelancers, creating invoices can become repetitive, and it's surprisingly easy to overlook an existing invoice or accidentally bill someone twice.
That's where the idea for PayPilot AI came from.
I wanted to build something where you could simply describe an invoice in everyday language, let AI handle the preparation, and still have complete control over what happens next.
What it does
PayPilot AI is a conversational invoice assistant that connects Google's Gemini with PayPal Sandbox.
Instead of filling out multiple fields manually, users can type something like:
"Create an invoice for two hours of AI consulting at $25 per hour."
PayPilot extracts the invoice details, validates them, and generates a preview for approval.
But I didn't want it to be just another AI-powered form.
Before creating an invoice, PayPilot also checks available PayPal invoice history for potential duplicates and unusually large amounts.
For example, during testing, PayPilot examined six historical invoices and detected a possible duplicate for a $50 invoice.
Rather than automatically proceeding, it displayed a warning and let me decide whether to approve or cancel.
The goal is simple: let AI handle the repetitive work while keeping people in control of financial actions.
How we built it
I built the frontend using React and Vite, with a FastAPI backend written in Python.
Google Gemini handles natural-language invoice extraction, while Pydantic validates the generated invoice details.
For payment integration, I connected the backend to the PayPal Sandbox Invoicing API, allowing users to create and retrieve draft invoices.
I also built an Invoice Intelligence layer that uses transparent, rule-based checks against available historical invoices.
For reliability, I implemented server-side approval records, expiration handling, idempotent requests, API rate limiting, and safeguards against repeated approvals.
The application is deployed using Render, with Neon PostgreSQL supporting shared approval and quota storage.
Challenges we ran into
One of the biggest challenges was making the integration reliable.
Working with external APIs meant handling timeouts, inconsistent responses, retries, and situations where an invoice might have been created even if the initial response wasn't received successfully.
Another challenge was deciding how much control AI should have.
Generating invoice details is useful, but allowing AI to create financial records without confirmation introduces unnecessary risk.
That's why I designed the workflow around explicit human approval.
Detecting duplicates was also more complicated than I initially expected. Legitimate recurring invoices can look identical, and historical information isn't always complete.
I built a separate challenge dataset to evaluate these limitations rather than assuming the detection rules were perfect.
Accomplishments that we're proud of
• Built and deployed a working end-to-end AI and PayPal Sandbox integration.
• Implemented conversational invoice preparation with mandatory human approval.
• Added duplicate and unusual-amount detection using historical invoice data.
• Built automated tests and reproducible evaluation datasets.
• Evaluated the rule-based checks on 1,000 rule-aligned synthetic examples and 16 more challenging scenarios, achieving 75% accuracy on the latter.
• Open-sourced the project with documentation and a working demonstration.
What we learned
This project taught me that building an AI application isn't just about integrating a language model.
The challenging part is making the entire workflow reliable, understandable, and safe when multiple systems interact.
I also learned how important it is to handle incomplete information, validate AI-generated outputs, and design around failures rather than assuming every API request will succeed.
What's next for PayPilot AI
I'd love to expand PayPilot AI with better recurring-invoice awareness, stronger business-context checks, improved invoice management, and more robust user authentication.
For now, PayPilot AI demonstrates how conversational AI and PayPal can work together to make invoicing simpler, while keeping human approval at the center.
PayPilot AI is open source, deployed, and runs entirely in PayPal Sandbox.
Built With
- fastapi
- gemini
- javascript
- neon
- paypal
- postgresql
- pydantic
- pytest
- python
- react
- render
- restapi
- vite