Skip to content

How to Send a UPI Payment QR Code in Each Email

If you collect payments in India, Mail Merge can email each person a UPI QR code with their own amount in it. Each person scans the code with Google Pay, PhonePe, Paytm or any other UPI app. The app opens with your name, the amount and a note already filled in. The money goes straight to your bank account.

Use UPI with mail merge for collecting tuition fees for your school or coaching institute, society maintenance, invoices, event tickets, or donations.

Kavita runs Sargam Music Academy in Pune. On the first of every month she emails the parents a fee reminder. The fee isn’t the same for every student, so each email needs its own amount.

First Name Email Address Student Fee
Ravi ravi.menon@example.net Aarav 2,500
Ananya ananya.iyer@example.com Diya 3,200
Farhan farhan.shaikh@example.org Zoya 2,500

Ravi gets a code for ₹2,500. When he scans the code, his UPI app shows Sargam Music Academy, the amount, and the note Dec fees Aarav. The note tells Kavita whose fee it is when the payment shows up in her statement.

A UPI QR code holds a short payment link. The link starts with upi://pay? and has a few parts joined by &, like pa for the receiver’s UPI ID. For example:

upi://pay?pa=sargam@bank&pn=Sargam%20Academy&am=2500.00&tn=Dec%20fees
Part What it means In the example
pa Your UPI ID. This is where the money goes. sargam@bank
pn Your name, as the payer sees it Sargam Music Academy
am The amount in rupees 2500.00
cu The currency. Always INR. INR
tn A note that travels with the payment Dec fees Aarav

You’ll find your UPI ID in your UPI app, under your profile or bank account. A UPI ID looks like yourname@okhdfcbank or 9876543210@ybl.

The QRCODE formula comes with Mail Merge. Install the add-on first, then open the sheet that holds your list.

  1. Add a column titled Pay QR to your sheet.

  2. Click the first cell under the title and paste this formula. Replace the UPI ID and the name with your own.

    =QRCODE("upi://pay?pa=sargam@bank&pn=" & ENCODEURL("Sargam Music Academy") & "&am=" & TEXT(D2, "0.00") & "&cu=INR&tn=" & ENCODEURL("Dec fees " & C2), 220)
    • D2 is the cell with the fee. TEXT(D2, "0.00") writes the fee with two decimals, like 2500.00.
    • C2 is the student’s name, which goes into the note.
    • ENCODEURL makes names and notes with spaces safe to put in a link.
    • 220 is the width of the code in pixels.

    The cell shows a long link that ends in .png. That link is the picture of the QR code.

  3. Copy the formula to the other rows. Click the cell, then drag the small blue square at its bottom-right corner down to the last row.

  4. To see the codes in the sheet, add another column titled QR Preview. Enter =IMAGE(E2), where E2 is the cell with the link.

  5. Scan the first code with your own UPI app. Check that the name, amount and note are right. You don’t have to pay.

To let the payer type the amount, as you would for a donation, leave out the &am= part and the TEXT that follows it.

  1. Go to Extensions > Mail Merge with Attachments > Open Mail Merge and open your campaign, or click Create and choose Send emails to start one.

  2. On the Template step, write your email. Type {{Pay QR}} on a line of its own, where you want the code to appear. Add your UPI ID as text below the code, for people who would rather type the ID.

    Hi {{First Name}},
    {{Student}}'s fees for December are ₹{{Fee}}. Scan this code with any UPI app to pay:
    {{Pay QR}}
    Or pay to our UPI ID: sargam@bank
    Thank you,
    Kavita
  3. Click Send Test Email and send the email to yourself. Open the test email and scan the code.

  4. Go to the Save & Run step and click Send Emails.

Mail Merge sends the request. The payment happens in the UPI apps, so the add-on can’t see the payment and doesn’t mark anyone as paid.

Check your UPI app or bank statement for the notes, like Dec fees Aarav, and type Paid in a column of your sheet for each payment. To send a reminder only to the people who haven’t paid, filter the sheet to hide the paid rows before you run the next campaign.

  • UPI works with Indian bank accounts and rupees only. For customers elsewhere, send a PayPal link.
  • Use a note that tells you who paid: an invoice number, a flat number or the student’s name. Keep the note short.
  • Banks and UPI apps set their own limits on how much can be paid in a day. If someone’s app won’t accept the code, they can still pay to the UPI ID you typed in the email.
  • Anyone who has the code can pay it, any number of times. That is fine for fees, but a UPI code is not a ticket or a receipt.
  • To send the reminder on a set day, put the date in a Scheduled Date column.
  • If you use a payment gateway like Razorpay or Instamojo, put each person’s payment link in a column and add the column to the email as a merge field. You don’t need a formula.

Google Sheets doesn’t know the formula yet. Go to Extensions > Mail Merge with Attachments > Open Mail Merge once in this spreadsheet, then close the window. The formula starts working after that.

Check the UPI ID after pa= for typing mistakes and spaces. Then check that the amount cell holds a number, not text like Rs 2500.

The amount is zero when the code is scanned

Section titled “The amount is zero when the code is scanned”

The fee cell is empty for that row, or the formula points to the wrong column. Change D2 to the cell that holds the amount.