PayPal AI Billing MCP Gateway
Integrates with PayPal Sandbox REST APIs and official PayPal MCP tools to manage invoices, orders, payments, captures, refunds, subscriptions, products, disputes, transaction history, receipts, and merchant insights through 82 unified MCP tools.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
PayPal AI Billing Kit
AI-Assisted Billing Workspace, Unified PayPal Sandbox Checkout & Settlement, Mistake-Recovery Workflows, Merchant-Branded PDF Receipts & 82-Tool Model Context Protocol (MCP) Gateway.
Live Public Endpoints
Endpoint | Public URL | Purpose |
Web Application (Vercel) |
| Interactive Provider & Customer Billing Workspace (Desktop & Mobile Web, zero login required) |
Local Development Server |
| Local Expo Web development server with Hot Module Replacement ( |
Dedicated Unified MCP Gateway (Cloudflare Worker) |
| Primary JSON-RPC 2.0 MCP Server ( |
Supabase MCP Edge Backend |
| Direct Supabase Edge Function JSON-RPC 2.0 MCP server with identical 82-tool registry and SHA-256 schema parity |
Vercel MCP Mirror |
| Mirror JSON-RPC 2.0 MCP endpoint proxying to the unified 82-tool gateway |
OpenAPI 3.1.0 Spec |
| Machine-readable OpenAPI 3.1.0 schema for ChatGPT Custom GPT Actions |
Interactive MCP Docs |
| Human-readable MCP documentation and |
Downloadable PDF Receipt API (Sample Link) |
| Sample PDF 1.4 receipt ( |
Related MCP server: @paypal/mcp
1. Project Overview & Problem Statement
The Problem
Service practices and small businesses lose significant time and revenue managing administrative billing exceptions: answering repetitive customer questions ("Why do I owe $75?", "Why was my payment declined?", "Can I pay both open statements at the same time?"), recovering from failed payment attempts, issuing partial or full refunds, and generating compliant receipts.
At the same time, connecting autonomous AI agents directly to payment APIs introduces serious risks unless the system enforces strict customer data isolation, sensitive-data filtering, monetary velocity limits, and human-in-the-loop buyer approval.
The Solution (@paypal-ai/billing-kit)
PayPal AI Billing Kit is a standalone, open-source AI billing, checkout, mistake-recovery, and Model Context Protocol (MCP) platform built for the PayPal AI Hackathon. It unites four layers in a single architecture:
Multi-Role Interactive Billing Workspace (
Provider&Customer): Instant role switching between Provider (Dr. Sarah Jenkins— Jenkins Wellness & Telehealth Practice) and Customers (Alex Rivera&Jordan Taylor) with per-visitor session isolation (X-Demo-Session-Id).Context-Isolated Billing AI Assistant (
Gemini 3.5 Flash-Lite): Explains statement line items and due dates, diagnoses declined payment attempts, answers natural-language account questions, and prepares single-statement or combined multi-statement payment proposals (PPB-PROP-1...) governed by$500.00single-action and$2,500.00daily velocity guardrails.Unified PayPal Sandbox Checkout, Failed-Payment Recovery & Merchant-Branded PDF Receipts: Supports both interactive PayPal Sandbox Browser Checkout (
appSwitchEligible=false) and automated server-side PayPal Sandbox Direct Card Checkout (Orders v2 payment_source.card), featuring a unifiedPay with PayPal/Retry with PayPal→PAID→View Receiptworkflow and downloadable PDF 1.4 receipts.Unified 82-Tool MCP Gateway (
21 Native+47 Official PayPal MCP+14 PayPal Sandbox REST Adapters): Provides ChatGPT, Claude Desktop, and custom AI agents with a single JSON-RPC 2.0 endpoint (2025-06-18) combining application billing workflows with PayPal's official MCP tool catalog and Sandbox REST APIs.
2. Current Verified Features
Responsive Provider & Customer Dashboards (
1440px+Desktop &390pxMobile):Collapsible PayPal Merchant Sandbox Card: Renders as a clean, compact status bar (
SANDBOX AUTHENTICATED+Show Details) by default so billing KPIs and statements remain primary, expanding on demand (Hide Details) to display OAuth 2.0 connection metadata, Sensitive-Data Firewall verification, and Sandbox controls.Compact Mobile Header & Scrollable Demo Bar: On mobile viewports (
< 768px), the top header stays compact while the demo account switcher scrolls naturally with page content.Global Billing Search: Instant modal and inline search across authorized Invoices, Customers, Transactions/Payments, and Refunds with subtle focus styling and zero double-border artifacts.
Responsive Statement Details Modal & Unified PayPal Settlement Flow:
Widened desktop modal (
maxWidth: 680px) with comfortable mobile margins and zero upper-scroll clipping.Single Consistent Primary Action: Uses
Pay with PayPalfor open statements andRetry with PayPalfor failed statements (#PPB-INV-2026-1004).Instant Retry Recovery: Clicking
Retry with PayPalsettles the statement toPAID(Remaining Balance Due: $0.00), automatically clears stale "Last Payment Attempt Declined" banners, displays the green Verified PayPal Sandbox Settlement banner, and transitions the primary footer button toView Receipt.
Billing AI Assistant (
Gemini 3.5 Flash-Lite) & Combined Multi-Statement Proposals:Header
New ChatCompose Button: Located in the upper-left corner of the Billing AI modal header opposite the close button ([New Chat] Billing AI [X]), resetting only the active(sessionId, accountKey, role, invoiceId)conversation thread.Strict Per-Statement & Per-Customer Thread Isolation: Opening Billing AI on
#PPB-INV-2026-1002vs#PPB-INV-2026-1003or switching betweenAlex RiveraandJordan Taylormaintains completely separate conversation histories.Single & Combined Multi-Statement Proposals: Asking "Can I pay both open statements at the same time?" directly answers "Yes — you can settle all 2 open statements together" and prepares a single combined
$225.00 USDpayment proposal covering#PPB-INV-2026-1001 ($150.00)+#PPB-INV-2026-1002 ($75.00).Centered Composer Alignment & Truthful Processing State: Vertically centered input text, placeholder, and caret (
minHeight: 44px) with an accessible"Preparing your response…"indicator.
Strict Dual-Ownership Customer Notification Isolation & Deep-Linking:
Every customer sees only notifications where both
recipient_profile_idand the linked invoice'spatient_idmatch the active customer (Alex Riverasees only#PPB-INV-2026-1001,#PPB-INV-2026-1002, and#PPB-INV-2026-1003;Jordan Taylorsees only#PPB-INV-2026-1004and#PPB-INV-2026-1006).Tapping any notification verifies ownership, marks it read, and deep-links directly into Statement Details with a
← Back to Notificationsnavigation chip.
Deterministic Demo Reset (
Reset Demo):Restores all 6 canonical statements (
#PPB-INV-2026-1001through#PPB-INV-2026-1006), clears session AI chats, and resets customer notifications to their canonical unread state, displaying a temporary floating toast banner that automatically dismisses after 3.2 seconds.
3. Public Application Screenshots (docs/screenshots/public/)
Provider & Customer Billing Dashboards
Provider Billing Dashboard ( | Customer Billing Dashboard ( |
|
|
Collapsible PayPal Merchant Sandbox Connection Card
Compact Default State ( | Expanded Diagnostics & Firewall State ( |
|
|
Billing AI Assistant: Header New Chat, Invoice Q&A & Failed Payment Diagnosis
Invoice Explanation & Header | Failed Payment Investigation ( |
|
|
Statement Details Modal, PayPal Sandbox Checkout & Verified Settlement Receipt
Responsive Statement Details Modal ( | PayPal Sandbox Browser Checkout Interface ( | Settled Payment & Merchant-Branded Receipt ( |
|
|
|
Customer Notification Isolation, Global Search & Unified 82-Tool MCP Interface
Customer Notification Isolation ( | Global Billing Search Modal | Unified 82-Tool MCP Agent Interface |
|
|
|
Mobile Responsiveness (390×844 Viewport)
Mobile Dashboard ( | Mobile Billing AI & Combined Multi-Statement Proposal ( |
|
|
4. Architecture & Unified 82-Tool MCP Gateway
The PayPal AI Billing Kit exposes all 46 official PayPal Model Context Protocol (MCP) tools alongside our native application workflows and REST adapters, forming a comprehensive 82-tool unified gateway. The gateway architecture (worker/src/index.ts and Supabase Edge Functions) registers every official PayPal MCP tool by its exact canonical name and executes transactions through a high-reliability PayPal Sandbox REST v1/v2/v3 execution bridge (https://api-m.sandbox.paypal.com) backed by server-side OAuth 2.0 client-credentials authentication (APP-5SK74342S6474230W), human-in-the-loop monetary guardrails, and real-time schema parity.
Honest Execution Classification Across All 46 Official PayPal MCP Tools
Live individual verification (npm run verify:full-paypal-mcp, recorded in evidence/full-paypal-mcp-verification.json) establishes the exact operational breakdown:
Verification Status | Tool Count | Meaning & Exact Tools |
|
| Full end-to-end live execution ( |
|
| Reaches live PayPal Sandbox API and returns structured domain-state validation:• |
|
| Blocked by missing OAuth 2.0 scopes on PayPal Sandbox |
|
|
|
|
|
|
Execution Summary Across All 14 PayPal Sandbox REST-to-MCP Adapters
13/ 14 Fully Executed Live (PASS_LIVE_SANDBOX/PASS_REST_ADAPTER):execute_sandbox_card_payment,run_sandbox_card_lifecycle_test,paypal_get_order,paypal_get_refund,paypal_list_invoices,paypal_generate_invoice_number,paypal_list_disputes,paypal_check_card_eligibility,update_plan,paypal_list_webhooks,paypal_list_webhook_event_types,paypal_list_invoice_templates, andpaypal_create_vault_setup_token.1/ 14 Buyer-Approval Validated (PASS_NEGATIVE_AUTHORIZATION):paypal_authorize_order(POST /v2/checkout/orders/{id}/authorizereturns422 ORDER_NOT_APPROVEDon an unapproved wallet order).
5. Security, Privacy & Customer Isolation Guardrails
Human-in-the-Loop & Conversational Authorization (
require_human_approval = true):Financial write operations require either a cryptographic HMAC-SHA256
proposal_id(PPB-PROP-1...) or an explicit natural-languageuser_instructionvalidated byevaluateConversationalAuthorization.Capability inquiries ("Can you refund an invoice?") and hypothetical questions ("What would happen if I voided this?") return explanations or previews without mutating records.
Monetary Velocity Guardrails (
$500.00Single-Action /$2,500.00Rolling Daily Cap):Server-enforced across both the Gemini AI Assistant (
billing-ai-assistant) and the Unified MCP Gateway (worker/src/index.ts). Any request exceeding$500.00(50000minor units) is blocked withGUARDRAIL_SINGLE_ACTION_LIMIT_EXCEEDED.
Sensitive-Data Payload Firewall (
block_clinical_data = true):Strips private notes and non-billing fields before any request reaches PayPal (
packages/paypal-billing-kit/src/firewall.ts). Only allowlistedADMIN-*service codes (ADMIN-TELEHEALTH,ADMIN-COPAY,ADMIN-FORMS,ADMIN-OFFICE,ADMIN-NOSHOW,ADMIN-FOLLOWUP), statement numbers, and USD amounts are transmitted to PayPal.
Strict Customer Notification & AI Thread Isolation:
Customer notification queries filter by both
recipient_profile_idand linked statementpatient_idso one customer never sees or opens another customer's statements or notifications.Billing AI conversation threads are keyed by
(sessionId, accountKey, role, invoiceId)and cleared immediately on demo reset or session switch.
Zero Raw Card Credentials (
RAW_CARD_CREDENTIALS_FORBIDDEN):Direct card checkout accepts only symbolic Sandbox test profile identifiers (
visa_sandbox,mastercard_sandbox,amex_sandbox,decline_refused,decline_expired,decline_insufficient_funds) resolved server-side inside the Supabase Edge Function.
6. Local Development & Verification Suite
Prerequisites
Node.js
>= 20.x& npmOptional environment variables for local Edge Function / Sandbox execution (never committed to Git):
EXPO_PUBLIC_SUPABASE_URL(https://dvzfesfvefggnunkjhom.supabase.co)EXPO_PUBLIC_SUPABASE_ANON_KEY(public anon key)Server-side Supabase Edge secrets:
PAYPAL_SANDBOX_CLIENT_ID,PAYPAL_SANDBOX_CLIENT_SECRET,GEMINI_API_KEY
Commands
# 1. Install dependencies
npm install
# 2. Start local Expo Web development server with HMR (http://localhost:8081)
npm run web
# 3. Static TypeScript verification (0 errors)
npm run typecheck
# 4. Run Jest unit & component tests (19 tests across 4 suites)
npm test -- --watchAll=false
# 5. Run local UI, Billing AI conversation & customer notification isolation suites
node scripts/verify-billing-notification-isolation.mjs
node scripts/verify-billing-ai-conversations.mjs
node scripts/verify-local-ui-and-ai-e2e.mjs
# 6. Verify all 82 Unified MCP Tools against live PayPal Sandbox
npm run verify:full-paypal-mcp
# 7. Run full 25-stage automated PayPal Sandbox, MCP, Card Lifecycle & Security verification
npm run verify:paypal-full
# 8. Verify all 82 Unified MCP Gateway tools across Cloudflare Worker + Supabase + Vercel
npm run verify:mcp
# 9. Verify Gemini 3.5 Flash-Lite AI, Proposal Security, Guardrails & Conversational Authorization
npm run verify:ai-security
# 10. Verify Gemini 3.5 Flash-Lite multi-turn thoughtSignature & 8 Merchant-Branded PDF Receipt cases
npm run verify:gemini-receipts
# 11. Run public repository hygiene & secret isolation scans
npm run verify:repo-hygiene
npm run scan:secrets7. Demo Walkthrough Instructions (For Evaluators)
Open the Application: Open
http://localhost:8081locally (orhttps://paypal-ai-billing-kit.vercel.app) — opens directly on the Provider Billing dashboard as Dr. Sarah Jenkins with zero login friction.Inspect the Collapsible PayPal Merchant Sandbox Card: Click
Show Detailson the compact PayPal Merchant Sandbox card to inspect OAuth 2.0 status and the Sensitive-Data Firewall, then clickHide Details.Test Billing AI & Combined Multi-Statement Proposals (
Alex Rivera): Switch toCustomer: Alex Rivera, open Billing AI on#PPB-INV-2026-1002, and ask:"Why do I owe $75 on invoice #PPB-INV-2026-1002 and when is it due?""Can I pay both open statements at the same time?"(prepares a single combined$225.00 USDpayment proposal covering#PPB-INV-2026-1001+#PPB-INV-2026-1002).Click the
New Chaticon in the upper-left corner of the modal header to start a fresh thread for the active invoice.
Verify Customer Notification Isolation & Failed-Payment Recovery (
Jordan Taylor): Switch toCustomer: Jordan Taylor, click the Notifications (bell) icon to verify Jordan sees only Jordan's own alerts (#PPB-INV-2026-1004&#PPB-INV-2026-1006), tap#PPB-INV-2026-1004to open Statement Details, and clickRetry with PayPal. Watch the statement transition immediately toPAID($0.00remaining balance) and the primary button change toView Receipt.Test the 82-Tool Unified MCP Agent Interface: Click
MCP Agent Interfacein the top bar and clickTest Live MCP Tool Callto run a live JSON-RPC 2.0 request.Reset Demo Session Anytime: Click
Reset Demoin the top bar to restore all 6 canonical statements, AI chats, and customer notifications.
8. Verifiable Test Results & Evidence Artifacts (evidence/)
Verification Suite | Command | Result | Evidence File |
TypeScript & Jest Unit Suite |
|
| |
Customer Notification Isolation Suite |
|
|
|
Billing AI Conversation & Multi-Statement Suite |
|
| |
Local UI & AI Playwright E2E Suite |
|
| |
Full 82-Tool PayPal MCP & REST Adapter Verification |
|
|
|
Live 3-Endpoint MCP Protocol & Security Suite |
|
| |
Gemini 3.5 Flash-Lite AI & Conversational Security |
|
|
|
25-Stage Live PayPal Sandbox End-to-End Proof |
|
| |
Merchant-Branded PDF 1.4 Receipts Verification |
|
| |
Public Repo Hygiene & Secret Isolation Scans |
|
|
|
See docs/UNIFIED_MCP_AND_SECURITY_ARCHITECTURE.md, CHANGELOG.md, and evidence/README.md for complete documentation.
License
MIT License — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Pink Agentic AI Payments: AI agents pay within spending rules (budgets, caps, approval). Sandbox.
Invoicing tools for AI assistants: clients, draft invoices with computed tax, and email sending.
Trickl for AI assistants: full docs, setup plans, and sandbox tools to test purchases end to end.
Free invoice drafts, templates and direct PDF generation for AI agents. No account needed.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to create PayPal invoices through a simple tool interface.-

@paypal/mcpofficial
AlicenseNot gradedqualityDmaintenanceEnables integration with PayPal APIs for managing invoices, payments, disputes, subscriptions, and more through natural language.1,227 npm13Apache 2.0- AlicenseNot gradedqualityBmaintenanceEnables external AI agents to search a PayPal sandbox storefront, create and track orders, request refunds, and open disputes within buyer-set spending mandates, while every charge still requires buyer approval in PayPal.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to create orders, capture payments, issue refunds and send payouts against the PayPal sandbox through four guarded MCP tools, where every call is authenticated, validated, risk-scored and policy-checked, risky actions wait for human approval, and all state changes land in a tamper-evident hash-chained audit log.MIT













