💡 Inspiration

Today, online shopping is fragmented and friction-heavy. Consumers spend an average of 15 minutes hunting for expired coupon codes across external sites, struggle to split group expenses with friends across disconnected apps, and face unpredictable cross-border exchange markups. At the same time, merchants lose over \$48 billion annually to checkout fraud, bot abuse, and out-of-sync retail POS inventories.

We asked ourselves: What if an autonomous AI agent could orchestrate the entire commerce lifecycle—discovering products, automatically verifying promotional savings, assessing fraud in real-time, splitting bills with friends, and capturing payments with zero-trust security in under 30 seconds?

That vision led to PayPilot AI — an enterprise-grade Autonomous Agentic Commerce Platform fusing multi-tool AI reasoning with the complete PayPal Developer Platform and AG Grid Enterprise telemetry.


🚀 What It Does

PayPilot AI bridges the gap between conversational generative AI and authoritative financial execution:

  1. Autonomous Agentic Copilot (/copilot): A full-page, multi-step conversational assistant supporting voice speech-to-text and natural voice output. It queries catalog availability, validates promotional savings, calculates fraud risks, and generates immutable, cryptographically locked order quotes.
  2. PayPal Honey Smart Coupon Engine: Automatically discovers, parses, and tests stackable discount codes (HONEY20, PAYPALAI, DEVPOST10), computes maximum savings, and awards Honey Gold reward points.
  3. PayPal Simility AI Risk Guard: Analyzes user velocity, device headers, and transaction heuristics in real-time before transactions touch the payment gateway, assigning risk scores from 0 to 100.
  4. Venmo Social Bill-Split: Automatically divides totals among friends, calculating exact per-person shares with direct Venmo deep links: $$\text{Share}_i = \frac{\text{Total}}{N}$$
  5. PayPal Xoom Cross-Border FX: Provides international shoppers with transparent, guaranteed exchange rate locks without surprise foreign conversion fees.
  6. PayPal Zettle Omnichannel POS Sync: Keeps physical point-of-sale store inventory and central warehouse databases synchronized in real-time.
  7. Server-Authoritative Checkout (/checkout): Eliminates client-side price tampering by enforcing strict server-side validation against authoritative database records: $$\text{Authoritative Total} = \sum_{j=1}^{k} (\text{Price}j \times \text{Qty}_j) - \text{Discount}{\text{Honey}} + \text{Tax} + \text{Shipping}$$
  8. Enterprise AG Grid Merchant Operations Hub (/dashboard): High-performance merchant telemetry featuring sub-millisecond filtering, multi-column sorting, inline retail POS stock adjustments, and one-click CSV financial audit exports.
  9. Printable Official Tax Invoices & Instant Refunds (/orders/[id]): Generates audit-compliant printable tax invoices with an autonomous AI dispute resolution engine authorizing instant PayPal sandbox refunds.

🛠️ How We Built It

PayPilot AI is built as a production-ready TypeScript monorepo architected across clean layers:

  • Frontend (apps/web): Next.js 14 App Router, React 18, Tailwind CSS, Lucide icons, and AG Grid Enterprise Community for high-throughput merchant tables.
  • Backend API (apps/api): Node.js, Express, TypeScript, Zod schema validation, and Pino structured logging.
  • Shared Contracts (packages/contracts): Strictly typed DTOs and API response interfaces shared between client and server.
  • Database & State Machine: SQLite (development) and PostgreSQL (production) managed via Prisma ORM with custom dual-client compilation for monorepo workspaces.
  • PayPal Integration: PayPal Orders v2 REST API (/v2/checkout/orders), PayPal Captures API, PayPal Webhooks receiver, and Venmo funding sources.
  • API Standards & Testing: APIMatic-ready OpenAPI 3.1 specifications (docs/openapi.yaml), Postman collection, and a 20/20 Vitest automated integration test suite.
  • Deployment: Production Blueprint (render.yaml) deploying frontend and backend services on Render Cloud.

🧠 Challenges We Faced

  1. Zero-Trust Financial State: LLMs can hallucinate and client browsers can be manipulated. We designed a strict state machine where the AI Copilot and client are never trusted with prices or discounts. Quotes are cryptographically hashed and verified server-side before calling PayPal's Orders API.
  2. PayPal Sandbox Capture Semantics: Sandbox PayPal captures fail with 422 if arithmetic breakdowns do not match to the exact cent. We implemented floating-point cent normalization ensuring item_total + tax + shipping - discount === amount.value.
  3. Monorepo Workspace Type & Client Resolution: Dual Prisma client generation was required across root and apps/api packages so automated CI test pipelines and runtime servers resolve generated types seamlessly.
  4. Fluid Responsive Modals vs Dedicated Page Routing: Eliminating modal backdrop blur traps by migrating primary flows (Copilot, Auth, Checkout, Invoices) to dedicated Next.js App Router routes with natural scroll behavior.

🏆 Accomplishments That We're Proud Of

  • ✅ 100% Passing Automated Tests: 20 out of 20 Vitest integration tests passing in under 800ms across all commerce and payment engines.
  • ✅ 7 Integrated PayPal Ecosystem Pillars: Seamless orchestration of PayPal Orders, Honey, Simility, Zettle, Venmo, Xoom, and Pay in 4.
  • ✅ 1-Click Judge Demo Tour: Floating interactive tour with 7 instant scenarios demonstrating end-to-end buyer, security, and merchant workflows.
  • ✅ Enterprise AG Grid Hub: Sub-millisecond client-side filtering, column pinning, and CSV export capable of scaling to 50,000+ SKUs.

📚 What We Learned

  • How to orchestrate multi-tool agentic workflows with deterministic financial constraints.
  • Advanced PayPal v2 API lifecycle management (intent, order creation, capture, and idempotent webhooks).
  • Structuring robust enterprise data grids with AG Grid for high-velocity merchant telemetry.
  • Managing Infrastructure-as-Code blueprints on Render for unified full-stack deployments.

🔮 What's Next for PayPilot AI

  • Autonomous Multi-Agent Negotiations: Enabling merchant agents and buyer agents to dynamically negotiate volume discounts.
  • In-Store PayPal Zettle NFC Tap-to-Pay: Extending the web assistant to physical retail handheld terminals.
  • Predictive Restocking: AI inventory forecasting triggering automated B2B working capital draws via PayPal Swift Financial.

Built With

Share this project:

Updates

Submission history