Inspiration## Inspiration

Small businesses lose time creating invoices, chasing payments and handling refunds. I wanted to see what happens when an AI agent operates PayPal for you, but with a human firmly in control of any money leaving the account.

What it does

Type something like "Bill Acme Co $450 for logo design and 2 revisions at $45, 8% tax" and the AI agent turns it into an itemized PayPal checkout. After the buyer pays, the app captures the payment and the AI writes a personalised receipt. You can also ask "what is outstanding?" or "who are my top customers?" and the agent answers from the live ledger. A dashboard shows revenue, a 14-day chart and the ledger. Refunds are only requested by the agent and stay in an approval queue until a human clicks Approve.

How I built it

Node.js and Express backend, a vanilla JS front end, and an AI agent using function calling (Google Gemini free tier through its OpenAI-compatible API) with five tools: create_checkout, list_payments, check_payment_status, request_refund and revenue_summary. PayPal is the payment rail: OAuth, Orders v2 (create, get, capture) and Payments v2 (refund).

Safety design

  • The model never does the money math: the server computes totals in integer cents.
  • A spending cap blocks oversized checkouts.
  • The agent cannot execute refunds; a human must approve, and approvals cannot be replayed.

IMPORTANT DISCLOSURE

I could not create a PayPal developer account before the deadline because PayPal's phone verification failed repeatedly. The demo video therefore runs in a clearly labelled simulation mode (PAYPAL_MOCK=1) that fakes PayPal's responses locally. The real PayPal integration is in lib/paypal.js and is tested against a mock of PayPal's API, but it has not been verified against the live sandbox. Running the app with sandbox keys and without PAYPAL_MOCK uses the real PayPal APIs.

Challenges

Handling model overload errors (automatic retries and fallback models), keeping the agent from being trusted with money math, and building a safe human approval step for refunds.

What's next

Verify against the live PayPal sandbox, add webhooks, authentication and a real database.

Share this project:

Updates

Submission history