Built With Tags
next.js, react, typescript, tailwindcss, paypal, gemini-api, google-ai, channel3, render, render-workflows, ag-grid, turbopack, node.js, rest-api, agentic-ai
Inspiration
Modern online shopping is fragmented and friction-heavy. Consumers routinely juggle dozens of open browser tabs, sift through contradictory reviews, manually configure complex catalog filters, and re-enter payment details across disconnected merchant checkouts.
With the breakthrough reasoning and tool-calling capabilities of modern Large Language Models, we asked a fundamental question: What if the entire commerce lifecycle—from product discovery to final payment settlement—could happen within a single natural conversational interface with zero checkout friction?
We built PayAgent to bring PayPal's vision of Agentic Commerce to life. PayAgent bridges real-time multi-merchant inventory, autonomous intent parsing, and verified PayPal settlement into a unified, conversational shopping experience.
What it does
PayAgent is an autonomous AI shopping companion and execution engine that transforms natural language intent into verified PayPal transactions:
- 🤖 Conversational Product Discovery: Users express complex, subjective, or multi-attribute shopping queries (e.g., "Find me noise-cancelling wireless headphones under $80 for long flights" or "I need a minimal home office desk setup"). The AI uses function calling to search verified multi-merchant inventory in real time.
- 🛒 Dynamic Cart Management: The agent maintains session cart state, adds and removes items, checks stock availability, explains product trade-offs, and itemizes order totals dynamically.
- 💳 In-Chat PayPal Checkout: When the user is ready to buy, the agent calls the PayPal Orders v2 API to create an order token and dynamically mounts native PayPal Smart Payment Buttons directly inside the chat stream.
- 📊 Real-Time AG Grid Telemetry & Audit Trail: To eliminate the "black box" nature of AI, every user query, tool invocation, model reasoning trace, and PayPal capture ID is logged in real time to an interactive AG Grid dashboard (
/dashboard). - ⚡ Distributed Orchestration with Render Workflows: Background tasks such as cart inventory validation, order status monitoring, and merchant catalog syncs run reliably on Render Workflows.
- 🌗 Responsive Dual-Theme Interface: Includes a clean, modern aesthetic with persistent dark and light modes and zero layout shift.
How we built it
PayAgent was engineered from the ground up as a modern full-stack web application:
- Frontend: Built with Next.js 16 (App Router), React 19, and Tailwind CSS v4 for high-performance, hydration-safe rendering and responsive UI.
- AI Agent Intelligence: Powered by Google Gemini (
gemini-3.1-flash-lite/ Modern Gemini SDK) using multi-turn conversational memory and structured function calling (search_products,get_product_details,add_to_cart,remove_from_cart,view_cart,create_checkout). - Product Catalog & Search: Integrated Channel3's Agentic Commerce API to aggregate multi-merchant e-commerce products with automated fallbacks.
- Payment Gateway: Implemented server-side PayPal Orders v2 REST API (
/v2/checkout/ordersand capture endpoint) with secure OAuth 2.0 token handling, paired with@paypal/react-paypal-jsfor PCI-compliant in-chat checkout. - Data Grid & Analytics: Built with AG Grid Community v36 to provide real-time transaction monitoring, column filtering, search, and agent decision auditing.
- Cloud Infrastructure: Hosted on Render Web Services with automated zero-downtime deployment and Render Workflows for resilient background task orchestration.
Challenges we ran into
- Bridging LLM Non-Determinism with Financial State Safety: Language models can hallucinate product prices or calculate totals inconsistently. We solved this by enforcing strict server-side validation: the model never calculates prices on its own—it only triggers deterministic backend pricing routines that cross-reference verified catalog data.
- Next.js 16 & React 19 Hydration Mismatches: Server-side rendering mismatched client-side timestamps and dynamic PayPal SDK buttons. We resolved this using selective client-side dynamic imports (
ssr: false) and an inline<head>theme-hydration script to completely prevent Flash of Unstyled Content (FOUC). - Structured Function Calling Schemas: Formatting tool call responses with structured product arrays required strict key-value object wrapping to comply with Gemini's candidate parts schema.
- Tailwind v4 & Turbopack Production Bundles: Deploying Next.js 16 with Tailwind CSS v4 on cloud containers required moving
@tailwindcss/turbopackand core build tools into production dependencies to ensure seamless container builds.
Accomplishments that we're proud of
- ⚡ Sub-30-Second Purchase Velocity: Completed end-to-end shopping journeys—from an initial natural language prompt to a captured PayPal sandbox payment—in under 30 seconds.
- 🔍 Radical Agent Transparency: Implemented a full audit trail in AG Grid, giving users and developers complete visibility into tool parameters, model latency, and decision paths.
- 💳 Native In-Chat PayPal Integration: Integrated PayPal Smart Payment Buttons directly inside conversational message cards without forcing external redirects.
- ☁️ Zero-Downtime Cloud Deployment: Successfully deployed the full stack on Render with zero infrastructure costs while maintaining production reliability.
What we learned
- The Agentic Commerce Blueprint: Successful autonomous commerce requires pairing resilient background task orchestration (Render Workflows) with interactive, user-confirmed payment authorization (PayPal).
- Defensive Tool Engineering: Agent tools must be designed defensively with strict parameter types, structured return wrappers, and multi-model fallbacks to maintain resilience during high-demand spikes.
- Trust Through Visibility: Users readily trust AI assistants with shopping decisions when they retain explicit final approval on checkout and can audit the AI's reasoning.
What's next for PayAgent
- 🏷️ Autonomous Coupon Sourcing & Price Negotiation: Enabling the agent to query merchant discount APIs, stack valid promo codes, and negotiate bulk order discounts before checkout.
- 🔄 PayPal Subscriptions & Recurring Re-orders: Adding support for recurring payment agreements for consumable household staples and subscription products.
- 🎙️ Voice-First Shopping with Gemini Live API: Upgrading to bidirectional audio streaming so users can shop completely hands-free while driving or multitasking.
- 🌍 Dynamic Cross-Border Multi-Currency FX: Expanding PayPal multi-currency conversions to automatically calculate live duties, shipping fees, and foreign exchange rates at checkout.
Built With
- ag-grid
- agentic-ai
- channel3
- gemini-api
- google-ai
- next.js
- node.js
- paypal
- react
- render
- render-workflows
- rest-api
- tailwindcss
- turbopack
- typescript