Inspiration
Every failed payment is not necessarily a lost customer — but without the right follow-up, it can become permanently lost revenue.
While building an EdTech platform, we noticed that the payment journey usually ends at "Payment Failed". There is often no intelligent system asking why it failed, whether the customer is likely to complete the purchase later, what intervention is appropriate, or when a human should take over.
That inspired us to build AI Eduportal: an AI-powered EdTech commerce platform where revenue recovery is treated as an intelligent, measurable workflow rather than a simple retry button.
Our goal was to build an agent that can understand customer and payment context, recommend an appropriate recovery strategy, operate within strict merchant-defined limits, and maintain a complete audit trail of its decisions.
What it does
AI Eduportal combines an EdTech platform with an AI-powered commerce and revenue-recovery layer.
AI-powered student assistance
The AI assistant understands a student's:
- Learning goals and interests
- Existing purchases
- Available courses and batches
- Course features and pricing
- Previous payment attempts
It uses this context to provide personalized course recommendations instead of making generic recommendations.
Intelligent payment recovery
When a payment fails, the system creates a revenue-at-risk signal containing the relevant payment and customer context.
The recovery workflow can then:
- Detect the failed payment
- Analyze the available payment/customer context
- Determine a potential recovery strategy
- Apply merchant-defined policies and limits
- Automatically recover eligible payments or escalate risky cases
- Generate a time-limited recovery offer when appropriate
- Allow the customer to retry payment
- Verify the Razorpay payment server-side
- Grant course access only after successful verification
- Record the complete recovery lifecycle
Bounded AI actions
We deliberately don't allow an LLM to directly control money-related actions.
The architecture follows:
AI proposal → Policy Engine → Safety Gate → Action → Audit Trail
The policy layer can enforce limits such as:
- Maximum discount
- Maximum automatically recoverable amount
- Retry limits
- Retry cooldowns
- Offer expiration
- Human escalation
This makes the agent more explainable and safer for financial workflows.
Recovery dashboard
Administrators can monitor:
- Revenue-at-risk signals
- Recovery offers
- Agent decisions
- Approval queues
- Recovery status
- Policy configuration
- Audit history
Additional AI automation
AI Eduportal also includes:
- RAG-based educational assistance
- AI course recommendations
- An AI Client Agent for project/lead workflows
- An Instagram automation agent
- Real-time notifications
- Payment and commerce analytics
How we built it
AI Eduportal is built as a full-stack system.
Frontend
- React.js
- Material UI
- Axios
- Socket.IO
- Responsive dashboards
Backend
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT authentication
- bcrypt
- Socket.IO
Payments
We integrated Razorpay for payment processing.
The backend never trusts the price sent by the browser. It retrieves the actual product price from the database before creating the Razorpay order.
After payment, the server verifies the Razorpay signature before creating/updating the purchase and granting access.
AI & RAG
The AI layer uses LLM providers with fallback mechanisms for resilience.
For educational retrieval, we built a RAG pipeline using embeddings and similarity search:
User question → Embedding → Relevant knowledge → LLM → Context-aware response
The commerce assistant additionally receives live catalog and user-specific context so that recommendations remain grounded in the actual products available in the system.
Revenue Recovery Agent
The core architecture is:
Payment Failure ↓ Revenue-at-Risk Signal ↓ Context + AI Analysis ↓ Recovery Proposal ↓ Policy Engine ↓ Safety Gate ↓ Auto Recovery / Human Escalation ↓ Recovery Offer ↓ Razorpay Retry ↓ Server-side Verification ↓ Recovered Revenue + Audit Trail
We intentionally separated AI reasoning from financial authorization. The AI can propose a strategy, but deterministic business rules remain the final authority over money-related actions.
Infrastructure
We also worked with:
- Redis-based rate limiting
- Sentry monitoring
- Docker
- Docker Compose
- Kubernetes configuration
- GitHub Actions CI/CD
- Cloud deployment
Challenges we ran into
The hardest part wasn't calling an AI API. It was making AI work safely inside a system that handles payments.
- Giving AI useful context
A generic chatbot wasn't enough. We needed the AI to understand the difference between:
- A course the student already owns
- A course they are considering
- A failed payment
- A previously generated recovery offer
- A currently available product
We solved this by combining database-backed commerce context with the AI layer.
- Preventing AI from making unsafe financial decisions
An LLM should never be trusted with unrestricted authority over discounts or payments.
We therefore introduced a policy and gating layer between AI reasoning and execution.
- Handling payment security
We had to ensure that users couldn't manipulate:
- Product prices
- Discount amounts
- Recovery offers
- Purchase access
- Payment verification
This required moving important decisions to the backend and verifying Razorpay payments server-side.
- Handling duplicate and unreliable payment events
Payment systems can produce repeated events and failures. We had to design the recovery workflow so that the same failed payment doesn't blindly create multiple recovery actions.
- Building multiple AI systems without making the architecture unmanageable
The project contains an educational assistant, recommendation system, revenue recovery agent, Client Agent, and Instagram automation.
Keeping these systems modular while allowing them to share authentication, commerce, and user context was a significant engineering challenge.
Accomplishments that we're proud of
We are especially proud that AI Eduportal evolved from a conventional EdTech application into a complete AI commerce and revenue-recovery platform.
A real revenue recovery lifecycle
We built the complete journey from:
Failed payment → revenue-at-risk → recovery decision → offer → retry → verified payment → course access
rather than stopping at payment failure detection.
AI with guardrails
One of our biggest accomplishments is the separation between AI reasoning and financial execution.
The AI can propose. The policy decides whether the action is allowed.
This makes the system much more suitable for real-world financial workflows.
Explainability and auditability
Agent actions retain information about the signal, reasoning, proposed action, policy decision, and execution result.
This allows an administrator to answer:
«What happened, why did it happen, and what did the system actually do?»
Secure payment handling
We built server-side price validation, Razorpay order creation, payment verification, recovery offers, and protected purchase access.
Context-aware AI
The assistant doesn't operate in isolation. It can work with live catalog information and relevant user/payment context to make more useful decisions.
Production-oriented architecture
We went beyond the basic application by incorporating:
- Authentication and authorization
- Rate limiting
- Security middleware
- Error monitoring
- Redis
- Docker
- Kubernetes
- CI/CD
- Real-time communication
- Multiple AI fallbacks
What we learned
The biggest lesson was that building an AI agent is much more than connecting an LLM to an API.
We learned that an effective agent needs:
Context + Reasoning + Tools + Policies + Guardrails + Observability
We also learned that deterministic systems are extremely important when AI interacts with money.
Instead of asking:
«"How can we let the AI do everything?"»
we started asking:
«"What should the AI be allowed to propose, and what should the system independently verify before anything happens?"»
This changed how we approached the entire architecture.
We also learned a lot about:
- Payment gateway integration
- Webhook-driven systems
- Server-side payment verification
- RAG architectures
- AI fallbacks
- MongoDB data modeling
- Agent orchestration
- Human-in-the-loop workflows
- Docker and Kubernetes
- Building reliable full-stack systems around AI
What's next for AI Eduportal
Our next goal is to make the revenue recovery system even more intelligent while keeping its financial controls deterministic.
Smarter failure diagnosis
We want to incorporate richer payment signals and historical patterns so the system can better distinguish between different recovery scenarios.
Recovery prediction
The system could predict the probability of recovery and prioritize high-value/high-probability cases.
More automated testing
We plan to expand automated testing around payment verification, recovery policies, webhook idempotency, security, and agent actions.
Revenue intelligence
We want to provide merchants with deeper insights such as:
- Revenue recovered
- Revenue at risk
- Recovery rate
- Best-performing interventions
- Customer recovery patterns
- Failed-payment trends
Human + AI collaboration
For high-value or uncertain cases, the system should become better at escalating the right cases to humans rather than simply automating everything.
Expand beyond EdTech
The underlying revenue-recovery architecture can be adapted to other businesses such as SaaS, subscriptions, marketplaces, and digital commerce.
Our long-term vision is to make AI Eduportal a platform where AI doesn't just help sell products — it actively helps businesses protect and recover revenue while remaining safe, explainable, and under human control.
Log in or sign up for Devpost to join the conversation.