Skip to content

Setting Up Swiss QR Code Invoices

JustOn supports generating invoices that include the Swiss QR-bill payment part. For background information on the QR-bill, supported currencies, payment references and required data, see Swiss QR-bill.

Setting up Swiss QR code invoices comprises the following tasks:

Configuring QR Code Template

The PDF generation for QR code invoices uses a standard template (PDF Renderer v3) with a dedicated Liquid file that includes the payment part.

  1. Create a standard template in the language of your invoices.

    For details, see Creating Standard Template.

    The New Template dialog sets the PDF Renderer field to v3 and attaches the standard Liquid file titled Invoice Template.

  2. Replace the attached Liquid file with the Swiss QR starter template.

    1. In the Notes & Attachments area, delete the file Invoice Template.
    2. Click to open the action menu, select Upload Files.
    3. Upload the Swiss QR starter template in the language of the template:

      Swiss QR Code Invoice Template (English)
      Swiss QR Code Invoice Template (French)
      Swiss QR Code Invoice Template (German)

    The starter templates are the standard Liquid files, extended by the Swiss QR payment part.

    The template must hold exactly one Liquid file titled Invoice Template. With two identically named files, selecting either one becomes random and can lead to errors.

  3. Set the Type of the uploaded file to Liquid Template.

    This operation requires the custom Type field (ONB2__Type__c) to be available on the page layout of the Content Version object. For details, see Attaching Liquid File.

  4. In the Add QR Code field, select Swiss QR Code.

    This operation requires the custom Add QR Code field (ONB2__AddQRCode__c) to be available on the page layout of the Template object. For details about adding fields to page layouts, see Modifying Page Layouts or Search Layouts.

  5. Optionally, adjust the PDF Options field.

    For details, see Adjusting PDF Options.

  6. Click Save to apply your template customization.

    You can now apply this template to invoices with recipients in Switzerland. When generating the PDF file, the QR-code payment slip will be printed accordingly.

Info

Page header, footer and page counter of a standard template are defined in the Liquid file. The Page Header field of the template record does not apply. For details, see Defining Headers, Footers and the Page Counter.

Existing Swiss QR templates with PDF Renderer v2 keep working, but they print the QR code as a raster image, while the Implementation Guidelines require a vector graphic. JustOn recommends switching to a standard template with the Swiss QR starter template. For the differences between the rendering engines, see Migrating Templates From v2 to v3.

Note

Do not change the payment part of the starter template unless you follow the rules in Customizing Payment Part. Otherwise, your invoice template may no longer comply with the standard.

Using QR-IBAN

For invoices in CHF, you can use a Swiss QR-IBAN instead of the regular IBAN. JustOn then encodes a QR reference (QRR) in the QR code, which enables fully automatic payment matching. Invoices in EUR keep using the regular IBAN. For details, see QR-IBAN.

  1. Click to enter Setup, then navigate to Custom Code > Custom Settings.
  2. Click Manage in the row of Business Entity.
  3. Click Edit in the row of the business entity to be edited.
  4. In the QR-IBAN field, specify your QR-IBAN.

    The QR-IBAN must be a valid Swiss QR-IBAN (IID range 30000–31999). An invalid value produces an error when rendering the PDF of an invoice that uses the QR-IBAN.

    Keep the regular IBAN field filled. It remains required, and invoices in EUR use it.

  5. Click Save.

    On finalization, JustOn now creates a QR reference for invoices in CHF of this business entity.

  6. If your template uses a Liquid file that was copied from an earlier starter template or that you built yourself, update its payment part to print the QR reference.

    For details, see Customizing Payment Part.

Note

  • The QR reference is built from the digits of the invoice number only. If the business entity uses several counters, make sure they differ in their digits, not only in a prefix. For details, see QR-IBAN.
  • Do not remove the QR-IBAN from a business entity that has finalized CHF invoices with QR references. Otherwise, creating the PDF of these invoices again produces an invalid QR-bill without any error message.

Customizing Payment Part

The starter templates comply with the Implementation Guidelines and the corresponding Style Guide QR-bill. If you modify the payment part, build your own Liquid file, or use a Liquid file that was copied from an earlier starter template, adjust the payment part as follows:

  1. Download the Liquid file Invoice Template from the Notes & Attachments area of the template, and open it in a text editor.

    In the starter templates, the payment part is enclosed in <!-- SWISS QR-BILL START --> and <!-- SWISS QR-BILL END --> before </body>. Its styles are enclosed in <!-- SWISS QR-BILL STYLE START --> and <!-- SWISS QR-BILL STYLE END --> in <head>.

  2. Adjust the payment part so that it follows these rules:

    • QR code size: Print the QR code at 46 × 46 mm, with 5 mm of free space on every side.

      With a standard template, JustOn provides the QR code image (QrCode.DataURI) as a vector graphic without its own quiet zone, so the free space must come from the layout. Specify the size of the QR code box and image in whole pixels, that is, 174px. With 46mm, the rendering engine cuts off about 0.23 mm of the last module row and column.

      In the starter templates, the size is set by the style rules .qr-p-qr and .qr-p-qr img.

    • Positive balance: Print the payment part only for invoices with a positive balance (invoice.balance__c > 0).

      In the starter templates, this condition sets the variable qr_show at the beginning of the style block.

    • Payment reference: Print the payment reference using the template field that matches the reference type, and omit the reference, including its heading, if it is empty – on drafts, for example, or if the invoice has no valid reference.

      In the starter templates, the variable qr_ref holds the matching reference, and the two Reference blocks of receipt and payment part print it. In an older or your own Liquid file, use the following code:

      {% if QrCode.structuredData.reference.type == 'QRR' %}
        {% assign ref = QrCode.structuredData.reference.printQrr %}
      {% else %}
        {% assign ref = QrCode.structuredData.reference.printIso11649 %}
      {% endif %}
      {% if ref != blank %}Reference: {{ ref }}{% endif %}
      

      The code holds the heading Reference in English. Replace it with the heading in the language of your template, like Referenz or Référence.

      If you do not use a QR-IBAN, printing QrCode.structuredData.reference.printIso11649 is sufficient. The reference encoded in the QR code itself is correct in any case.

    • Amount (optional): To print the amount, you can use the template field QrCode.structuredData.payment.printAmount. It holds the invoice balance with a space as thousands separator, a point and two decimal places, and without currency (like 1 908.00), independent of the locale and the PDF Options.

  3. Replace the Liquid file on the template with your modified file.

    Delete the previous file, upload the modified one, and set its Type to Liquid Template. For details, see Attaching Liquid File.

    The template must hold exactly one Liquid file titled Invoice Template.

Info

The current starter templates already implement these rules. Templates that were copied from earlier versions of the starter templates use a QR code box of 46mm and cut off long words without spaces in the information columns. To fix this, update the payment part from the current starter template.

Related information:

Working With Templates