Inspiration
UPI AutoPay makes recurring payments easy to set up, but people may approve a mandate without understanding how its future charges compare with what they expected. We built MandateGuard to close the gap between what someone thinks they’re authorizing and the terms they actually review.
What it does
MandateGuard checks a payment plan against the customer’s expectations. A customer might enter, “Maximum $10 a month, with a 7-day trial.” MandateGuard reads the plan terms from PayPal Sandbox, compares them with that expectation, and explains any mismatch in plain language.
High-risk findings must be acknowledged before the server creates a subscription. After the customer approves through PayPal, the server verifies that the subscription is active and its terms match what they reviewed. Each decision is recorded in an audit trail.
A separate simulator demonstrates the same comparison engine using sample UPI AutoPay mandates. It is not connected to NPCI, a bank, or a live UPI service.
How we built it
We built the app with Next.js, TypeScript, and Tailwind CSS. PayPal Subscriptions Sandbox handles sample plans and approvals; Neon Postgres stores checkpoints and audit events. Google Gemini helps extract customer expectations and merchant claims, and draft plain-language explanations.
The comparison and pass-or-flag decision are deterministic TypeScript rules, not AI decisions. We validate extracted numbers and claims against the source text, and provide manual entry when Gemini is unavailable. The app is deployed on Render.
Challenges we ran into
Connecting the PayPal Sandbox flow, Gemini, and the database into one reliable checkpoint lifecycle took careful API and error handling. Billing terms also appear in different formats, so we had to normalize prices, trials, billing intervals, and commitments before comparing them.
AI extraction needed safeguards against unsupported numbers and claims. We addressed this with schema validation, source checks, exact-quote requirements for merchant claims, and a manual fallback.
Accomplishments that we're proud of
We built an end-to-end flow from customer expectation to checkpoint, PayPal Sandbox approval, subscription verification, and audit log. We’re proud that AI can help interpret the text while transparent rules determine the comparison and findings.
Validation: 50 tests passed, and TypeScript and the production build passed. The Gemini evaluation reached 18/20; two requests encountered temporary 503 errors. Lint completed with two unused-state warnings. Dependency installation reported 10 advisories: 8 moderate and 2 critical.
What we learned
AI can help interpret what someone means, but it should not make an opaque financial decision. Separating language extraction from deterministic comparison made findings easier to validate and explain.
We also learned that manual fallbacks, clear error handling, and audit trails are essential parts of a trustworthy payment experience.
What's next for MandateGuard
We’d like to explore a real UPI AutoPay integration through a bank or PSP partner, add a recheck when a customer changes their expectations, and build a user-controlled browser or app extension that can show a checkpoint before mandate approval. Before production use, we’d also review the reported dependency advisories and clean up the lint warnings.
Built With
- javascript
- neon
- next.js
- node.js
- paypal
- postgresql
- react
- render
- sdkpaypal
- tailwind
- typescript