Inspiration
Autonomous AI agents are now capable of writing code, deploying infrastructure, and running data workflows. However, granting agents payment capability has
remained a critical bottleneck. A single runaway loop or prompt injection attack could drain bank accounts within minutes. We built **PayAgent** to bridge this
trust gap by inserting a deterministic policy and budgeting guardrail between the autonomous LLM decision loop and the PayPal Orders v2 API.
## What it does
PayAgent is an autonomous agentic commerce protocol that:
1. **Understands Commercial Intent:** Parses user requests or multi-step agent tasks to find necessary digital goods (compute GPUs, vector storage, LLM token
packs, domains).
2. **Enforces Deterministic Guardrails:** Evaluates single-order caps ($35), rolling 24-hour spend ceilings ($150), category whitelists, and vendor reputation
scoring before touching financial rails.
3. **Automates PayPal Orders v2:** Seamlessly creates and captures sandbox orders using PayPal's `/v2/checkout/orders` REST API.
4. **Human-in-the-Loop Escalation:** Automatically stages orders above autonomous thresholds ($25) and generates a one-click PayPal checkout approval URL for
human operator authorization.
5. **Real-Time Audit Ledger:** Logs an immutable compliance record with PayPal Order IDs, risk scores, and capture IDs.
## How we built it
- **Runtime & Language:** Built with Bun and native TypeScript for sub-millisecond execution latency.
- **Payment Gateway:** Direct REST integration with PayPal Orders v2 (`/v2/checkout/orders` and `/v2/checkout/orders/{id}/capture`) with dual-mode sandbox
simulation.
- **Guardrail Engine:** Policy evaluator managing rolling daily spend rollover, category filtering, and risk scoring.
- **Telemetry UI & WebSockets:** Glassmorphism FinTech dashboard with real-time SSE/WebSocket telemetry streaming every decision phase.
## Challenges we ran into
Balancing autonomous speed with strict safety. We designed a staged order authorization pattern where low-risk micro-purchases settle autonomously in
milliseconds, while higher-value or policy-borderline orders pause into a staged PayPal approval flow without crashing agent execution.
## Accomplishments that we're proud of
- 100% test coverage across boundary conditions and PayPal integration flows.
- Zero external runtime bundle dependencies.
- A functional proof-of-concept for the future of safe Agent-to-Business (A2B) commerce.
## What we learned
How PayPal's developer platform can serve as the universal identity, authentication, and settlement layer for the emerging autonomous software agent economy.
## What's next for PayAgent
- Multi-currency support with dynamic FX conversion.
- Agent-to-Agent (A2A) micro-negotiation protocols.
- Webhook listener for asynchronous PayPal capture callbacks.