DEV Community

Cover image for Customized payment UPI QR code generation
Jeevan Kishore
Jeevan Kishore

Posted on • Updated on

Customized payment UPI QR code generation

Use case

Recently i had been to a party, paid the bill amount and had to split the cheque with several people.

Communicating on how much.. where to transfer, which app to use and what not.. was a pain!

-- Instead --

Show a QR which works on all apps, scan -> get paid -> done

Generator

live demo

Live demo: https://upi-qr.vercel.app/
Source code: https://github.com/Jeevan-Kishore/upi-qr-generator

Architecture

  • Call the API on click of generateQR with the above mentioned format
  • Serverless function creates a QR using the details set via a GET call /api/getqr/[name]/[upi]/[amount]
  • A deelinking URL is constructed, out of which a QR is generated
  • API responds back with a .png - dataURI
  • Canvas of 300x300 is constructed to which received dataURI is set as src

QR generation has a variety of usecase(s), this is just one of them we thought to share.

Cheers 🍺

Top comments (3)

Collapse
 
nandhae profile image
Nandhagopal Ezhilmaran

Cool stuff, Kishore!

Collapse
 
clumsycoder profile image
Kaushal Joshi

Damn, that's nice!

Collapse
 
athira001 profile image
Athira MR

Nice work!👍