Custom App for EPC-QRCodes

Hey guys,

I recently started using ERPNext for my software business, and so far it works great for us. That’s why I wanted to contribute back and share with you my first custom app.

It’s basically a simple app that provides an HTTP endpoint for generating EPC-QRCodes as PNG images, which can be embedded, e.g., in custom print formats of sales invoices. The customer can scan the QRCode with a banking app that auto-fills all payment fields to make this process less error-prone. Here is an example:

First, I tried different implementations and tinkered with custom print formats and client/server scripts, because I wanted to avoid implementing and setting up a custom app. But none of those solutions worked perfectly. You can’t e.g. render SVGs or use images with data-URIs as source, because they won’t show up in the PDF print of your invoice. Also, relying on third-party APIs on the web for such tasks might not be optimal for privacy reasons, as you have to send over invoice and payment data. So at the end, I came up with a simple app that adds this feature directly to ERPNext.

After installation, the HTTP endpoint is available at /api/method/epcqrcode.generator.get_code. You can use it in a custom HTML print format like this:

<div style="margin-top: 10px;">
  <img width="110" height="110" src="/api/method/epcqrcode.generator.get_code?name=Your+Company&reference={{ doc.name }}&iban=AT026000000001349870&amount={{ doc.grand_total }}&scale=4&border=0">
  <p>Zahlen mit QR-Code</p>
</div>

You can find more information on the Github repo.

Looking forward to getting your feedback on my first custom app :slight_smile:

Cheers,
Florian

10 Likes

Hey guys,

quick update: the app works fine for generating invoice PDFs manually. But it fails when I want to send out these invoices per mail in ERPNext. The error in the mail queue says: “PDF generation failed due to incorrect links for image files”. Seems like ERPNext does not like my templated image URL to my API call. Could it be that API calls are not allowed in this scenario?

Edit: I saw that the regional India code in ERPNext also has some kind of QRCode feature. It generates QRCode images and attaches them as files to invoices. I think that they could then be used as image src in the HTML invoice template. Maybe an ERPNext expert can say more about this :slight_smile:

Cheers,
Florian

1 Like

actually for me it works, also sending.
do you have the “host_name” set correctly in the site config?

Hmm, I will check this out, maybe I had an issue with the app install that time. I am using the Docker setup and everytime I update ERPNext I have to re-install the custom app.