UPI QR Code Generator API
A lightweight API for generating UPI QR codes and rendering a secure payment page. This project is built using Go and
the Gorilla Mux router.
Example of payment page
Features
- Generate QR codes for UPI payments.
- Serve a customizable payment page with UPI details.
- Easy-to-use RESTful endpoints.
- Static assets support for additional resources.
Requirements
Installation
-
Clone this repository:
git clone https://github.com/AshokShau/upi-qr-generator.git
cd upi-qr-generator
-
Install dependencies:
go mod download
-
Run the application:
go run main.go
-
The server will start at http://localhost:3000.
Project Structure
upi-qr-generator/
├── api/ // API endpoint handlers for vercel
│ ├── index.go // Handles /
│ ├── pay.go // Handles /pay
│ ├── qr.go // Handles /qr
├── str/ // String constants and HTML templates
│ ├── files.go // HTML templates for payment page
│ ├── handlers.go // Handlers for API endpoints
├── main.go // Main entry point of application
├── README.md // Project README file
└── LICENSE // Project license file
API Endpoints
1. GET /
Redirects to the homepage (static/index.html) that provides usage information.
2. GET /qr
Generates a UPI QR code based on the provided query parameters:
3. GET /pay
Renders a payment page with UPI details:
How It Works
- The
/qr endpoint generates a UPI QR code using the qrcode library.
- The
/pay endpoint serves a payment page with details dynamically rendered from the template.html file.
- Static assets such as styles and templates are served from the
static folder.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
Ashok Shau
Feel free to explore, use, or contribute to this project. If you encounter any issues or have suggestions, open a GitHub
issue or create a pull request!