Inspiration

Freelancers and small businesses across the globe face a persistent, painful bottleneck: the escrow trust gap.

Freelancers fear working without upfront guarantees and often wait weeks for clients to manually review subjective work or approve escrow. Conversely, clients fear paying upfront for code that fails to compile, misses criteria, or breaks requirements. Traditional freelance platforms handle this with slow, manual dispute mediation where human support agents often lack the technical background to inspect pull requests or verify code deliverables.

We asked ourselves: What if payments could be as smart and responsive as modern AI agents?

With PayPal's agent-ready APIs and modern Large Language Models capable of evaluating objective criteria, we built ArbiterPay: an AI-verified milestone escrow platform where code deliverables are instantly, impartially checked against agreed requirements, and PayPal Payouts are triggered in seconds—guaranteeing immediate liquidity for builders and complete protection for clients.


What it does

ArbiterPay automates the end-to-end lifecycle of contract milestones using PayPal sandbox checkout, an AI arbiter, and a deterministic policy engine:

  1. Intelligent Contract Creation: Clients set up contracts with 1–6 customizable milestones. Each milestone includes clear, verifiable acceptance criteria (e.g., JSON schema validation, unit test coverage, error handling) and a budgeted amount. Clients can launch quickly using curated templates (Python Scrapers, Microservices, Single Tasks) or save their own reusable custom templates.
  2. Instant Escrow Funding (PayPal Orders v2): The client deposits milestone funds into a secure sandbox escrow account via PayPal Orders v2 with real-time capture verification.
  3. Objective Deliverable Submission: Freelancers submit deliverables directly through the portal by uploading source code files (e.g., .py, .ts, .js), GitHub repositories, or test outputs.
  4. AI Arbiter Evaluation: An LLM-powered Arbiter inspects the code against each agreed criterion, grading the submission on an objective 0–100 score and extracting concrete textual evidence and line-by-line verification.
  5. Autonomous Payouts (Policy Engine):
    • Score $\ge 90$: Passes automatically. The policy layer immediately triggers the PayPal Payouts API to disburse funds to the freelancer's PayPal email.
    • Score $< 90$: The system automatically generates a structured fix-list highlighting exact failures and routes the case to human review.
  6. Human Review & Dispute Console: Clients and platform admins can review disputed or flagged submissions with all AI evidence, run interactive judge demos, and approve manual overrides or request revisions.
  7. Transparent Audit Ledger (AG Grid): An append-only, searchable audit ledger displays every cryptographic payment event, webhook receipt, and AI arbitration score with cross-page drill-downs for complete financial transparency.

How we built it

  • Frontend & UX: Built with Next.js 15 (App Router) and Tailwind CSS, featuring dark/light mode, real-time milestone budget balancing, interactive client and freelancer portals, and modular template managers.
  • Payment & Escrow Layer: Built entirely on the PayPal Sandbox API, integrating:
    • PayPal Orders v2 (createOrder & captureOrder) for milestone escrow funding.
    • PayPal Payouts API for instant autonomous payout execution directly to freelancer accounts.
    • PayPal Webhooks to verify signatures and record transaction state changes.
  • AI Oracle & Policy Layer: Powered by LLM tool-calling with strict schema validation via Zod. To guarantee safety, the AI never directly touches the wallet. Instead, the AI returns a structured audit verdict, and a deterministic TypeScript policy layer enforces idempotency, threshold validation ($\ge 90$), and payout safety.
  • Audit & Analytics: Integrated AG Grid into an interactive ledger console, allowing judges and platform users to filter transactions by category (Payments, AI Arbitrations, Policy Events), inspect raw payloads, and view aggregate escrow metrics.
  • Deployment: Hosted on Render with automated continuous integration and environment management.

Challenges we ran into

  1. Eliminating Financial Hallucinations: We had to guarantee that an LLM would never accidentally execute a payout or produce ambiguous decisions. We solved this by strictly separating the evaluator from the executioner: the AI only outputs a strictly typed Zod JSON verdict, while a deterministic backend engine verifies the scores and executes PayPal Payouts idempotently.
  2. Real-Time Payout Idempotency: Ensuring that retries, network hiccups, or double clicks could never trigger duplicate PayPal Payouts for the same milestone. We implemented idempotency keys and state tracking in an append-only ledger.
  3. Handling Complex Next.js 15 Hydration & Search Params: Next.js 15 enforces strict CSR Suspense boundary requirements on dynamic route parameters (useSearchParams). We re-architected client components with React Suspense boundaries to eliminate SSR bailout warnings and preserve smooth page reloads.

Accomplishments that we're proud of

  • True End-to-End Autonomous Commerce: A developer can submit a Python script, watch the AI score it in 4 seconds, and see the PayPal sandbox sandbox balance credit their freelancer account without waiting days for client approvals.
  • Transparent "No-Black-Box" AI: Every single verdict contains cited criteria, confidence levels, and exact quoted evidence accessible in both the Human Review console and the AG Grid Ledger.
  • Bursar-Grade Financial Ledger: Delivering a responsive AG Grid table that links directly to live contracts, human review screens, and PayPal transaction batch IDs.

What we learned

  • How to build safe, agentic commerce workflows by using AI for objective verification while reserving payment dispatch for deterministic policy gates.
  • Deep integration with PayPal's Orders v2 and Payouts APIs in sandbox environments.
  • Designing developer-first UX patterns for dispute prevention, showing how clear criteria up front eliminate 90% of downstream freelance disputes.

What's next for ArbiterPay

  • GitHub PR Webhook Integration: Triggering automatic AI milestone evaluations directly upon merging pull requests that pass CI tests.
  • Multi-File & Full-Stack Scaffolds: Expanding file parsing to evaluate Docker containers, API responses, and automated Jest/Pytest execution in isolated sandboxes.
  • PayPal Agent-Ready API Expansion: Enabling fully autonomous AI developer agents that hire other AI agents and settle compute micro-payments via ArbiterPay escrow.

Built With

Share this project:

Updates