Inspiration
Late payments and unpaid invoices are a major challenge for businesses, especially small businesses that depend on predictable cash flow to operate and grow.
Following up with customers, identifying which overdue invoices deserve attention, and managing payment requests can become repetitive and time-consuming. I wanted to explore how AI could help businesses become more proactive about recovering revenue without taking control away from the people running them.
That idea inspired PayPal Autopilot: an AI-assisted revenue recovery platform that helps businesses identify outstanding revenue, prioritize recovery opportunities, and take action through PayPal, while keeping important financial decisions under human control.
Full project description
Small businesses spend valuable time tracking unpaid invoices, calculating outstanding balances, deciding which customers need follow-up, and checking whether payment requests have resulted in payment.
PayPal Autopilot turns this work into a structured revenue-recovery workflow. It analyzes overdue invoices and recorded partial payments, uses an AI provider to generate recovery opportunities and recommended actions, and presents those recommendations for review by an authorized business owner or administrator.
The application keeps financial actions under business control. An authorized user reviews and approves a recommendation, checks execution eligibility, and separately confirms execution. The backend revalidates business access, approval state, invoice status, and outstanding balance before initiating the supported PayPal payment-request workflow. Execution records and PayPal webhooks support status tracking and reconciliation.
AI recommendations are advisory; the backend enforces authorization and execution. The project is a hackathon MVP demonstrated with PayPal Sandbox, not a production financial service.
Solution and key features
- Analyzes outstanding invoices: Uses AI to evaluate invoice and payment context and identify potential recovery opportunities.
- Prioritizes opportunities: Presents recommended recovery actions and estimated recovery amounts to help businesses focus their efforts.
- Supports human approval: Allows authorized business owners and administrators to review, approve, or reject proposed actions before execution.
- Integrates with PayPal: Creates and sends PayPal invoice payment requests for eligible, approved recovery actions.
- Tracks execution: Records execution attempts and their outcomes.
- Synchronizes payment events: Uses PayPal webhooks to receive invoice and payment updates and reconcile the application's records.
The goal is to make revenue recovery more organized, intelligent, and accountable.
What makes the project useful or different?
The project combines AI-assisted recommendations with a controlled execution workflow. Instead of allowing an AI recommendation to trigger a financial action automatically, it requires business-level authorization, a fresh server-side eligibility check, and a separate explicit execution step. This makes the AI useful for prioritization while keeping consequential actions under human and backend control.
How i built it
I built PayPal Autopilot using a full-stack architecture.
Backend
- NestJS 11 and TypeScript for the API and business logic.
- PostgreSQL for persistent application data.
- Prisma 7 for database access and schema management.
- JWT-based authentication and business membership checks for access control.
Frontend
- Next.js 16 and React 19.
- Tailwind CSS 4 for styling.
- A dashboard for revenue analysis, opportunities, approvals, and execution tracking.
AI integration
I implemented a provider-based AI integration that supports Ollama and OpenAI configurations. During our demonstration, i used Ollama with the gpt-oss:20b model to analyze invoice context and generate structured revenue recovery recommendations.
PayPal integration
I integrated PayPal APIs to support invoice payment request creation and sending. I also implemented webhook signature verification, event processing, duplicate-event protection, and payment-status synchronization.
A key architectural decision was to keep AI recommendations separate from financial execution. The AI can recommend an action, but the backend independently validates permissions, approval status, invoice eligibility, and outstanding balances before allowing execution.
Challenges I ran into
One of our biggest challenges was handling the differences between PayPal webhook payloads.
Invoice events and payment capture events do not always follow the same response structure. I had to account for different resource types, nested invoice information, payment amounts, and status transitions without assuming every event would contain the same fields.
Also I could not update invoice and initiate a partial payment event which led to changing the flow
I also had to think carefully about duplicate webhook deliveries. Processing the same event more than once could create inconsistent records or duplicate actions, so i implemented signature verification, event tracking, idempotency safeguards, and processing-state management.
Another challenge was designing a responsible AI workflow for financial operations. I did not want an AI model to make financial decisions or execute actions without authorization. I addressed this by introducing role-based approval, server-side eligibility checks, and explicit execution steps.
Finally, integrating and testing the complete workflow across the AI provider, backend, frontend, database, and PayPal Sandbox required careful coordination.
Accomplishments that we're proud of
I am proud to have built a working end-to-end revenue recovery workflow rather than just an AI chatbot or a static dashboard.
Our accomplishments include:
- Building an AI-powered invoice analysis and revenue opportunity engine.
- Supporting configurable AI providers.
- Integrating PayPal invoice payment request creation and sending.
- Implementing role-based approval workflows for business owners and administrators.
- Adding server-side execution eligibility checks.
- Implementing PayPal webhook signature verification and duplicate-event protection.
- Building execution tracking and reconciliation capabilities.
Most importantly, i successfully demonstrated the complete local workflow: authentication, AI revenue analysis, opportunity review, approval, eligibility validation, and execution through PayPal Sandbox.
I am particularly proud of the balance between AI-assisted automation and human accountability.
What I learned
This project taught me that building AI-powered financial software requires much more than connecting an application to a language model.
AI recommendations must be structured, validated, and treated as advisory rather than automatically trusted. Financial operations also require strong authorization, clear approval processes, idempotency, reliable event handling, and accurate state management.
I gained deeper experience working with PayPal APIs and webhooks, designing reliable backend workflows, integrating AI providers, and connecting frontend experiences to complex business processes.
I also learned that automation is most valuable when users can understand what the system is recommending and remain in control of what happens next.
What's next for PayPal Autopilot
I see PayPal Autopilot evolving into a more comprehensive AI-assisted accounts receivable and revenue recovery platform.
Our next priorities include:
- Smarter recovery recommendations: Improve opportunity ranking using historical payment behaviour, invoice age, customer context, and recovery outcomes.
- Automated reminders: Introduce configurable customer follow-up notifications and reminder schedules.
- Improved recovery analytics: Track recovery rates, outstanding balances, successful payment requests, and revenue recovered over time.
- More intelligent workflows: Support configurable approval policies and recovery strategies for different businesses.
- Production readiness: Strengthen monitoring, audit logging, security, error recovery, and operational reliability.
- Expanded integrations: Explore additional accounting and business finance integrations.
My long-term vision is simple: help businesses spend less time chasing payments and more time growing, while ensuring that important financial actions remain transparent, secure, and under human control.
PayPal Autopilot — AI-powered revenue recovery, with humans in control.
Built With
- git
- github
- nest
- nestjs
- nextjs
- node.js
- ollama
- openai
- paypal
- postgresql
- postman
- react
- typescript