People are starting to ask AI assistants to find deals and shop online—but would you hand an AI agent your PayPal account or credit card with zero guardrails?
Without strict spending rules, an AI hallucination, prompt-injection trick, or sneaky merchant rush fee can easily drain your budget. We built AgentPay AI to put a programmable financial safety layer between AI shopping assistants and PayPal checkout.## Inspiration
People are starting to ask AI assistants to find deals and shop online—but would you hand an AI agent your PayPal account or credit card with zero guardrails?
Without strict spending rules, an AI hallucination, prompt-injection trick, or sneaky merchant rush fee can easily drain your budget. We built AgentPay AI to put a programmable financial safety layer between AI shopping assistants and PayPal checkout.
What it does
AgentPay AI orchestrates a 3-helper agent pipeline (Store Searcher → Fee Inspector → Safe Checkout) with strict human-in-the-loop protection:
- Enforces Your Budget & Rules: You type what you want (e.g., "developer laptop under $900") or configure custom tolerance/approval thresholds in My Rules.
- Catches Hidden Fees Live: Evaluates merchant quotes line by line. When an unverified store quotes
$949.00with a sneaky$100unauthorized rush fee, the Policy Auditor blocks it immediately, explains why in red, and selects the compliant PayPal Verified merchant (Official Dell Direct —$849.00), saving you$100. - Zero Autonomous Overspending: Payments above your auto-approve threshold pause for 1-Click Approval via PayPal before any order is captured.
- Live PayPal Orders v2 Settlement & Persistence: Captures the sandbox transaction via PayPal OAuth2 + Orders v2 API, records the receipt in Neon Serverless Postgres (with instant
localStorageoffline failover), and displays interactive store comparison and audit ledger history in AG Grid. - Open MCP Server (
/api/mcp): Exposes guarded JSON-RPC 2.0 commerce tools (paypal_search_catalog,paypal_check_purchase_policy,paypal_create_order,paypal_capture_order) so external AI assistants like Claude Desktop, Cursor, or ChatGPT can safely inspect prices and trigger policy-checked checkouts.
How we built it
- Payments & Schema Safety: PayPal Orders v2 REST API + OAuth2 client credentials validated against OpenAPI contracts via APIMatic before dispatch.
- AI & Search: Google Gemini (
gemini-3-flash-previewwith automatic model waterfall) paired with Channel3 catalog lookup and Elastic hybrid BM25/cluster relevance ranking. - Safety Shield: Deterministic pre-checks reject non-shopping requests, impossible budgets (
$0/$15), and adversarial prompt-injection attempts before LLM calls. - Data Grids & Persistence: AG Grid interactive comparison & ledger tables with CSV export; Neon Serverless Postgres (
/api/ledger,/api/policy) with circuit-breaker failover. - Automation, Hosting & Testing: Zapier Catch Hook webhooks for blocked-fee and capture alerts; deployed on Render (
render.yaml) with Postman, Vitest, and Playwright.
Challenges we ran into
- Preventing Budget Bypass & Prompt Tricks: Ensuring user-set spending caps stay server-enforced and cannot be overridden by tricky prompt text or hidden merchant surcharges.
- Resilient Fallbacks Across Free Tiers: Building circuit-breaker fallbacks for Neon Postgres, Gemini, Channel3, and Elastic so judges can test the entire end-to-end flow immediately in 1 click without signing up.
- Fixing Portal Popups & Responsive Modals: Diagnosing transparent AG Grid v36 filter popups inside dark-mode cards and fixing viewport-clipped modal scrolling across desktop and mobile.
Accomplishments that we're proud of
- Live end-to-end PayPal Sandbox order creation and capture paired with real hidden-fee protection.
- 1-Click Guest Demo on Render with zero login wall.
- Automated QA suite: 43 unit & API route tests (
Vitest), 7 live edge/sponsor checks, 6 real-Chrome Playwright E2E specs, and a ready-to-run Postman collection.
What we learned
Financial AI agents work best when deterministic policy rules and OpenAPI schema checks sit outside the LLM—letting the model reason about products while hard code protects the wallet.
What's next for AgentPay AI
- Multi-store split cart checkouts under a single unified budget cap.
- Automated background price-drop alerts via Zapier + scheduled watchlist checks.
Built With
- ag-grid
- apimatic
- channel3
- elasticsearch
- gemini
- mcp
- neon
- next.js
- node.js
- openapi
- paypal
- playwright
- postgresql
- postman
- react
- render
- rest-api
- tailwindcss
- typescript
- vitest
- zapier