Inspiration
Two kinds of workers are paid on trust today, and both get burned.
Freelancers deliver work and then chase invoices, while clients pay up front for work that never arrives or doesn't match the brief. Escrow services exist, but a human still has to decide when to release the money, so disputes drag on for weeks.
Then we watched the rise of AI agents that buy from other AI agents: an agent hires a translator agent, a copywriter agent, an SEO agent. Nobody checks the output. An agent that pays per API call will happily pay for junk, or pay a seller who quietly doubled its price.
We asked one question: what if money only moved once the work was proven? PayPal already knows how to hold money safely. AI can now read a deliverable and judge it against clear criteria. Put them together and you get ProofPay: escrow that pays the moment the work is verified, and never for junk.
What it does
ProofPay has two modes on the same PayPal rails.
1. Human freelance jobs
- The client describes the job in plain English, and AI turns it into milestones with testable acceptance criteria and a price for each.
- The client funds the job with PayPal. That's an Orders v2 authorization, so the money is held, not charged.
- The freelancer submits work: text, code, a URL or a screenshot. An AI verifier checks every criterion and returns a verdict, evidence and a confidence score.
- If the work passes, ProofPay captures that milestone from the authorization and pays the freelancer through PayPal Payouts. If it fails, not a cent moves, and the freelancer gets specific feedback to fix.
2. Agent-to-agent missions
- The user gives a buyer agent a goal and a single spending cap, authorized once with PayPal.
- The agent plans the tasks, shortlists seller agents from a marketplace (cheapest first), hires them, verifies each deliverable, and pays per verified task.
- Junk is refused at $0. Overpriced quotes are blocked before hiring. Whatever is left of the budget is voided back to the payer.
Every authorization, capture, payout, void and refusal is written to an AG Grid ledger that links each PayPal transaction ID to the AI verdict behind it, and the ledger exports to CSV.
How we built it
- Frontend and backend: Next.js 16 (App Router), React 19, TypeScript and Tailwind CSS 4, with all PayPal and AI calls made server-side in route handlers.
- PayPal (sandbox):
- The JS SDK Smart Buttons fund jobs and missions.
- Orders v2 with
intent: AUTHORIZEcreates the escrow hold. - Partial captures release each milestone or task, using
final_captureon the last one. - Every capture carries a
PayPal-Request-Ididempotency key, so a retry can never pay twice. - Payouts pay freelancers, and an authorization void returns any unspent budget.
- AI:
- Groq's
gpt-oss-120bplans milestones, writes acceptance criteria, acts as the seller agents and verifies deliverables. - A Qwen vision model on Groq reviews screenshots.
- Google Gemini is an automatic fallback if Groq fails.
- Verifier output is strict JSON: a pass or fail plus evidence for each criterion, and an overall confidence.
- Groq's
Guardrails enforced in code, not in prompts. A milestone is released only when all of its acceptance criteria pass, the verifier is confident enough, and the amount fits what is still authorized:
$$ \text{release}(m) \iff \Big(\bigwedge_{i=1}^{n} c_i = \text{pass}\Big) \;\wedge\; \text{conf} \ge 0.70 \;\wedge\; a_m \le A - \sum_{k} \text{captured}_k $$
For agents, a seller is hired only if its quote is at or below both its listed price and the remaining budget:
$$ \text{quote} \le \text{listed price} \quad \wedge \quad \text{quote} \le \text{cap} - \sum_t \text{paid}_t $$
The mission always keeps this invariant, and the leftover is voided:
$$ \sum_{t \in \text{tasks}} \text{paid}_t \;\le\; \text{cap}, \qquad \text{void} = \text{cap} - \sum_t \text{paid}_t $$
In the demo, that's 15.00 − 3.25 = $11.75 voided.
Platform fee: every payout keeps a 5% fee:
$$ \text{payout} = 0.95 \times \text{capture} $$
So a $150 milestone pays the freelancer $142.50.
- Auth: passwordless email OTP sent through the Brevo HTTPS API, with HMAC-SHA256-signed session cookies. Each user's data is scoped to their own email.
- Ledger: AG Grid Community with type filters, search, a confidence bar column and CSV export.
- Deployment: Render, using a
render.yamlBlueprint, live at https://proofpay-oqmt.onrender.com
Challenges we ran into
- Making AI trustworthy enough to move money. An LLM verdict alone isn't a payment decision. We split the job in two: the AI produces structured evidence and a confidence score, and deterministic code makes the final call using criteria, a confidence threshold and budget checks. When the AI is unsure, money stays in escrow.
- Partial captures on one authorization. Releasing milestones one by one from a single PayPal authorization meant tracking captured versus remaining amounts, setting
final_capturecorrectly, and voiding leftovers cleanly. Idempotency keys were essential: a double click or a network retry must never pay twice. - LLMs aren't deterministic. The same cheap seller agent passed verification in one run and failed in another. Instead of hiding that, we made the system handle it: refused work costs $0, and the agent simply re-hires the next seller on the shortlist.
- Email in production. OTP email worked locally over SMTP, but Render's free tier blocks outbound SMTP ports, so login failed in production. We added a Brevo HTTPS email path, with SMTP kept as a local fallback.
- Safe verification of URLs. Freelancers can submit links, so fetching them server-side could expose internal addresses (SSRF). We added fetching that blocks private and loopback addresses.
- Price manipulation by agents. A seller agent can quote more than its listed price. The guardrail blocks the hire before any money is committed, and the refusal is recorded in the ledger.
Accomplishments that we're proud of
- A real, end-to-end PayPal flow in the sandbox: authorize, partial capture, Payouts and void. Every transaction is visible in the PayPal sandbox account, not mocked.
- One verification-and-payment engine powering two markets, human freelancers and autonomous AI agents.
- A complete product, not a proof of concept: landing page, OTP login, dashboard, jobs, missions, marketplace and ledger, all deployed live.
What we learned
- Authorize-then-capture is the right primitive for AI-gated payments. It turns "pay or don't pay" into "release when proven", with a void as the safe default.
- The best division of labor is AI for judgment, code for money: the model explains why, and deterministic rules decide whether.
- Agentic commerce needs spending caps, price guardrails and audit trails as first-class features. Without them, an agent will pay for anything.
What's next for ProofPay
- PayPal Vault and recurring authorizations for long-running agent budgets.
- Dispute flow with human review when AI confidence is borderline.
- An open API so any agent framework can hire through ProofPay and pay per verified result.
- Reputation scores that feed the marketplace ranking, so reliable sellers win more work.
Built With
- ag-grid
- ai-agents
- brevo
- google-gemini
- gpt-oss
- groq
- hmac
- nextjs
- node.js
- nodemailer
- paypal
- paypal-javascript-sdk
- paypal-orders-api
- paypal-payouts
- qwen
- react
- render
- restapi
- tailwindcss
- typescript