💡 Inspiration
Online contracting faces an intractable trust problem:
- Pre-paying forces buyers to trust unknown workers or autonomous AI agents before seeing real work.
- Post-paying forces workers to build on credit, hoping the buyer doesn't disappear.
- Traditional Escrow requires a licensed third-party custodian that holds your money, takes a heavy commission, and adds regulatory drag.
PayPal already provides an underutilized, non-custodial authorization primitive: intent: AUTHORIZE. The buyer authorizes funds directly in PayPal, locking money in their own account without giving custody to any middleman.
However, PayPal alone cannot inspect an API endpoint, verify a mobile screenshot, run a test suite, or validate delivered code. We built PACT to provide an objective, split-brain AI witness layer that verifies deliverables before releasing settlement.
"PayPal can hold money. It cannot tell if the work is real."
⚙️ What It Does
PACT is a high-density conditional settlement console designed for autonomous agent contracts and human freelancers:
- Natural Language Contract Synthesis: The buyer describes the work (or clicks a preset like Waitlist Page, Auth Microservice, or Database Migration). PACT tokenizes the brief and synthesizes a formal Pact 1.0 JSON specification with weighted criteria (C1–C4), release threshold (min score 80), revision budget, and deadline.
- Non-Custodial PayPal Hold: The buyer authorizes the payment through PayPal Checkout using
intent: AUTHORIZE. The authorization ID is saved with status HELD. PACT never takes custody of funds. - Split-Brain Witness Verification: The worker submits deliverables (live URLs, desktop screenshots, mobile viewports). An isolated AI witness scores the evidence against the published criteria.
- Critical Security Invariant: The witness verifier has zero PayPal API keys and zero capture or void privileges.
- Fail-Closed Policy Engine:
- If criteria fail (e.g. Score 70/100 FAIL due to missing mobile artifact): Funds remain strictly HELD in PayPal. Revisions are permitted. The verifier cannot void or seize funds.
- If criteria pass (e.g. Score 94/100 PASS): The policy engine unlocks the settlement pathway, triggering PayPal's
POST /v2/payments/authorizations/{id}/capture.
- Cryptographic Attestation Receipt: Generates an immutable SHA-256 certificate receipt proving non-custodial settlement, verified score, and PayPal capture ID.
🛠️ How We Built It
- Frontend & Workstation Shell: Built with Next.js 16 (App Router), TypeScript, and Tailwind CSS, implementing the Void Ledger design system (Braun × Bloomberg Terminal × Teenage Engineering). Framer Motion spring physics drive full-viewport non-overlapping rails (228px ↔ 64px sidebar, 300px ↔ 36px telemetry).
- Backend & Database: Next.js Route Handlers powered by native Node.js
node:sqlite(DatabaseSyncwith zero native C++ compilation dependencies) storing contracts, PayPal object states, deliverables, verdicts, and receipts in./data/pact.db. - PayPal Integration: Full REST API v2 integration:
POST /v2/checkout/orderswithintent: AUTHORIZEPOST /v2/checkout/orders/{id}/authorizePOST /v2/payments/authorizations/{id}/capturePOST /v1/notifications/verify-webhook-signature(validating transmission ID, timestamp, CRC32, and cert URL).
- Witness Isolation Sandbox: The verifier runs in an isolated module (
lib/verifier) with strictly capped tools (5-second timeout, 100 KB payload ceiling) and zero imports or knowledge of PayPal credentials.
🧗 Challenges We Ran Into
- Split-Brain Key Isolation: Ensuring the evaluator could never be manipulated via prompt injection or deliverable payloads into triggering an unauthorized capture. We enforced this at the architectural layer: the verifier module possesses zero PayPal tokens or tools.
- Fail-Closed State Machine: Handling non-ideal paths where deliverables fail without accidentally locking the user out or triggering illegal state transitions. Funds must safely remain HELD until explicit policy conditions are satisfied.
- Full Viewport Engineering: Building responsive, non-overlapping Framer Motion spring rails so judges have a 100vh full-viewport Bloomberg-style experience without modal popups or broken scrollbars.
🏆 Accomplishments We're Proud Of
- Genuine PayPal REST Movement: Real sandbox checkout where buyers log into PayPal Sandbox and authorize funds without middleman custody.
- Working Fail-Closed Demonstration: Scripted walkthrough showing the exact contrast between
fixtures/bad.html(70 FAIL → funds stay safely HELD) andfixtures/good.html(94 PASS → settlement released). - Void Ledger Aesthetic: A distinct, high-density, distraction-free aesthetic with micro-metrics, interactive criteria weight meters, and zero AI-template fluff.
📚 What We Learned
- PayPal's two-step
AUTHORIZE→CAPTURElifecycle is the ideal primitive for AI agent economies because it avoids custody and money transmission licenses while offering complete payment security. - Decoupling proof evaluation (the witness) from money movement (the policy engine) is essential for AI safety in financial transactions.
🔮 What's Next for PACT
- Automated GitHub Actions and Webhook integrations so continuous integration test runs directly feed proof into the witness verifier.
- Multi-party arbitration thresholds where multiple consensus verifier agents score complex deliverables.
Built With
- artificial-intelligence
- framer-motion
- next.js
- node.js
- paypal
- rest-api
- sqlite
- tailwindcss
- typescript