Inspiration
Autonomous AI agents are transforming web research, business operations, and automated workflows. However, the fatal bottleneck in agent autonomy is financial custody: handing an LLM unrestricted credit card credentials creates catastrophic risks of prompt injection, hallucinated overspending, or purchasing from fraudulent merchants.
We built SovereignSpend to bridge this gap: providing an autonomous procurement layer that gives AI agents a real wallet with programmable spending guardrails*, merchant verification, and PayPal Vault-backed tokenized disbursement*.
What it does
Natural Language to PayPal Checkout:** Users provide conversational buying instructions (e.g., "Reorder 2 bags of Blue Bottle Espresso coffee beans under $40"* or "Book roundtrip flights to SF under $350").
Autonomous Micro-Procurement (< $50 limit):** Routine, verified orders under the user-defined threshold execute and capture instantaneously via the PayPal Orders v2 API and tokenized PayPal Vault agreements without human friction.
Human-In-The-Loop Escalation (> $50 limit): High-value purchases or anomalous risk transactions are automatically intercepted by the Guardrail Engine, generating a real-time, 1-click authorization card for administrative sign-off before funds are captured.
Merchant Defense Policy: Enforces domain blocklists and vendor verification to prevent agents from transacting with unauthorized or malicious domains.
Real-Time Audit Ledger: Complete compliance trail logging PayPal Order IDs, Capture IDs, itemized unit prices, and policy compliance tags.
How we built it
Frontend & Backend:** Built with Next.js 16.4 (App Router, Turbopack, React 19) and TypeScript, styled with Tailwind CSS v4 and Lucide icons. PayPal Integration: Integrated PayPal Sandbox REST APIs:
POST /v2/checkout/orderswith itemized line items, tax, and shipping breakdowns.- Tokenized PayPal Vault agreements (
/v3/vault/payment-tokens) so the AI agent never touches raw credentials. POST /v2/checkout/orders/{id}/capturefor programmatic fund disbursement. Guardrail Engine: Custom rule evaluator that monitors per-order caps, monthly budget velocity ($1,500 allowance), and domain risk scoring. Automated Testing Suite:** Developed an end-to-end test suite (verify-all.js) covering 30 programmatic assertions across API endpoints and headless browser UI flows.
Challenges we ran into
Handling Agent Non-Determinism:** LLMs can format pricing inconsistently; we enforced strict JSON schema parsing and fallback heuristic validation to guarantee exact amounts before generating PayPal order payloads. Dynamic Route Hydration in Next.js 16: Next.js 16’s new component cache required specific cache headers on the audit ledger routes to ensure real-time updates without full-page reloads.
Accomplishments that we're proud of
Achieving **100% test pass rate (30/30 assertions) across both the backend PayPal Sandbox API and live browser automation. Creating a practical, security-first architecture that directly unlocks real-world autonomous commerce without putting company funds at risk.
What we learned
- How to leverage PayPal Vault tokens to separate authorization from execution in autonomous agent workflows.
- The nuances of structuring multi-stage guardrails that provide both human safety and autonomous speed.
What's next for SovereignSpend
- Integrating multi-agent shared budgets for decentralized AI teams.
- Expanding merchant verification to automatically cross-reference PayPal Seller Protection status via webhooks.
Built With
- agents
- ai
- css
- next.js
- node.js
- orders
- paypal
- react
- sandbox
- tailwind
- typescript
- v2
- vault