Developed for Razorpay AI Builder Internship Program 2026
Track: Track 1: AI Growth & Agentic Commerce
Author: Sahitya Allada
AgentPay bridges the gap between modern autonomous AI agents (shopping bots, B2B procurement bots, SaaS auto-renewers) and Razorpay merchants.
As autonomous AI agents execute billions of commercial decisions by 2026, existing payment gateways only support human-driven checkout flows. Giving an AI agent payment privileges today is an all-or-nothing riskβeither full balance access or zero autonomy. On the merchant side, static checkout forms cannot negotiate bundles or capture dynamic agentic demand.
AgentPay solves this dual challenge:
- RAMT Cryptographic Mandates: Scoped, single-use spending mandates (velocity caps, merchant category whitelists, HMAC-SHA256 tokens) allowing AI agents to buy safely within user-defined budgets.
- Agent-to-Merchant (A2M) Real-Time AI Negotiation: A lightweight RPC protocol enabling buyer agents and merchant AI sales engines to negotiate volume discounts, dynamic bundling, and priority SLAs in <350ms per turn.
- Merchant AI Growth Co-Pilot: Predictive analytics dashboard with churn risk detection, automated cart-churn micro-discounts, and agent conversion lift telemetry.
- Razorpay Sandbox Settlement Gateway: Authentic Razorpay modal integration with instant cryptographic mandate validation and payment signature generation.
βββββββββββββββββββββββββββββββββββββββββ
β Vite + React Frontend β
β (Mandate Vault, A2M AI Studio, β
β Merchant Growth, Flow Graph) β
βββββββββββββββββββββ¬ββββββββββββββββββββ
β REST / WebSockets
βΌ
βββββββββββββββββββββββββββββββββββββββββ
β Python FastAPI Backend β
β - Mandate Engine (JWT Cryptography) β
β - A2M AI Negotiation State Machine β
β - Razorpay Python SDK Sandbox β
β - Merchant Telemetry Service β
βββββββββββββββββββββββββββββββββββββββββ
- Backend: Python 3.12, FastAPI, PyJWT, Razorpay Python SDK, WebSockets, Uvicorn
- Frontend: React 19, TypeScript, Vite 8, Recharts, Lucide Icons, Canvas Confetti, Custom Glassmorphic CSS System
python -m uvicorn backend.main:app --reload --port 8000cd frontend
npm run devOpen http://localhost:5173 in your browser.
Track 1: AI Growth & Agentic Commerce
AgentPay: Autonomous Commerce Mandates & AI Merchant Growth Engine
As AI agents increasingly handle day-to-day decisionsβfrom reordering inventory to booking travel and comparing D2C brandsβtraditional payment gateways aren't built to handle autonomous transactions. Right now, giving an AI agent payment privileges is an all-or-nothing risk: either you give it full card access, or it can't buy anything on its own. On the merchant side, businesses lose out because standard checkout flows can't negotiate bundles or capture dynamic agentic demand.
I built AgentPay to bridge this gap between autonomous AI agents and Razorpay merchants:
- Delegated Agent Mandates: Users can issue scoped, cryptographically signed budget tokens (e.g., "Spent max βΉ45,000 on SaaS before 8 PM") so AI agents can complete purchases safely without human intervention or overspending risk.
- Agent-to-Merchant (A2M) Negotiation: A lightweight protocol where buyer agents and merchant AI agents negotiate custom volume discounts, dynamic bundling, or shipping terms in milliseconds prior to checkout.
- Merchant Growth & Revenue Recovery: A merchant dashboard that tracks agentic revenue streams, uses AI to predict drop-offs, and automatically triggers smart micro-discounts for abandoned buyer agent sessions.
- Mitigating Latency During Live Agent-to-Merchant Negotiation:
- Challenge: When two LLMs negotiated price discounts directly over multi-turn API prompts, response times hovered around 3β4 seconds, causing agentic checkout timeouts.
- Solution: Replaced raw multi-turn LLM prompts with a hybrid rule-bounded state machine in Python. The LLM only evaluates edge cases while predefined parameter bounds handle quick counter-offers, bringing total negotiation latency down to under 350ms.
- Enforcing Cryptographic Velocity Caps Without Database Lock Contention:
- Challenge: Tracking high-frequency spend limits across concurrent agent transactions created race conditions where an agent could double-spend before the spend limit updated.
- Solution: Designed a single-use JWT-based Mandate Token signed with HMAC-SHA256, carrying spend limits, time bounds, and nonce checks validated statelessly at the API Gateway level before hitting Razorpay endpoints.
- Syncing Python Agent Execution with a Dynamic Web UI:
- Challenge: Showing live agent negotiation logs, webhook status changes, and network visualizer nodes simultaneously without UI jitter.
- Solution: Implemented WebSocket event streaming between the Python FastAPI backend and Vite/React frontend, managing client state updates via RxJS-style event queues for smooth UI updates.