Inspiration

AI agents can now negotiate and buy services, but most "AI payments" stop at a spending limit. A limit does not answer the harder question: who decides the work was actually delivered? If the AI that negotiated the deal also judges the delivery, the text it is judging can talk it into paying. We wanted the AI to stay useful for negotiation and keep it out of the decision that moves money.

What it does

MANDATE connects an AI-negotiated service agreement to evidence-backed delivery verification and conditional PayPal settlement. The first use case is a small business buying a structured digital service (a CSV data-cleaning job) from an independent provider.

  1. The human signs a mandate: budget, per-deal cap, an "ask me above" threshold, allowed sellers and expiry, sealed with Ed25519.
  2. The AI negotiates the price only, inside those limits. Every offer is re-validated by code, so the agent cannot exceed its authority or leak the buyer's limits.
  3. The agreement is locked: task, price and acceptance criteria are hashed into the terms before any payment step.
  4. PayPal authorization: a hold on the buyer's funds. It is not escrow and not yet a payment.
  5. The seller delivers a CSV. Deterministic validators check it against the locked criteria (schema, duplicate rows, date formats). A scanner flags instructions hidden in the data, and a flagged delivery stops for a human.
  6. A challenge window, then settlement. The engine computes the amount in code and captures exactly that amount, or voids the authorization. Everything lands in a hash-chained audit ledger on the dashboard.

Design principle: humans define authority, AI proposes and negotiates, deterministic software validates, evidence substantiates delivery, PayPal executes.

How we built it

Next.js 16, React 19 and TypeScript; PostgreSQL with Prisma; Zod at every untrusted boundary; decimal.js for money. PayPal runs through the official PayPal Server SDK (Orders v2 with AUTHORIZE, Payments v2 authorization, capture and void), with a PayPal JS SDK v6 checkout button implemented and tested against fakes. The optional Buyer Agent is Groq's openai/gpt-oss-20b with no tools, no database access and no payment authority. A separate local seller simulator provides the counterparty with synthetic data. PayPal defaults to an in-memory mock so anyone can run the demo safely.

Evidence, and what is separate

We kept the evidence honest. These are separate runs, not one continuous transaction:

  • Interactive walkthrough: mock PayPal, a rule-based buyer and synthetic data.
  • Groq negotiation: a separate recorded run in which the model proposed 25.00 USD against a 20.00 USD target and the simulated seller accepted. We state plainly that this was over-generous.
  • PayPal Sandbox payment: a separate transaction: order, buyer approval, authorization, verified delivery, one capture of 20.00 USD, COMPLETED, reconciled. The challenge window expired unused, so settlement followed the expired-window rule and no explicit buyer acceptance event was recorded.

PayPal Sandbox only. No real money. Production is a documented NO-GO.

Challenges

  • Keeping the AI out of the payment decision while still letting it negotiate: the deterministic negotiation policy, the typed price-only messages and the outbound-message filter exist for this.
  • Safe retries with PayPal: every write carries a stable request id and is recorded before it is sent; an unknown outcome is resolved by reading PayPal, never by trusting a redirect.
  • Hostile text inside deliverables: treating the data as untrusted and stopping flagged deliveries for a human.
  • Honest scope: we kept real Sandbox evidence, mock demos and the model run clearly separate instead of stitching them into one story.

What we learned

Authority limits and payment approval are not enough: the agreed service requirements need to be connected to delivery evidence and to the settlement decision. We also learned how easy it is to overstate what a demo shows, so we labelled every screen mock or Sandbox.

What's next

Reauthorization for expired authorizations, webhooks, explicit buyer acceptance exercised against real PayPal, more validator types for other structured deliverables, multi-user accounts and a hardened deployment.

Limitations

The seller is a local simulator, not an external merchant. Delivery verification is deterministic and suits structured deliverables, not subjective ones. Void, refund, partial capture and webhooks have not been exercised against real PayPal.

Code: https://github.com/Unknown1502/Mandate

AI use disclosure

Inside the product: Groq openai/gpt-oss-20b negotiates price; the delivery verifier uses no model. During development an AI coding assistant (Claude Code) helped write and test code and documentation. The demo video narration is an ElevenLabs AI voice.

Built With

Share this project:

Updates

Submission history