51 |
{paymentData.merchantName}
52 |
53 | Payment of Rp{formatCurrency(paymentData.amount)}
54 |
55 |
56 |
57 |
58 | {/* QR Code is injected here */}
59 |
60 |
61 |
62 |
63 | E-Wallet transaction cannot be refunded
64 |
65 |
66 | >
67 | );
68 | };
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # QRIS Dynamic Generator
2 |
3 | This is a web-based tool to convert a static QRIS (Quick Response Code Indonesian Standard) into a dynamic one. Users can upload a static QRIS image, specify a payment amount and an optional transaction fee, and the application will generate a new, dynamic QRIS code ready for payment. The app also conveniently saves your previously used QRIS codes for quick access.
4 |
5 | ## ✨ Features
6 |
7 | * **Static to Dynamic QRIS Conversion**: The core feature is to generate a dynamic QRIS from a static one by embedding the payment amount.
8 | * **QR Code Scanning**: Upload a QRIS code image (PNG, JPG, GIF) to automatically scan its data.
9 | * **Custom Amount & Fee**: Set a specific payment amount for the dynamic QRIS.
10 | * **Flexible Transaction Fees**: Add a transaction fee, calculated either as a fixed amount (Rupiah) or a percentage.
11 | * **QRIS History**: The app saves up to 5 of your most recently used QRIS codes in your browser's local storage for easy reuse.
12 | * **Payment-Ready Display**: Shows the generated dynamic QRIS on a clean payment screen, complete with the merchant's name and the total amount.
13 | * **Responsive Design**: A mobile-first design that works smoothly on both desktop and mobile browsers.
14 |
15 | ## 🚀 How It Works
16 |
17 | 1. **Upload & Scan**: The user uploads an image of a static QRIS code. The `jsQR` library is used to read the QR code from the image and extract the static QRIS string data.
18 | 2. **Input Data**: The user enters the desired payment amount and, optionally, a transaction fee on the main form.
19 | 3. **Generate Dynamic QRIS**: The application takes the static QRIS data and injects new tags for the payment amount (`54`) and transaction fee (`55`, `56`, or `57`). It then replaces the static QRIS indicator (`010211`) with the dynamic one (`010212`).
20 | 4. **Recalculate CRC**: A new CRC-16 checksum is calculated for the modified QRIS string to ensure its validity.
21 | 5. **Render QR Code**: The final dynamic QRIS string is rendered as a new QR code image on the payment page using the `qrcode-generator` library.
22 |
23 | ## 🛠️ Technologies Used
24 |
25 | * **Frontend**: React 19, TypeScript
26 | * **Build Tool**: Vite
27 | * **Styling**: Tailwind CSS
28 | * **QR Code Reading**: `jsQR`
29 | * **QR Code Generation**: `qrcode-generator`
30 | * **Icons**: Font Awesome
31 |
32 | ## ⚙️ Setup and Run Locally
33 |
34 | **Prerequisites:** [Node.js](https://nodejs.org/)
35 |
36 | 1. **Clone the repository:**
37 | ```bash
38 | git clone https://github.com/your-username/qris-dinamis-generator.git
39 | cd qris-dinamis-generator
40 | ```
41 |
42 | 2. **Install dependencies:**
43 | ```bash
44 | npm install
45 | ```
46 |
47 |
48 | 3. **Run the development server:**
49 | ```bash
50 | npm run dev
51 | ```
52 |
53 | The application will be running at `http://localhost:5173` (or another port if 5173 is busy).
54 |
--------------------------------------------------------------------------------
/components/ImageUploader.tsx:
--------------------------------------------------------------------------------
1 | import React, { useState, useRef, useCallback } from 'react';
2 | import { ImagePlusIcon } from './icons';
3 |
4 | // Make jsQR and qrcode available from the global scope (window)
5 | declare var jsQR: any;
6 |
7 | interface ImageUploaderProps {
8 | onQrDecode: (data: string | null, error?: string) => void;
9 | }
10 |
11 | export const ImageUploader: React.FC