Inspiration
What it does
How we built it
Challenges we ran into
Accomplishments that we're proud of
What we learned
What's next for Allowance
Inspiration
I look after family, and so do 63 million Americans (AARP and the National Alliance for Caregiving, 2025). AI agents can now shop for us, but nobody hands an agent their card: it can overspend, buy the wrong thing, or be fooled by a price that isn't real. The people who would gain most from an agent, an elderly parent or a teenager, often can't pay online on their own, and a PayPal account needs you to be 18.
So the question I wanted to answer was: how do you let an AI agent spend money for someone you love, without handing it your wallet? The answer families already use is an allowance.
What it does
Allowance gives an AI shopping agent an allowance instead of a card.
- The payer sets the rules in plain words, typed or spoken: "$60 a week for the home. Gifts up to $40 each. No candles or subscriptions." Claude turns them into structured rules.
- The payer connects PayPal once, in PayPal's own window (PayPal Vault). Allowance never sees a password.
- The payer invites the person they look after with a single-use link for their phone. There's no account to create: just what's left, and one big button to speak.
- They ask for what they need, by voice or text. The agent searches real shops through Channel3, compares the options and picks one.
- Plain code, not the AI, decides what happens to the money:
- Inside the rules: PayPal charges straight away, with no approval needed.
- Outside the rules (over a budget, a category no rule covers, or a price that looks too good to be true): nothing is paid. The payer gets a push notification and the request on their dashboard, sees why and every check, and approves or declines with one tap.
- Never: things on the never-buy list are refused with the reason.
- Every purchase is in the ledger: what was bought, why the agent chose it, which rules it passed, the PayPal order, and what's left of each budget. Refunds go back through PayPal.
While filming the demo, Channel3 returned a "power lift recliner chair" listed at $2 when the same chair costs about $500 elsewhere. Allowance caught it: "Much cheaper than similar products (typically $507.88). It may be a listing error." That's the kind of mistake an unsupervised agent would happily pay for.
How I built it
- PayPal, used the way an agent needs it:
- Vault v3: setup token, then payment token, using PayPal's JS SDK v6 save button.
- Orders v2: charges the vaulted account as a merchant-initiated payment (stored credential), so the agent can pay without the person being present.
- Idempotency: every charge carries a
PayPal-Request-Idequal to the purchase id, so a retry can never pay twice. - Refunds: go through Payments v2.
- Built on the official
@paypal/paypal-server-sdk.
- Claude Haiku 5.5 (Anthropic SDK tool runner) does three jobs:
- turns the rules into structure;
- files each request under a budget from the person's words alone, before any product is seen, so a product page can't move a purchase into a roomier budget;
- runs the shopping agent.
The agent has exactly two tools: search_products and buy(product_id). It never holds a payment tool, and it can only buy something it found, by id, so it can't invent a price, a shop or a link.
- The guard is ordinary TypeScript with no AI in it. It checks:
- price;
- shop link (it must go to the shop it claims);
- the never-buy list;
- the checkout price, re-checked with Channel3 right before paying;
- stock;
- per-item limits and the price named in the request;
- price sense, comparing with the same product elsewhere;
- weekly and monthly budgets;
- new shops and repeat purchases.
- Channel3 is the product search across real shops, and also provides the live price re-check and the comparison for price sense.
- Web Push sends approval notifications with Approve and Decline on them. It's a PWA, so it installs to the home screen.
- The stack: Next.js 16, React 19, TypeScript, and SQLite built into Node 24. Litestream copies every change to Backblaze B2 within a second, so data survives restarts on Render's free plan.
- Safety and cost controls:
- a strict Content Security Policy with a nonce;
- same-origin checks on every API call;
- rate limits per person and per IP;
- a daily and a lifetime cap on AI spend, and a monthly cap on Channel3 calls;
- push endpoints restricted to known push services (against SSRF);
- single-use, expiring invites.
- 88 automated tests, run in CI on every push.
Challenges I ran into
- The AI is clever about rules. It cleverly stays inside limits, which is good, until the only way to stay inside one is a listing error. That's why "price sense" exists, and why the guard runs its own unfiltered comparison: the agent's search had been capped at the budget, which hid normal prices.
- Words don't match. A never-buy rule for "candles" didn't catch "Scented Candle". Plurals now match, with tests.
- Categories drift. The model sometimes invented a new category ("clothing") instead of using the person's "home" budget, so spending didn't show against the budget. Requests are now filed under the person's own categories, and anything outside every budget is shown on its own line.
- PayPal setup on my side: a Tanzania merchant sandbox can't receive payments, so I moved to US sandbox accounts. A setup-token field clash taught me to read the Vault docs line by line.
- Hosting on a free plan without losing data, solved with Litestream.
Accomplishments I'm proud of
- A real agent buying real products with real PayPal sandbox payments, end to end. That includes merchant-initiated charges with no person present, proven idempotent.
- The AI proposes, and code disposes. Every decision is explained in plain words to the person paying.
- An interface an elderly parent can use: one number and one big button.
What I learned
Agentic commerce isn't a model problem; it's a trust problem. The model should be good at finding things, and something boring and testable should be in charge of the money. PayPal Vault and merchant-initiated payments are exactly the right primitives for that split.
What's next
- Shared budgets across several family members, and per-person limits.
- Spending reports for the payer, and alerts when a budget runs low.
- More shops, and receipts with delivery tracking.
- A pilot with families who care for an elderly parent.
Built With
- anthropic
- backblaze-b2
- channel3
- claude
- litestream
- next.js
- node.js
- paypal
- paypal-orders-v2
- paypal-vault
- react
- render
- sqlite
- typescript
- web-push