Inspiration

Freelance work runs on trust, and that trust breaks in both directions. In IPSE's survey of UK self-employed workers, 31% had finished work and never been paid. Clients get burned too: they pay up front and receive half a job. Escrow exists, but it only offers two outcomes, release everything or refund everything, so every disagreement becomes a fight over the whole amount. And most of those fights are really about scope that was never pinned down.

We asked: what if the payment itself understood the work?

What it does

Fairhold is a milestone payment platform for clients and freelancers, built on PayPal. It pays in proportion to what was actually delivered.

  1. Agree on proof. The client describes the job in plain English. An AI agent turns it into milestones with weighted, machine-checkable acceptance criteria, and flags ambiguities to settle before work starts.
  2. Hold the money. The client funds each milestone with a PayPal authorization (Orders v2, intent AUTHORIZE) through the PayPal JS SDK v6 button. The money is reserved on their account, not charged.
  3. Verify the delivery. The freelancer submits a live link, a GitHub repo, an image or notes. An AI verifier agent opens each link, checks every criterion, and cites the evidence for each call, live on screen.
  4. Release exactly what was earned. Fairhold computes the payout from the agreed weights, partially captures that amount from the PayPal authorization (the rest of the hold is released automatically), and pays the freelancer through PayPal Payouts, minus a 3% platform fee.
  5. Object and mediate. Either side can object. An AI mediator confirms the payment facts with the PayPal Agent Toolkit, re-checks the evidence, weighs both statements and issues a ruling that Fairhold executes. A verdict nobody disputes settles automatically after 72 hours.

An Operations console shows every hold, verdict and payout in an AG Grid ledger, with a copilot that answers questions using PayPal Agent Toolkit tools and Fairhold's own records.

The key design principle: the AI judges the evidence, code moves the money. The model never picks a dollar figure. It rates each criterion \(c_i\) as met (1), partial (0.25 to 0.75) or unmet (0), and Fairhold computes the payout from the weights \(w_i\) both parties agreed to:

$$\text{payout} = \text{held} \times \frac{\sum_i w_i \, c_i}{\sum_i w_i}$$

In the demo, a bakery website that meets 12 of 17 weighted points releases \(240 \times 12/17 = \$169.41\); the other \(\$70.59\) is never charged.

How we built it

  • Next.js 16, React 19 and TypeScript, deployed on Vercel, with Neon Postgres (an embedded PGlite database runs locally with zero setup).
  • PayPal: Orders v2 (AUTHORIZE), Payments v2 authorizations (partial capture with final_capture, void), Payouts v1, webhooks with signature verification, the JS SDK v6 React components, and the PayPal Agent Toolkit, whose tools we bridge into our agents. All money-moving calls are idempotent (PayPal-Request-Id), and every state change is an atomic SQL transition, so a double click can't double-capture.
  • AI: one provider-neutral tool-calling loop over the OpenAI-compatible API runs four agents on gpt-oss-120b via Groq (Gemini 2.5 Flash and OpenRouter are also supported): the scope compiler, the deliverable verifier, the dispute mediator and the operations copilot. Every tool argument is validated with Zod; invalid calls are sent back to the model to fix.
  • AG Grid for the operations ledger, themed to follow the app's light and dark modes.

Challenges we ran into

  • Making AI verdicts safe enough to move money. We separated judgement (per-criterion outcomes with evidence) from arithmetic (weights to amount), made every verdict contestable, and added a code-level guard: the verifier cannot record a verdict until it has actually opened every submitted link. Early on, the model once assumed a link was unreachable and scored it 0%; the guard makes that impossible.
  • Mapping "partial delivery" onto payment rails. PayPal authorizations plus partial capture turned out to be exactly the right primitive: nothing is charged until work is verified, and the unearned remainder is never taken.
  • Free-tier limits. Running multi-step agents inside Groq's tokens-per-minute limit meant ranking evidence by usefulness, capping tool output, and retrying when Groq rejects a malformed tool call.
  • Bridging the PayPal Agent Toolkit (built for Vercel AI SDK v4) into a provider-neutral tool loop, including cleaning up generated JSON schemas.
  • Sandbox setup: India-to-India sandbox payments fail with a generic error, so we moved to US sandbox accounts.

Accomplishments that we're proud of

  • A complete two-sided product: from a plain-English brief to money in the freelancer's PayPal account, on real sandbox APIs.
  • Proportional settlement: a 70% delivery is paid 70%, in a single PayPal call.
  • An AI that shows its work: every criterion comes with the evidence it used, and either party can check it.
  • A "Next step" banner that guides each party through the flow, so the product works without explanation.

What we learned

Scope clarity prevents more disputes than any arbitration does. Having AI write checkable criteria before work starts may matter more than the AI that checks the work afterwards. We also learned that the safest way to put AI in a payment flow is to keep it out of the arithmetic.

What's next for Fairhold

  • Vaulted payment methods so long milestones aren't limited by the authorization window.
  • PayPal multiparty / platform fees instead of capture-then-payout.
  • Screenshot-based visual checks for design deliverables, and evaluation sets to calibrate the verifier.
  • Escalation to PayPal's Resolution Center when a party rejects the mediator's ruling.
  • Letting AI agents themselves hire and pay freelancers through Fairhold: agentic commerce with built-in proof of delivery.

Built With

Share this project:

Updates

Submission history