Inspiration

AI agents are starting to hold real payment credentials. They read invoices, answer emails and call payment tools on their own. That is useful until one of them reads a poisoned invoice, splits a large payment into small ones, or gets stuck in a loop. The first time you learn about it should not be after the money is gone. We wanted the missing layer: a firewall between an agent and PayPal that decides every payment before it happens.

What it does

Purser is a gateway that sits between an AI agent and PayPal. The agent connects to it as an MCP server and uses the same kind of tools it would use with PayPal directly, including a payout tool. Every call goes through an 8-stage decision pipeline before any money moves:

  • Hard rules (15): allowed actions, currency, per-transaction, daily, weekly and monthly caps, velocity, structuring detection, blocklists, approval thresholds and allowlists. These are deterministic and cannot be talked around.
  • Payee trust checks: first-time payee, look-alike payee, vendor mismatch, recently changed payee details, and free-mail addresses for business vendors.
  • A tighten-only AI reviewer: an LLM can raise the bar (allow becomes hold, hold becomes block) but can never loosen a rule. It is hardened against prompt injection, its output is schema-validated, and it fails closed if it is unavailable.
  • Human approvals: held payments wait for a person, with exactly-once execution.
  • Kill switch and circuit breaker: anomalies freeze the agent's spending automatically.
  • Audit and reconciliation: every decision is explained and logged, and PayPal's signed webhooks are verified and matched back to the ledger so you can prove what actually happened.
  • Plain-English policy compiler: describe your spending rules in a sentence and Purser compiles them into a validated policy.

The Attack Lab lets you run four scenarios: a poisoned invoice with a look-alike payee (held), payment structuring (stopped), a runaway loop (frozen by the circuit breaker), and a normal payout (allowed and executed through PayPal).

How we built it

  • A TypeScript monorepo: a Fastify and MCP gateway, a React dashboard with AG Grid for the audit trail, a demo agent, and shared schemas.
  • PayPal integration through the Payouts API, Orders and captures, refunds, and webhooks verified with PayPal's signature verification. Upstream read tools come from the official PayPal MCP server running as a child process.
  • SQLite for the ledger, policies, approvals and audit log. Groq-hosted gpt-oss-120b for the reviewer and policy compiler, with a shipped verdict cache so the demo also runs in replay mode with no model calls and no money moved.
  • 539 automated tests across the server and the agent.
  • Deployed on Render. Everything runs against the PayPal sandbox.

Challenges

  • The PayPal MCP server has no payout tool, so we built purser_payout on the Payouts REST API and exposed it through the same gateway.
  • Making an LLM reviewer safe: untrusted invoice text is isolated and treated as data, the reviewer can only tighten a decision, and any failure means escalate to a human.
  • Exactly-once approvals and idempotency, so a retry or double-click cannot pay twice.
  • Reconciling against PayPal when reporting data lags: we use the signed webhook as the source of truth.

Accomplishments we're proud of

A real signed PayPal webhook arrives at the live site, passes verification and reconciles to its ledger row. The same pipeline stops a poisoned invoice, structuring and a runaway loop, and it explains each decision in plain language.

What we learned

Hard, deterministic rules should always decide the outcome, with the AI only allowed to make it stricter. That keeps the system predictable and still catches what rules can't see.

What's next

Multi-agent and per-agent budgets, more payment rails, team approval workflows, and anomaly baselines learned from each business's own history.

Try it

Open the live demo and click Try the demo. It runs in replay mode with no real money and no sign-in. Everything here runs on the PayPal sandbox.

Built With

Share this project:

Updates

Submission history