💡 Inspiration

As autonomous AI agents evolve from conversational assistants into real-world executors, they hit a critical barrier: they can browse, analyze, and plan, but they cannot securely handle transactions. When users need to split complex expenses, negotiate multi-vendor purchases, or automate scheduled payments, existing systems force them back into manual web interfaces and cumbersome multi-step checkouts.

We built AI PAY to bridge the gap between artificial intelligence and commerce. Our vision is to turn PayPal's battle-tested financial rail into the native economic layer for AI agents—enabling natural language checkout, automated invoice reconciliation, and safe, human-in-the-loop autonomous payments.


⚡ What it does

AI PAY is an intelligent agentic payment copilot and backend orchestrator powered by the PayPal developer platform and Model Context Protocol (MCP).

Key capabilities include:

  • 🗣️ Natural Language Checkout & Invoicing: Users can chat or speak (e.g., "Generate an itemized invoice for my consulting client and send a payment request link" or "Order these developer subscriptions within my $100 budget"), and AI PAY executes the workflow instantly.
  • 🤖 Autonomous Agent Budgets & Approvals: Enables secondary autonomous agents to request payments or payouts, bounded by customizable spending limits and mandatory human authorization safeguards.
  • 👥 Contextual Split & Group Payouts: Automatically parses uploaded group receipts, calculates fair shares, and dispatches batch Payout requests via PayPal.
  • 🛡️ Guardrails & Audit Trail: Every agentic action is verified through PayPal Sandbox tokens and validated with cryptographic webhook signatures, ensuring no accidental double-spending or unauthorized transactions.

🛠️ How we built it

AI PAY was engineered with a modern, modular agentic architecture:

  1. PayPal AI Toolkit & MCP Server: We integrated PayPal's Model Context Protocol (MCP) server so our LLM orchestrator can query sandbox balances, draft orders, and construct payment payloads deterministically.
  2. PayPal REST APIs: We leveraged the PayPal Orders API v2 for secure customer checkouts, the Payouts API for automated payouts/transfers, and Webhooks for real-time transaction confirmation and state updates.
  3. Agent Framework & Brain: Built using FastAPI (Python) and LangChain / Claude 3.5 Sonnet, utilizing structured tool-calling to convert user intent into validated PayPal schema parameters.
  4. Interactive Frontend: Built with Next.js (React) and Tailwind CSS, embedded with the official PayPal JavaScript SDK button interface for seamless end-user approval.

🚧 Challenges we faced

  • Safeguarding Agent Autonomy: AI models can hallucinate parameters. Ensuring the AI strictly adheres to currency codes, valid itemized totals, and API idempotency required writing schema validation layers with Pydantic.
  • Handling Asynchronous Payment States: Payments don't complete instantaneously. Synchronizing webhook events (e.g., PAYMENT.CAPTURE.COMPLETED) back to the conversational agent memory required a persistent Redis event queue.
  • Designing Human-in-the-Loop Safeguards: Striking the balance between full agentic automation and financial safety by designing an interactive approval card before final capture.

🏆 Accomplishments that we're proud of

  • Successfully executing end-to-end sandbox payments triggered purely through agentic natural language prompts.
  • Seamless integration with the PayPal AI Toolkit, demonstrating how MCP enables developer tooling to interact directly with financial APIs.
  • Creating a clean, intuitive UI that visualizes both the agent's internal reasoning and the resulting PayPal transaction flow in real time.

📚 What we learned

  • How to implement the Model Context Protocol (MCP) to give AI agents direct, sandboxed access to payment primitives.
  • Best practices in PayPal webhook handling, token rotation, and test sandbox environments.
  • The UX paradigms required for "Agentic Commerce"—users don't just want automation; they want transparency and explicit control over transactions.

🚀 What's next for AI PAY

  • Multi-Agent Negotiation: Allowing customer agents to autonomously negotiate bulk discounts with merchant AI agents and settle directly via PayPal.
  • Smart Recurring Subscriptions: AI-managed subscription monitoring that automatically pauses or adjusts PayPal recurring billing based on usage analytics.
  • Production Mainnet Deployment: Transitioning from sandbox to live production with enterprise-grade OAuth scopes and biometric approval flows.

Built With

  • ai-agents
  • anthropic-claude
  • docker
  • fastapi
  • langchain
  • mcp
  • model-context-protocol
  • next.js
  • openai
  • paypal
  • paypal-ai-toolkit
  • paypal-checkout
  • paypal-sandbox
  • postman
  • pydantic
  • python
  • react
  • render
  • rest-api
  • tailwind-css
  • typescript
  • webhooks
Share this project:

Updates

Submission history