Inspiration
Freelance and micro-SaaS work stalls on trust. Buyers won't pay before the code works, and freelancers wait weeks for milestone sign-off. PayPal already offers a two-step payment, authorize now and capture later. We put an AI auditor between those two steps.
What it does
- Lock funds. Each milestone is a PayPal Orders v2 order with
intent=AUTHORIZE. The buyer approves it on PayPal; PayPilot then calls/authorizeand the funds are held. - Audit the deliverable. When the freelancer submits code or an API spec, the Deliverable Auditor checks it against each acceptance criterion: AST syntax, required endpoints and tests, leaked secrets,
eval(), and the test pass rate. Google Gemini (gemini-3.5-flash) then reads the deliverable and evidence and returns a reasoned, per-criterion verdict with risk flags. It can block or escalate a payout, but it can never approve one the guardrails rejected. Output: confidence score, risk score and a decision (AUTO_CAPTURE_APPROVED,HOLD_FOR_REVISIONorESCALATE_DISPUTE). - Settle automatically. At or above the contract threshold (80% by default), PayPilot calls
POST /v2/payments/authorizations/{id}/capture, then creates a PayPal invoice with the audit attached and records it as paid. Below it, funds stay held: revise or escalate. A disputed hold can be voided back to the buyer. The AI can release money but can't force a payout. - Reconcile. An AG Grid workbench shows each milestone's status, AI score and PayPal IDs, with quick filters, a timeline and CSV export.
How we built it
FastAPI and Pydantic back end. PayPal REST: OAuth2 client credentials, Orders v2 (authorize intent + buyer approval redirect), Payments v2 capture/void, Invoicing v2 (create, send, record payment). The auditor is Python ast + rule checks + a Gemini verdict over the OpenAI-compatible API (strict JSON, prompt-injection-hardened, strict-only merging). The front end is a single page with AG Grid Community 31. It deploys to Render with render.yaml. A zero-config Replay mode lets judges try the UI without credentials. It is clearly labelled and makes no PayPal calls.
Challenges
Modelling escrow on PayPal's authorize/capture lifecycle (authorization validity and honor periods), and keeping the AI's power bounded: it can only release funds, and every decision is explainable per criterion.
What's next
Partial captures for multi-part milestones, automatic void on dispute timeout, re-authorization before the honor period ends, webhook-driven state (PAYMENT.CAPTURE.COMPLETED), and buyer/freelancer views.
Built With
- ag-grid
- fastapi
- google-gemini
- httpx
- paypal-invoicing-v2
- paypal-orders-v2
- paypal-payments-v2
- pydantic
- python
- render