Inspiration

Everyone building agentic commerce is racing to make agents able to spend money. Almost nobody is building the layer that decides whether they should.

Give an AI agent a card and a $1,000 budget to build a shed, and it can spend $920 on a premium roofing package — technically "within budget," and the project is dead: $80 left for $530 of essential work still to do. A total spending limit is not control. Control is a budget broken down line by line, a check on whether each price is actually good value, and a guarantee the project can still be finished with what remains.

PrismPay implements that control layer, inspired by the open Chain of Trust pattern for agent payments (GoDaddy, Infoblox, Google, Cloudflare, and Singapore's IMDA): the human signs a mandate, the agent acts inside it, and every action leaves a verifiable trail.

What it does

The owner states a goal and a total budget. AI proposes a per-category breakdown; the owner reviews and signs it — the signed mandate is locked with a SHA-256 hash the agent cannot alter. Every purchase the agent proposes then runs five deterministic gates:

  1. Total cap — never exceed the signed budget
  2. Category cap — never exceed a line item (modest overflows escalate to the owner as a contingency draw)
  3. Proportionality — one item over 50% of the budget is denied; 30–50% escalates
  4. Value-for-money — quoted price vs. a reference median: over 1.5× is denied, over 1.15× escalates, and no reference price means escalate, never auto-pass
  5. Forward coherence — denied if the purchase would leave the project unfinishable

$$\text{value ratio} = \frac{\text{quoted price}}{\text{reference median}} \qquad \text{deny} > 1.50\times \quad \text{escalate} > 1.15\times$$

A denial has no override — the owner must sign a new mandate. Only a PASS (or an owner-approved escalation) can reach the PayPal Orders v2 API, and everything lands in an append-only, hash-chained audit log.

Projects can also opt into PayPal's buyer-approval redirect flow. With that per-project toggle on, an approved purchase creates a real PayPal sandbox order and waits for buyer approval before capture; until capture completes, the amount is shown as pending rather than spent.

How I built it

Spec-first: I wrote a proof-driven design doc (gates, thresholds, acceptance criteria, a frozen demo scenario with hand-verified arithmetic) before any code. AI coding agents implemented it in TypeScript on Cloudflare Workers (Hono), with state in Workers KV; I scoped, reviewed, and verified every claim against the live deployment. PayPal Orders v2 runs server-side against the sandbox, called only after a persisted gate evaluation — that ordering is enforced in code, not just documented.

The budget planner uses Cloudflare Workers AI (Meta Llama 3.1 8B Instruct Fast) to propose breakdowns for custom goals, with a deterministic fallback that is labelled in API responses. Two late PRs matter here: one made the Workers AI planner genuinely live for custom goals instead of silently falling back, and another added the opt-in buyer-approval redirect flow after the demo video was recorded. That flow is default-off per project, so the recorded demo and the judge quick-start path are unchanged.

The demo ships three scenarios (a $1,000 shed, a $3,500 kitchenette, a $2,000 maker studio) with reference prices for both parts and labor.

Challenges I ran into

  • Workers isolates recycle. The first deployment "lost" projects between requests because state lived in in-memory storage. My API token couldn't provision D1, so I rebuilt persistence on KV and re-verified the whole flow live.
  • Sandbox capture needs a buyer. On the default server-side path, PrismPay creates a real sandbox order, but capturing a freshly created order without a buyer returns ORDER_NOT_APPROVED; the Worker records a disclosed sandbox capture receipt referencing the real order ID. I then shipped the missing buyer-approval redirect as an opt-in per-project flow: the order is created with return/cancel URLs, the buyer approves on PayPal, capture happens on return, and the dashboard treats the amount as pending until capture. Live verification covered order creation, the PayPal approve link, and pending-vs-spent accounting; the final approve click requires a sandbox buyer login.
  • Honesty about data. Reference prices are a curated seed dataset, labelled as planning estimates everywhere they appear — not scraped "live market data."

What I learned

The interesting problem in agentic commerce isn't the payment — it's the judgment before the payment, and that judgment has to be deterministic code, not a prompt. The AI proposes and explains; it never decides whether money moves. That separation — signed human intent, mechanical enforcement, verifiable trail — is what makes an agent's spending power safe to grant.

Built With

Share this project:

Updates

Submission history