UPI Payment QR Code Scanner using ESP32 + Razorpay Integration
Project Overview
This project implements a low-cost, embedded UPI payment solution using the ESP32, designed for unattended systems like vending machines and kiosks. It dynamically generates UPI QR codes and verifies transactions in near real-time via a backend API integrated with Razorpay.
The system bridges embedded hardware + cloud APIs, enabling automated payment-triggered actions without requiring expensive POS hardware.
Core Features
- Dynamic UPI QR code generation
- Local configuration via ESP32 Access Point (AP mode)
- TFT display (ILI9341) for real-time QR rendering
- Backend payment verification using Razorpay APIs
- Trigger-based automation after payment confirmation
- Lightweight and scalable for multiple deployments
Hardware Stack
- ESP32 Development Board
- 2.8” TFT Display (ILI9341, SPI interface)
- 5V Power Supply
Software Stack
- Firmware: ESP-IDF (Embedded C)
- Backend APIs: PHP-based server
- Communication: HTTP/REST APIs
- Payment Gateway Integration: Razorpay (Enterprise Token-based validation)
System Architecture
- ESP32 runs in AP mode for initial configuration
-
User connects and submits:
- UPI ID
- Merchant Name
- Backend generates a UPI-compatible QR payload
- ESP32 renders QR code on TFT display
- Customer scans QR using any UPI app
- Payment request hits backend via Razorpay
- Server validates transaction status
- ESP32 polls or receives confirmation
- On success → triggers hardware action
Working Flow (Step-by-Step)
1. User Configuration (ESP32 AP Mode)
ESP32 starts in Access Point mode. User connects via mobile and opens a local web page to enter UPI ID and merchant name.

2. QR Code Generation
Entered details are sent to the backend (DigitalMonk server), which generates a valid UPI payment QR payload. ESP32 receives and displays it on the TFT.

3. Scan & Pay
Customer scans the QR code using any UPI app (GPay, PhonePe, etc.) and completes the payment.

4. API Verification
Backend (PHP APIs + Razorpay integration) verifies the transaction status using payment gateway APIs and checks if payment is successful.

5. ESP32 Action
ESP32 fetches/receives payment confirmation. If successful, it triggers the required action (e.g., dispense item, unlock system, etc.).
Use Cases
- Sanitary pad vending machines (schools, public places)
- Water dispensing systems
- Ticketing kiosks
- Smart donation boxes
- Small retail automation setups
Why This Matters
Traditional vending/payment systems rely on:
- Costly hardware
- Manual verification
- Limited digital integration
This project replaces that with:
- A fully programmable embedded solution
- Cloud-based payment validation
- Minimal hardware cost (~ESP32 + TFT)
Challenges & Considerations
- Handling network latency in payment verification
- Ensuring secure API communication (token-based auth)
- Managing edge cases (failed/partial payments)
- Reliable QR rendering within ESP32 memory constraints
Future Improvements
- Web dashboard for multiple device management
- MQTT/WebSocket for real-time push instead of polling
- Offline fallback + queued validation
- Integration with multiple payment gateways
For custom implementations or scaling this solution, you can also hire ESP32 developer services for production-ready deployments.
Conclusion
This project demonstrates how ESP32 + cloud APIs can be combined to build a practical, scalable, and affordable UPI-based payment system for real-world automation. It’s especially relevant for emerging markets where digital payments are widespread but infrastructure is still evolving.
Himanshu Dada