PayPilot — B2B treasury: invoice emails in, quorum-approved payouts onchain, bank-grade controls.
PayPilot is a B2B treasury and payout platform built on Base, where companies run payroll, vendor and bounty payments from multi-signature organization wallets. Anyone can sign in with Privy and self-serve create their own organization with named wallets (Treasury, Payroll, Bug Bounty Rewards, Ops) — each wallet carries its own onchain policy: a vendor address allowlist plus a per-transaction spending cap that Privy enforces inside the signing enclave, not in our app code.
The core workflow is a real dual-control loop: a vendor simply emails an invoice (e.g. "Please pay 0xAbC… 0.02 USDC") to our receiving address — a Resend webhook parses the recipient and amount, checks the vendor against the allowlist, and creates a payout request backed by a Privy intent on the org wallet. The request needs quorum approval: an authorized team member clicks Approve, and the app's quorum signing key submits a real ECDSA authorization signature to Privy — when the threshold is met, Privy broadcasts the transfer onchain and the payout flips to Executed with the transaction hash.
On top of that, PayPilot ships: role-based access (Owner, Treasurer, Finance Officer, Viewer), amount-tiered approvals (small payouts route to a single-approver Ops wallet, larger ones require the full quorum threshold), pre-generated employee wallets by email, scheduled recurring payments, and balance-condition automations. It's a finance team's controls — allowlist, caps, quorum, roles — running onchain instead of in a bank's database.
Stack: Next.js, MongoDB, Privy (auth, organizations, wallets, key quorums, policies, intents, authorization signatures), Resend for the email pipeline, deployed on Vercel and live on Base Sepolia testnet.
PayPilot is a Next.js 16 (App Router, TypeScript, Tailwind) app deployed on Vercel, with MongoDB Atlas as a pure UI-state mirror — deliberately. Every money-critical operation runs through Privy: @privy-io/node drives organizations, wallets, key quorums, policies, condition sets and intents server-side, while @privy-io/react-auth handles embedded email auth in the browser. The architecture's core principle: authority lives in Privy, never in our database. Even a fully compromised app server can't move funds — quorum thresholds, policy gates and intent execution all live in Privy's enclave.
The genuinely hacky/notable bits:
Partner technologies: Privy (the entire security story), Resend (inbound invoice inbox + outbound approval emails), Vercel (deploy + cron), MongoDB Atlas (org-scoped app state), viem (calldata encoding, balance reads).
The build also taught us the hard way: Privy's env vars are newline-sensitive, its intent members report user IDs without the did:privy: prefix, and its webhook secrets are base64 — all three are now documented in the repo and handled.

