Inspiration

When we looked at how freelancers manage their invoices, we noticed something simple: creating an invoice is not particularly difficult, but everything around it takes time.

You need to remember client details, look up previous rates, calculate totals, decide payment terms, send invoices, and follow up when payments are late. Most of this is repetitive work.

AI seemed like a natural way to simplify the process. A freelancer should be able to say something like, "Create an $800 invoice for Acme Corp for the website redesign, due in 14 days," and have most of the work done automatically.

But we had one concern.

We didn't want an AI agent making financial decisions or sending invoices without the user's knowledge. Even a small mistake in an amount or client detail can create a real problem.

So we decided to build InvoicePilot: a billing assistant that makes invoicing easier with AI while keeping the user in control of every important action.

What it does

InvoicePilot helps freelancers prepare, approve, send, and track invoices through a conversational interface.

Here's how a typical interaction works:

  • A freelancer describes the work and amount in plain English.
  • Claude understands the request and prepares an invoice using the available client information and previous rates.
  • The application calculates the totals, validates the details, and presents the invoice for review.
  • The freelancer checks the information and approves it.
  • InvoicePilot verifies that the approved invoice hasn't been modified and then sends it through PayPal.
  • The freelancer can track payment status and prepare reminders for overdue invoices.

The important part is that Claude never gets direct access to the operation that sends invoices. It can prepare and suggest, but the actual financial action requires approval from the user.

We also built an audit view so users can see what happened at each stage, including approval decisions, verification failures, and PayPal API responses.

How we built it

We wanted to keep the AI logic separate from the parts of the application that deal with money.

Frontend

We used Next.js 15, React 19, TypeScript, and Tailwind CSS. The interface includes a conversational workspace, financial summary cards, an invoice table, and an approval flow.

AI integration

We integrated Claude 3.5 Sonnet using the Anthropic SDK.

Instead of giving the AI unrestricted access to the application, we provided a limited set of tools. These allow it to look up clients, prepare invoice proposals, retrieve invoice information, check payment status, and draft reminders.

The AI cannot directly send an invoice or execute a payment-related action.

Approval and security

This was one of the most important parts of the implementation.

When Claude prepares an invoice, it is saved as a proposal that requires user approval.

We generate a canonical JSON representation of the invoice and calculate its SHA-256 hash. When the user approves it, the backend verifies the invoice against the original snapshot before allowing the PayPal operation.

We also implemented approval state management, single-use approvals, validation rules, and safeguards against duplicate execution.

PayPal integration

We integrated directly with the PayPal Invoicing API v2 using REST APIs.

The application handles OAuth 2.0 authentication, invoice creation, sending, invoice retrieval, and payment-status checks. We also use PayPal request IDs for idempotency.

The integration is tested using PayPal Sandbox, so we can work with actual PayPal invoice workflows without processing real customer payments.

Database

We used SQLite with Prisma ORM to manage users, clients, invoice proposals, invoices, approval records, audit events, and PayPal API logs.

Challenges we ran into

The integration was not as straightforward as we initially expected.

One of the first issues was with PayPal Sandbox permissions. Our initial sandbox business account returned a 403 NOT_AUTHORIZED response when calling the Invoicing API. After investigating the account configuration, we switched to a US-region sandbox business account and enabled the required invoicing capability.

We also encountered differences in how PayPal returns invoice information. The invoice creation response does not always expose the invoice ID in the same place, so we had to account for both the response body and the Location header.

Another challenge was making sure the invoice could not change between approval and execution. We addressed this by implementing a canonical JSON serializer and SHA-256 verification on the backend.

We also avoided JavaScript floating-point calculations for financial values. All invoice amounts are handled in integer minor units (cents), which makes calculations and validation more predictable.

These problems helped us understand that building an AI-powered financial application requires much more than connecting an LLM to a few APIs.

What we're proud of

There are a few things we're particularly happy with.

  • Actual PayPal integration: We connected the application to PayPal Sandbox and implemented real invoice creation, sending, and payment-status retrieval rather than relying entirely on mocked responses.
  • AI with clear boundaries: Claude can understand requests and prepare invoices, but it cannot independently send them.
  • Invoice integrity checks: We can deliberately modify an invoice proposal and demonstrate how the backend detects the change and refuses execution.
  • Audit visibility: Users can inspect approval events, verification failures, and PayPal API activity.
  • Automated testing: We built four test suites covering unit tests, AI tool behaviour, security checks, and REST API workflows, with more than 60 test cases.

For us, the most interesting part is not simply generating an invoice with AI. It's making sure that the application behaves predictably when AI is involved in a financial workflow.

What we learned

Working on InvoicePilot gave us a better understanding of where AI agents are useful and where they need boundaries.

Claude is good at understanding natural language and extracting information, but calculations, date handling, approval checks, and financial execution should remain under deterministic application logic.

We also learned a lot about PayPal's Invoicing API, OAuth authentication, idempotency, invoice lifecycle management, and the importance of maintaining a reliable audit trail.

Most importantly, we learned that adding human approval shouldn't be an afterthought in financial applications. It should be part of the architecture from the beginning.

What's next for InvoicePilot

We started with invoicing, but there is room to make this much more useful for freelancers.

Some of the improvements we'd like to work on next are:

  • Multi-currency support: Help freelancers manage invoices across different currencies and understand conversion amounts.
  • Milestone-based invoicing: Prepare invoice proposals when project milestones are completed, using integrations with tools such as GitHub and Figma.
  • Expense management: Extract information from receipts and help freelancers organize expenses alongside their invoices.
  • Smarter payment follow-ups: Help freelancers manage overdue payments with context-aware reminders.

Our goal is to make managing invoices feel less like administrative work and more like having a useful assistant who understands your business.

InvoicePilot brings AI into everyday billing, without taking control away from the person running the business.

Built With

Share this project:

Updates

Submission history