-
-
Policy cap blocks an over limit payment before PayPal checkout; the block is recorded in the audit trail.
-
Natural language draft parsed locally (no OpenAI required), applied to the payment form before operator review.
-
Capstan landing page: policy bound PayPal contractor payouts with console and finance dashboard entry points.
-
AG Grid finance dashboard: live audit metrics, filtered event rows, and row level inspection for PayPal sandbox captures.
-
End to end sandbox payout: agent draft, operator approval, PayPal order create and capture, with a full audit trail on the console.
Inspiration
Teams paying contractors on PayPal need speed, but giving an AI direct access to checkout is risky: wrong amount, wrong recipient, no clear record of who approved what. I built Capstan as the operator layer. The agent can propose, but policy and humans decide before money moves.
What I built
Capstan is a Next.js app for milestone contractor payouts on PayPal sandbox:
- Draft — Operators describe a payout in plain language. A local parser fills the form by default (no OpenAI credits required). Optional OpenAI when configured.
- Policy — A configurable single payment cap (default $500) blocks overspend before any PayPal API call.
- Review — The operator confirms payee, amount, and milestone copy.
- Checkout — PayPal Orders v2 create and capture via the official React SDK.
- Audit — Every step is logged and shown in an AG Grid Community dashboard: presets, filters, row inspection, and CSV export.
Live demo: capstan-b7bg.vercel.app/app
Dashboard: capstan-b7bg.vercel.app/app/dashboard
How I built it
- Next.js 15 with server routes for PayPal OAuth, Orders create and capture, policy checks, and agent draft.
- PayPal: sandbox REST plus
@paypal/react-paypal-jsfor buyer checkout. - AI: structured draft API with a local fallback at zero cost; OpenAI JSON mode when
OPENAI_API_KEYis set. - AG Grid v33: custom event renderers, filter presets, natural language view shortcuts, export.
- PayPal MCP documented as optional Cursor tooling to compare orders with the grid (
docs/PAYPAL-MCP.md), separate from the in app checkout path.
Challenges
- Sandbox pairing: reliable checkout required US Business app credentials and a US Personal buyer at the popup. Other pairings hit payee restriction errors. Steps are in the README for judges.
- Serverless hosting: Vercel’s filesystem is ephemeral, so the hosted demo uses browser session storage to keep audit events while judges move between Console and Dashboard. A local clone uses file storage under
frontend/.data/.
What I learned
The strongest agentic commerce demos are not “chat pays.” They show visible governance: policy blocks, explicit approval, PayPal lifecycle IDs, and a finance view operators would actually use.
What's next
Webhooks, payee allowlists, optional PayPal Agent Toolkit tools behind the same policy gate, and richer AG Grid analytics for production operators.
Built With
- ag-grid
- next.js
- paypal
- react
- typescript