Sunday, 2 August 2026

UPI QR Code generator code in html

Generate your own UPI QR Code easily with this simple HTML code.

Just copy and paste this code into your website or GitHub Pages, replace "yourupiid@amazonpay" with your own UPI ID, and save the file.

Enter the name and donation amount to create a custom UPI QR Code. Anyone can scan the QR code using any UPI app and make a payment directly to your UPI account.

No database, no server, and no setup required — it works completely on the browser.

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />


<title>UPI QR Code Generator</title>


<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>


<style>

    body{

        font-family: Arial, sans-serif;

        background:#f4f4f4;

        margin:0;

        padding:20px;

    }


    .container{

        max-width:420px;

        margin:auto;

        background:#fff;

        padding:25px;

        border-radius:12px;

        box-shadow:0 0 10px rgba(0,0,0,0.1);

        text-align:center;

    }


    h2{

        margin-bottom:20px;

    }


    input{

        width:100%;

        padding:12px;

        margin-bottom:15px;

        border:1px solid #ccc;

        border-radius:8px;

        font-size:16px;

        box-sizing:border-box;

    }


    button{

        width:100%;

        padding:12px;

        border:none;

        border-radius:8px;

        background:#0d6efd;

        color:#fff;

        font-size:16px;

        cursor:pointer;

    }


    button:hover{

        background:#0b5ed7;

    }


    #message{

        margin-top:20px;

        font-size:18px;

        font-weight:bold;

        color:#222;

    }


    #qrcode{

        margin-top:20px;

        display:flex;

        justify-content:center;

    }


    .upi-text{

        margin-top:10px;

        color:#666;

        font-size:14px;

    }

</style>

</head>

<body>


<div class="container">


    <h2>UPI QR Generator</h2>


    <input type="text" id="name" placeholder="Enter Name" />


    <input type="number" id="amount" placeholder="Enter Amount" />


    <button onclick="generateQR()">Generate QR Code</button>


    <div id="message"></div>


    <div id="qrcode"></div>


    <div class="upi-text">

        UPI ID: yourupiid@amazonpay

    </div>


</div>


<script>


function generateQR(){


    let name = document.getElementById("name").value.trim();

    let amount = document.getElementById("amount").value.trim();


    if(name === "" || amount === ""){

        alert("Please fill all fields");

        return;

    }


    let upiID = "yourupiid@amazonpay";


    let note = `Prayer and blessings for ${name} donate amount`;


    let upiLink = `upi://pay?pa=${upiID}&pn=${encodeURIComponent(name)}&am=${amount}&cu=INR&tn=${encodeURIComponent(note)}`;


    document.getElementById("message").innerHTML =

        `Prayer and blessings for <b>${name}</b> donate ₹${amount}`;


    document.getElementById("qrcode").innerHTML = "";


    new QRCode(document.getElementById("qrcode"), {

        text: upiLink,

        width: 250,

        height: 250

    });


}


</script>


</body>

</html>