-
-
Stage 01: The Billing Nightmare — manual calculations, unclear payment terms, and missing details create costly billing disputes.
-
Stage 02: The Freelancer Problem — scattered conversations, unclear scope, and unstructured agreements make billing difficult.
-
Stage 03: AI Billing Clarity — TrustFlow AI converts unstructured project briefs into verified invoice data with source-backed evidence.
-
Stage 04: PayPal Settlement — move from billing confusion to payment clarity with human-approved PayPal invoicing.
-
TrustFlow 3D Pipeline: Visualizing the journey from project brief to AI verification and PayPal invoice processing.
-
Freelancer Billing Workspace — track invoices, outstanding balances, collected payments, and overdue payments in one dashboard.
-
Integration Hub — connect PayPal Invoicing API v2 and Google Gemini to power intelligent, automated billing workflows.
-
AI Invoice Extraction — Gemini identifies project details, line items, amounts, and payment terms directly from the original brief.
-
Source Evidence Verification — every extracted invoice amount is linked to its original quote for transparent validation.
-
Live Integration Status — successfully authenticated PayPal Sandbox and connected Gemini AI for invoice processing.
-
Invoice Dashboard — monitor draft, paid, outstanding, and overdue invoices with payment status synchronization.
Inspiration
Freelancers often spend more time figuring out what a client actually agreed to than doing the work itself. Project details are scattered across WhatsApp messages, emails, PDFs, and voice notes. Prices change during discussions, deliverables get added, and sometimes the final invoice doesn't even match the original agreement.
I wanted to solve this everyday problem. Instead of building yet another invoice generator, I decided to build an AI-powered billing copilot that understands the context behind an invoice and helps freelancers avoid costly misunderstandings before sending it to a client.
What it does
TrustFlow AI transforms unstructured client conversations and project briefs into structured, verifiable invoices.
Its key capabilities include:
- AI-powered brief extraction: Uses Google Gemini to identify clients, deliverables, line items, prices, payment terms, and other important details.
- Scope intelligence: Highlights ambiguous or unpriced requirements instead of silently inventing prices for them.
- Billing verification: Detects mathematical inconsistencies between quoted project fees and individual line items.
- Human approval: Keeps the freelancer in control of invoice approval rather than automatically committing to uncertain information.
- PayPal integration: Supports invoice creation, sending, and status synchronization through PayPal's Invoicing API.
- Webhook synchronization: Processes PayPal invoice events and verifies webhook signatures to keep invoice statuses synchronized.
- Payment reminders: Generates polite, context-aware reminder drafts without automatically sending emails.
How we built it
I built TrustFlow AI using Next.js, TypeScript, Tailwind CSS, and Prisma.
Google Gemini powers the extraction and understanding of unstructured project information. The extracted information is converted into structured invoice data, which is then passed through billing validation logic to identify pricing mismatches and potentially unclear scope.
For payments, I integrated PayPal's Invoicing API using its OAuth authentication flow. I also implemented webhook handling, event deduplication, signature verification, and invoice status reconciliation.
For data persistence, I moved beyond the initial local development setup and configured PostgreSQL using Neon. Prisma handles database access, while the application maintains invoice records, status history, and audit information.
I also built a dashboard and an interactive interface to make the entire workflow understandable rather than presenting users with just another complicated billing form.
Challenges we ran into
One of the biggest challenges was making AI extraction reliable enough for something as sensitive as money.
A client might mention a price in one message, add a deliverable in another, and clarify payment terms much later. Simply extracting text was not enough. I needed to preserve evidence and distinguish explicitly agreed information from assumptions.
Another challenge was handling ambiguous scope. The system needed to identify requirements that had no agreed price instead of assigning arbitrary amounts to them.
I also had to handle mathematical mismatches, PayPal invoice lifecycle events, duplicate webhook notifications, and secure webhook signature verification.
Finally, preparing the application for deployment involved moving from local database development to PostgreSQL and making sure production-specific safeguards were in place.
Accomplishments that we're proud of
I'm particularly proud that TrustFlow AI goes beyond generating invoices.
- Built an AI-powered workflow that turns unstructured client briefs into structured invoice information.
- Implemented evidence-aware extraction and validation.
- Added detection for pricing inconsistencies and ambiguous scope.
- Integrated PayPal's invoice lifecycle with webhook-based status synchronization.
- Implemented safeguards to prevent certain destructive or demo-only operations in production.
- Added audit trails and invoice status history.
- Successfully deployed the application using Vercel with a Neon PostgreSQL database.
Most importantly, I built the project around a simple principle: AI should help freelancers make better billing decisions, not make financial commitments on their behalf.
What we learned
This project taught me that building an AI application is not just about connecting an LLM to a user interface.
For real-world workflows, reliability, validation, traceability, and user control matter just as much as the AI model itself.
I learned how to integrate Gemini into a structured application workflow, work with PayPal's APIs and webhooks, manage database transitions with Prisma, and prepare a full-stack application for deployment.
I also learned that sometimes the most valuable AI feature is knowing when information is missing or uncertain rather than confidently generating an answer.
What's next for TrustFlow-AI
I want to take TrustFlow AI beyond invoice generation and make it a complete billing intelligence assistant for freelancers and independent professionals.
Some of the next improvements I envision are:
- Better support for voice notes, PDFs, email threads, and multiple conversation sources.
- More advanced tracking of scope changes throughout a project's lifecycle.
- Stronger client-side approval and agreement workflows.
- Production-ready PayPal integration and payment reconciliation.
- Automated but user-controlled payment follow-ups.
- Multi-workspace support and collaboration for freelancers working with multiple clients.
The long-term vision is simple: freelancers should focus on delivering great work, while TrustFlow AI helps make sure the business side of that work stays clear, fair, and organized.
Built With
- api
- gemini
- generative
- neon
- next.js
- paypal
- postgresql
- prisma
- react
- rest
- tailwind
- typescript
- web