Hello everyone, 👋
How to Add Dynamic UPI QR Code to Frappe Books Invoice
If you’re using Frappe Books for invoicing in India, adding a dynamic UPI QR code to your invoices makes it incredibly easy for customers to pay you.
The best part? The QR code automatically includes the invoice amount and reference number - no manual work needed!
What You’ll Get
β
QR code with exact invoice amount
β
Invoice number as payment reference
β
Your UPI ID pre-filled
β
Works with any UPI app (GPay, PhonePe, Paytm, etc.)
Step 1: Open Your Print Template
- Open Frappe Books
- Go to Settings β Print Template
- Click on your invoice template to edit it
Step 2: Copy & Paste This Code
Add this code inside your <footer> section:
| |
Step 3: Replace With Your Details
You only need to change 2 things:
πΉ 1. Your UPI ID
Find YOUR_UPI_ID and replace with your actual UPI ID.
Example: mybusiness@okaxis or 9876543210@paytm
πΉ 2. Your Company Name
Find YOUR_COMPANY_NAME and replace with your business name.
Example: ABC Traders or My Business Pvt Ltd
That’s it! No URL encoding needed - the template handles it automatically using encodeURIComponent().
Understanding the Code
Here’s what the UPI URL looks like (before encoding):
| |
| Parameter | What It Does | Value |
|---|---|---|
pa | Payee Address (UPI ID) | Your UPI ID |
pn | Payee Name | Your company name |
tn | Transaction Note | “For Bill” + Invoice Number |
cu | Currency | INR |
am | Amount | Invoice grand total |
The encodeURIComponent() function automatically converts special characters:
- Spaces become
%20 @becomes%40- etc.
How Dynamic Values Work
| |
Test Your QR Code
β οΈ Before using in production:
- Create a test invoice
- Preview the invoice
- Scan the QR code with any UPI app
- Verify amount and details are correct
Troubleshooting
QR code shows wrong amount?
Make sure
doc.grandTotalexists in your template.
QR code not scanning?
Double-check your UPI ID is correct.
Layout looks broken?
Adjust the CSS classes to match your template’s styling.
Thanks For Reading π
This article is based on my personal implementation in Frappe Books. Please let me know if you found any issues, in comment section below.
If it is helpfulΒ and saves your valuable Time β± please show your support π.

Buy me A Coffee, Thank you and canva ( For Beautiful designs ). Thanks for the reading π.