PayPal Envelope

Give your AI agent a budget, not your wallet.

Inspiration

AI agents are getting good at shopping, but paying is still the hard part. You either hand the agent your card and hope nothing goes wrong, or you approve every step yourself and save almost no time.

We remembered the old habit of putting cash into labelled envelopes and asked: what if an AI agent got its own envelope of money for one job, with rules it can't break?

Shops have a new problem too. Agents buy at machine speed, so a price typed wrong can sell out in minutes. That's why we also built PayPal Counter, which shows shops which sales came from AI agents.

What it does

You type something like "Buy headphones under $100 before Friday."

  1. AI turns it into rules: budget, per-item limit, allowed shops and an end date.
  2. Exactly that amount moves from your PayPal into the envelope.
  3. The agent compares stores, checks 90-day price history and reads the live price.
  4. Plain code, not the AI, approves or blocks every purchase.
  5. When the envelope closes, unspent money returns to your PayPal.

There are three kinds of envelope: Shopping, Bill pay and Savings.

How we built it

PayPal (Checkout, Pay Later, Vault, Invoicing, Subscriptions, Payouts) moves every cent. The stack is TypeScript with PostgreSQL + Prisma, plus Channel3, Kernel, Elastic, AG Grid, Bryntum, APIMatic, Zapier and Render, covered by 86 unit tests.

What we learned

  • Never let AI make the final call on money. AI drafts the rules; testable code enforces them.
  • Transparency builds trust. A live activity log, a reason for every block and Verified by PayPal checks made the agent feel safe.
  • Limits are a feature. A spending ceiling, an allowed-shop list and an end date make autonomous spending something people are comfortable handing off.
  • PayPal goes far beyond a checkout button. Combining its APIs gave us a complete flow of money.
  • Agentic commerce affects both sides. Shops need tools to spot agent sales and pricing mistakes too.

Challenges we faced

1. Preventing overspending

AI agents buy at machine speed, so two purchases could hit one envelope at the same moment and both pass the balance check. We stored the ledger in whole cents, made every balance change a locked database transaction, and tested it with ten purchases fired at once.

2. Free-tier quotas

Gemini, Channel3 and Elastic all run on free quotas that a burst of testing could use up. We added automatic fallbacks: when one Gemini model hits its limit, the app switches to the next, so the demo keeps working.

Built With

Share this project:

Updates

Submission history