Inspiration

AI agents can now find and buy things for us, but the only way to let them pay today is to hand over a card or a login. That's all or nothing. People already know a better model from everyday life: an allowance with house rules. Leash brings that to agent payments.

What it does

You connect PayPal once and set plain rules: a monthly allowance, a per-purchase cap, an "ask me above" line, allowed categories, a daily purchase count and quiet hours in your own time zone. Then you give the agent an errand in plain language ("refill my printer ink, under $40"). The agent searches, proposes a cart, and Leash decides, deterministically and server-side, whether each line is paid, held for your approval or refused. Approved lines are charged through PayPal with no redirect, every charge lands in a live ledger, and anything can be refunded in one tap. You can revoke the leash at any time, which deletes the PayPal vault token.

How we built it

  • PayPal Vault v3: a setup token the payer approves once on PayPal, exchanged for a reusable payment token. No card numbers are ever stored.
  • Orders v2 merchant-initiated charges: each charge uses the vault_id with stored_credential (MERCHANT / UNSCHEDULED / SUBSEQUENT) and is captured.
  • Captures, refunds and token deletion. Every PayPal write carries a PayPal-Request-Id, so retries are idempotent.
  • The model only proposes listing IDs. Prices come from the catalog, never from the model or the browser.
  • HMAC-signed cart mandates: they expire after 15 minutes, each line can be spent once, the line is reserved before the PayPal call, and rules are re-checked at charge time.
  • Injection-aware: listings that address AI agents are blocked, and gift cards and other cash-equivalents are never allowed.
  • Stack: Next.js 15, React, Tailwind v4, Framer Motion, the Vercel AI SDK with model fallback, deployed on Vercel.

Challenges we ran into

Making the money path impossible for the model to steer: it never sees or sets amounts, and every decision is re-checked at charge time against the signed mandate and the server ledger, including races between two charges.

Accomplishments that we're proud of

A complete loop on real PayPal Sandbox: approve once, rule-bound charges, a live ledger, one-tap refunds and revocation, all explained in-product.

What we learned

Vault plus merchant-initiated Orders is the right shape for agent commerce. The human consents once, and the rules, not the model, hold the purse strings.

What's next

Per-merchant allowlists, shared family leashes, receipts pushed to email, and live PayPal after a security review. Leash runs on PayPal Sandbox; no real money moves.

Built With

  • framer-motion
  • nextjs
  • paypal-orders-v2
  • paypal-payments-v2
  • paypal-vault-v3
  • react
  • tailwindcss
  • typescript
  • vercel
  • vercel-ai-sdk
Share this project:

Updates

Submission history