Sahitya05/AgentPay

Autonomous Commerce Mandates & AI Merchant Growth Engine

β˜… 0Forks 0TypeScriptGitHub β†—Compare

README

AgentPay β€” Autonomous Agentic Commerce Protocol & Merchant AI Growth Engine

Developed for Razorpay AI Builder Internship Program 2026
Track: Track 1: AI Growth & Agentic Commerce
Author: Sahitya Allada


πŸš€ Overview

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:

  1. 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.
  2. 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.
  3. Merchant AI Growth Co-Pilot: Predictive analytics dashboard with churn risk detection, automated cart-churn micro-discounts, and agent conversion lift telemetry.
  4. Razorpay Sandbox Settlement Gateway: Authentic Razorpay modal integration with instant cryptographic mandate validation and payment signature generation.

πŸ› οΈ Architecture & Tech Stack

                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                          β”‚         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

⚑ Quick Start Guide

1. Start Python Backend (Port 8000)

python -m uvicorn backend.main:app --reload --port 8000

2. Start React Frontend (Port 5173)

cd frontend
npm run dev

Open http://localhost:5173 in your browser.


πŸ“œ Official Submission Details (Copy-Paste Ready)

Track Selected

Track 1: AI Growth & Agentic Commerce

Project Name / Title

AgentPay: Autonomous Commerce Mandates & AI Merchant Growth Engine

Project Objectives (What does it solve?)

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:

  1. 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.
  2. 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.
  3. 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.

Build Challenges & Technical Obstacles (What issues did you face, and how did you solve them?)

  1. 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.
  2. 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.
  3. 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.

Contributors

Sahitya05

Issues