AWS Builder Center

From Zero AWS to Serverless AI: Building a Real-Time UPI Fraud Detector at Bharat Builds

Stopping Fake UPI Screenshots at Checkout

From Zero AWS to Serverless AI: How I Built a Real-Time UPI Fraud Detector Solo at Bharat Builds

Going into the Bharat Builds Hackathon as a solo builder, I had a confession to make: I had barely touched AWS.
Like many developers, I knew the cloud concepts in theory, but when it came to stitching together a full serverless pipeline alone under a tight deadline, AWS felt like a massive black box. But hackathons have a funny way of forcing you into the deep end—and honestly? Building an end-to-end cloud architecture from scratch by myself was an absolute blast.
I set out to tackle a silent, rampant issue crippling daily commerce across India: fake UPI receipt scams. Here is the story of how I went from zero cloud experience to deploying UPI Interceptor—an end-to-end, serverless AI application that audits payment screenshots in under two seconds.

The Catchy Title & Meta Info for the Post

  • Primary Title: From Zero AWS to Serverless AI: Building a Real-Time UPI Fraud Detector Solo at Bharat Builds
  • Meta Description: How I built UPI Interceptor solo using AWS Lambda & Amazon Bedrock to detect fake UPI receipts in under 2 seconds—with zero prior AWS experience.
  • Subtitle: Fake UPI receipt apps are crippling daily retail commerce. Here is how I went from zero cloud experience to a fully deployed serverless AI audit pipeline in a single solo hackathon sprint.

The Problem: The High-Speed Fake Receipt Epidemic

With the massive adoption of UPI payments across India, bad actors have found an easy loophole: fake receipt generator apps. In seconds, anyone can create a pixel-perfect "Transaction Successful" screenshot for PhonePe, Paytm, or Google Pay.
Imagine a busy retail cashier at peak hour. They have a line of ten people waiting. Opening a bank app or waiting for an SMS notification to verify every single ₹50 or ₹500 payment simply isn't realistic. The result? Point-of-sale merchant losses every single day.
I wanted to build a tool that could instantly verify payment screenshots right at the counter without slowing down the queue.

The Architecture: Going Serverless Alone Under Pressure

As a solo developer, my absolute top priority was velocity. I couldn't afford to waste precious hours configuring servers, managing Docker containers, or debugging network clusters. I chose a completely serverless AWS stack paired with Next.js to do the heavy lifting:
[ Next.js 14 Frontend ] ──(POST /analyze)──> [ API Gateway ] ──> [ AWS Lambda (Python) ]
│
┌─────────────────────────┴─────────────────────────┐
▼ ▼
[ Amazon Bedrock (Claude 3.5 Sonnet) ] [ Amazon DynamoDB ]
(Multimodal Vision Analysis) (Merchant Audit Logs)

  • Frontend: Next.js 14 (App Router) + Tailwind CSS + SWR polling the live dashboard every 3 seconds.
  • AI Engine: Amazon Bedrock powering Anthropic’s Claude 3.5 Sonnet for multimodal vision analysis.
  • Serverless Backend: AWS Lambda (Python 3.12) hooked up via Amazon API Gateway ( POST /analyze ).
  • Database: Amazon DynamoDB ( MerchantTransactions  table) for real-time audit logging.
  • Hosting: AWS Amplify for seamless frontend deployment.

Key Technical Learnings & Battle Scars

1. Vision LLMs Need Strict Domain Rules, Not Generic Requests

My biggest eye-opener occurred during early testing. When I fed a fake PhonePe screenshot to Claude 3.5 Sonnet with a generic prompt like "Check if this screenshot is authentic," the model fell flat. It assumed the image was genuine simply because the layout looked plausible.
The Realization: Vision LLMs are naturally lenient unless given explicit domain constraints.
The Fix: I rewrote my Lambda prompt from a passive analyzer to an aggressive, domain-aware auditor by injecting hard Indian UPI validation rules:
  • Transaction ID Formatting: Real PhonePe IDs always begin with  T  followed by 20+ characters (e.g.,  T2609... ). Short strings or generic placeholders like  TXNDD1X2I3V  are immediate red flags.
  • Typography Auditing: Mandating checks for non-native system fonts, awkward pixelation around numeric amounts, and unaligned UI elements.
  • Timestamp Consistency: Cross-checking the phone's top status-bar clock against the transaction completion timestamp inside the receipt.
Once I injected explicit negative constraints into the prompt, accuracy flipped instantly flagging fake screenshots with 96%+ confidence.

2. Layer 1 (Visual AI) vs. Layer 2 (Bank Reconciliation)

During development, I stumbled into a crucial architectural distinction: Visual AI screenshot auditing is Layer 1, not the whole system.
  • Layer 1 (Visual AI): Catches edited screenshots, wrong fonts, and fake app templates in under 2 seconds directly at the cashier desk.
  • Layer 2 (Bank Reconciliation): Asynchronously checks the extracted UTR (e.g.,  423189271602 ) and amount against actual bank webhook feeds (PhonePe Business / Razorpay APIs).
A fast-paced solo hackathon forced me to focus strictly on Layer 1. However, by designing my DynamoDB schema to immediately store  extracted_utr  and  extracted_amount , I ensured the system was architected to plug directly into live bank feeds down the line without altering the core pipeline.

3. AWS Configuration Traps (And How I Survived Them)

When you are learning AWS on the fly during a solo sprint, small configuration gotchas can eat up precious hours:
  • API Gateway CORS Disasters: Connecting Next.js to API Gateway HTTP routes ( POST /analyze ) resulted in silent browser fetch failures until I explicitly configured CORS headers ( Access-Control-Allow-Origin: * ,  Access-Control-Allow-Methods: POST, OPTIONS ).
  • The Reserved  AWS_  Environment Prefix Trap: When deploying my Next.js frontend to AWS Amplify, my builds failed abruptly. I had named my custom environment variables  AWS_ACCESS_KEY_ID . AWS Amplify strictly blocks custom variables starting with  AWS_  because they are reserved for system internals. Renaming them to  APP_AWS_ACCESS_KEY_ID  resolved the build pipeline instantly.

The Result & Final Reflections

By the end of the sprint, I had shipped a fully live, hosted application on AWS Amplify.
A store cashier can now take or upload a receipt photo on their phone, get a visual verification check back in under two seconds, and watch the transaction log instantly populate on the store's live monitoring dashboard.
Takeaway: Tackle a hackathon solo with zero prior AWS experience felt daunting, but pairing serverless AWS architecture with multimodal AI proved to be the ultimate cheat code. You don't need a huge team or months of cloud administration background to solve real-world problems you just need the right primitives, clear domain logic, and a willingness to learn through trial by fire.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article