Inspiration

AI agents can now shop and pay: PayPal launched agentic commerce services in October 2025, and protocols such as AP2 and the Agentic Commerce Protocol let agents check out. Handing an agent your wallet is still risky: it can overspend, buy the wrong thing, or be talked into paying a scammer by a web page. Prompt injection is risk number one in the OWASP Top 10 for LLM applications, and security researchers have already watched an AI browser complete a purchase on a fake shop. Text that people never see is still text to an agent.

Allowance is for the small office or the family that lets an assistant reorder supplies, and for the developers who build those assistants. AP2 and ACP standardize how an agent proves what it may buy and how it pays; Allowance sits on the owner's side and decides each request when it arrives, after seeing what the agent actually asked for and why.

What is new, compared with a plain spending limit: rules written in plain words and enforced by code; an AI review that reads every request the rules let through and can only make a decision stricter; a PayPal authorization hold for anything unusual, so the owner decides while the money is held, not taken; signed carts the merchant checks before it ships; and a ledger checked against PayPal's own records.

What it does

Allowance is a policy wallet that sits between any AI agent and PayPal.

  1. Plain-English rules, compiled by AI. "Up to €50 per purchase for office supplies, €200 a week in total. Anything else, ask me. Never gift cards or crypto." A local model turns this into structured rules; the owner confirms them on screen.
  2. One door for the agent. The agent never sees payment details: it gets one MCP tool that spends, request_purchase(merchant, items, amount, reason), plus two read-only ones: the status of a purchase and its signed spending mandate. Any MCP client works, and so does plain HTTP. The owner's buttons (approve, deny, rules, agents, the PayPal link) need the owner's password, which agents never get.
  3. Two checks on every request. Deterministic rules first: limits, a weekly budget that counts money on hold, categories, merchants; gift cards and crypto are recognised even when an agent files them as office supplies. Then, for everything the rules do not block, an AI risk review of the request against the owner's intent, which can only make the decision stricter: it cannot override a block or an owner-review requirement imposed by the fixed rules, and with the default failure setting a missing or invalid AI answer sends otherwise-approved requests to the owner. What it does not promise: a false negative can still approve an unwanted purchase that satisfies the fixed rules — our evaluation with the default model has 4 such runs (docs/ATTACK_EVAL.md). The fixed rules, not the review, are the guarantee. Every decision explains itself in one sentence.
  4. PayPal does the money part. Approve: an Orders v2 order with intent CAPTURE, paid from the owner's vaulted PayPal wallet. Ask the owner: intent AUTHORIZE, the money is held; Approve captures it, Deny or 24 hours without an answer voids it, from the computer or a phone on the same Wi-Fi. Block: no order at all. After an approval, Allowance asks whether the rules should learn from it, and the change stays as narrow as the purchase: approving an €89 chair offers household a €90 limit of its own, while everything else keeps the €50 limit. Nothing changes until the owner says yes.
  5. Signed mandates, in the spirit of AP2, checked by the merchant. Allowance signs (Ed25519, compact JWS) what each agent may spend without asking, and the exact cart of every paid purchase, with the PayPal order and capture IDs; the cart's id is the PayPal order's invoice_id. The public key is at /.well-known/jwks.json. In the demo, the agent's harness places the order with the signed cart, and the shop checks the signature and its own prices before confirming: a changed cart, a wrong price or a cart used twice is refused.
  6. A live ledger built on AG Grid with the decision, the reason and PayPal's order, authorization and capture IDs for every request, approve and deny in the row, filters, totals, CSV export and a full audit trail. Check on PayPal reads the order back through PayPal's Agent Toolkit and shows whether PayPal agrees with the ledger.
  7. Insights, built with AG Studio: where the money went, spend by agent, who decided, and two custom widgets: an Agent watchlist that cross-filters the page to one agent, and a Decision flow on a second page, from what the fixed rules alone would have done to where the money went, with the AI review's interventions in purple. An AI auditor built on AG Studio's agent framework answers questions from the ledger, checks every payment against PayPal through the Agent Toolkit, and adds charts on request.

The demo stages a real attack. A product page hides a note telling AI assistants to add a €24 "priority handling" fee to the order, or else pay a "checkout partner" with a €95 gift card. A real local model (Qwen3.5 4B), given three errands and a plain shopping prompt, falls for it and asks for the paper plus the fee: €32.49, which the fixed rules alone would have paid. The AI review holds it, the owner denies it, and PayPal voids the hold. A deliberately gullible test agent goes further and asks for the gift card; the rules block it. Nobody can tell in advance which agent will be fooled, which is why the limits belong in the wallet and not in the agent.

How we built it

  • TypeScript on Node 22, Express 5, SQLite through node:sqlite, zod at every boundary.
  • PayPal REST APIs (sandbox): Vault v3 setup and payment tokens to link the owner's wallet once; Orders v2 with payment_source.paypal.vault_id and intent CAPTURE or AUTHORIZE; Payments v2 to capture or void. Every call that creates an order or moves money carries a PayPal-Request-Id. PayPal's Agent Toolkit (@paypal/agent-toolkit, only its read-only get_order and list_transactions tools enabled) checks the ledger against PayPal for the owner and for the auditor. In the sandbox, orders are paid to our REST app's business account, standing in for the shop. npm run proof:sandbox runs the whole path on the real sandbox, and docs/SANDBOX_PROOF.md lists the PayPal IDs of such a run; docs/VIDEO_RUN.md lists those of the run in the video. Without credentials the same flow runs in a clearly labelled offline simulation.
  • Mandates with node:crypto only: Ed25519 keys, compact JWS (RFC 7515, alg: EdDSA) and a JWK set any JOSE library can read. The demo shop verifies carts with nothing but the public key.
  • MCP server with the official TypeScript SDK, over streamable HTTP and a stdio bridge. Each agent has its own revocable token, stored hashed; the owner signs in with a password chosen through a one-time link printed in the terminal.
  • AI: any OpenAI-compatible endpoint, by default a local model through Ollama, so nothing leaves the owner's machine: the rule compiler, the risk reviewer and the Insights auditor, with structured JSON output.
  • Dashboard: React 19 and Vite; AG Grid Community for the ledger (custom cell renderers, external filters, quick search, pinned totals, CSV export), live over server-sent events. AG Studio (ag-studio 3.1) for Insights: a themed two-page report, two custom widgets registered with createWidgets that read data through the widget API and drive cross-filtering, and the auditor agent, with four tools of its own next to Studio's built-in agents. A small AgLlmAdapter connects Studio's agents to OpenAI-compatible chat completions through Allowance's server, so they run on the same local model. The AG Studio license key reaches the page at runtime and never lands in the built files.
  • Tests: 80 unit and integration tests (policy engine, wallet flows, owner sign-in, HTTP API, mandates and the shop's check, the PayPal client against fixtures written from the API reference). npm run eval:ai scores the AI reviewer on ten purchases under three agent names (29 or 30 of 30 with Qwen3.5 4B, depending on the run). Because those cases include the demo's own attack, npm run eval:attacks sends 16 other attacks and 6 normal purchases to several local models (results below).

AI tools used

  • Ollama with a local open model, Qwen3.5 4B, inside the product: the rule compiler, the risk reviewer and the Insights auditor (through AG Studio's agent framework). The same model drives the demo's real shopping agent (npm run demo -- --llm).
  • PayPal Agent Toolkit, read-only (get_order, list_transactions), as tools of the auditor and behind "Check on PayPal".
  • Phi-4 and Qwen2.5-Coder 7B, also through Ollama, only to compare models in the attack evaluation.
  • Claude Code (Claude Opus 5.5) as the coding assistant that helped build the project.

Challenges we ran into

  • Small local models make mistakes. Our reviewer once blocked a plain $45 monitor stand, and its verdicts changed with the agent's name alone, so we built an evaluation that runs every case under several names. The design rule that saved us: the AI can only tighten a decision, so a wrong or missing answer costs a question or a block, never a loosened rule. It is not a promise that no mistake can cost money: a false negative can still approve a purchase the fixed rules already allow — 4 such runs with the default model.
  • PayPal's AUTHORIZE intent turned out to be the perfect cooling-off period, with capture and void as the owner's two buttons.
  • Paying the shop directly. We put a second sandbox business account on the order as the payee, and PayPal refused with BILLING_AGREEMENT_NOT_FOUND (debug id ca55d0e20d9c1), while the same purchase without a payee went through: a wallet vaulted by one app pays that app's account. Without a partner (multiparty) integration that is how PayPal works; Allowance now explains it in plain words, and merchant onboarding is our first production step.
  • A 4B model inside AG Studio's multi-agent harness: delegating chart building to Studio's agents needs a larger model, and our auditor once called a held purchase blocked. A deterministic chart tool and outcomes spelled out in words fixed its own tools; a small model can still leave an item out of a summary, so the ledger and the decision flow stay the source of truth.

Accomplishments that we're proud of

  • A real model fell for a hidden prompt injection in our runs, and the fee still was not paid: the AI review held what the fixed rules alone would have paid, the owner denied it, and PayPal voided the hold.
  • We tested 16 attacks worded differently from the demo's note (tips, protection plans, a fake system notice, payment redirects, refund fees, an add-on in Italian, base64 instructions...), twice each. The fixed rules blocked the 4 crypto and gift-card runs. Of the 28 runs the rules alone would have paid, the default 4B model's review caught 24 (21 sent to the owner, 3 blocked) and let 4 through; Phi-4 caught 20, a coding model 7. These are the numbers of the run published in docs/ATTACK_EVAL.md (6 Nov 2026, commit ff4af73), in which no model failed to answer in time. All 12 normal purchases would have gone through without asking. On these same 44 requests, the rules alone would let 28 unwanted purchases through and never ask the owner; with the default model's review, 4 get through, the owner is asked 21 times (every time about an attack) and no normal purchase waits. The two kinds of attack that get through: a payment redirected to a different billing entity, which a Known merchants rule stops, and five reams instead of one at the normal price, still under the limit. The reviewer's instructions describe these families of trick, so this measures new wording, not new kinds of attack. That evaluation is a simulation of the decisions with a real local model — rules engine and AI review, no PayPal call — so it says what Allowance would do; the live PayPal path is proved separately in docs/SANDBOX_PROOF.md. Full table, misses included: docs/ATTACK_EVAL.md.
  • The full PayPal path runs live in the sandbox with a Vault-linked wallet, and every payment can be checked against PayPal's own record.
  • Every decision explains itself in one sentence a non-technical owner understands.
  • It runs entirely on a laptop: no paid AI service, no cloud database.

What we learned

Guardrails for agentic payments belong in the payment layer, not in the agent's prompt: the agent can be fooled, the wallet should not be.

What's next: from hackathon to production

The decision layer stays as it is; three steps around it:

  1. Pay the merchant, not the app. The sandbox refuses another payee for a wallet our app vaulted, so merchants would be onboarded through PayPal's multiparty (platform) integration, consent, and be paid directly; or Allowance pays at merchants that accept agent-initiated PayPal payments.
  2. One wallet per owner, hosted. Owner accounts with their own vaulted PayPal wallets, and push notifications for held purchases, so the phone rings when an agent asks.
  3. Narrower limits and a stronger review. Budgets per agent and per merchant, next to today's per-category limits, a larger model behind the same "can only tighten" contract, and the AI evaluation run on every change.

Built With

Share this project:

Updates

Submission history