Skip to content
.NET library for Swiss QR bill payment slips (aka QR-Rechnung)
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Examples Update dependencies of example programs Feb 20, 2019
Generator Go to version 2.0.0 Feb 20, 2019
GeneratorTest Go to version 2.0.0 Feb 20, 2019
.gitattributes Initial check in Dec 30, 2018
.gitignore Update dependency description Feb 10, 2019
LICENSE Add README and LICENSE Jan 4, 2019
README.md Go to version 2.0.0 Feb 20, 2019
SwissQRBill.NET.sln Initial check in Dec 30, 2018

README.md

Swiss QR Bill for .NET

Open-source .NET library to generate Swiss QR bills (jointly developed with the Java version).

Try it yourself and create a QR bill.

Introduction

The Swiss QR bill is the new QR code based payment format that will replace the current payment slip starting at 30 June, 2020. The new payment slip will in most cases be sent electronically. But it can still be printed at the bottom of an invoice or added to the invoice on a separate sheet. The payer scans the QR code with his/her mobile banking app to initiate the payment. The payment just needs to be confirmed.

The invoicing party can easily synchronize the received payment with the accounts-receivable accounting as the payment comes with a full set of data including the reference number used on the invoice. The Swiss QR bill is convenient for the payer and payee.

QR Bill

More examples can be found in the Wiki

Features

The Swiss QR bill library:

  • generates PDF, SVG and PNG files
  • generates payment slip (105mm by 210mm), A4 sheets or QR code only
  • multilingual: German, French, Italian, English
  • validates the invoice data and provides detailed validation information
  • parses the invoice data embedded in the QR code
  • is easy to use (see example below)
  • is small and fast
  • is free – even for commecial use (MIT License)
  • is built for .NET Standard 2.0, i.e. it runs with .NET Core 2.0 or higher, .NET Framework 4.6.1 or higher, Mono 5.4 or higher, Universal Windows Platform 10.0.16299 or higher, Xamarin etc.
  • has a single non-Microsoft dependency: Net.Codecrete.QrCodeGenerator
  • available as a NuGet package (named Codecrete.SwissQRBill.Generator)

Getting started

  1. Create a new Visual Studio project for .NET Core 2.x (File > New > Project... / Visual C# > .NET Core > Console App (.NET Core))

  2. Add the library via NuGet:

    Either via Project > Manage NuGet Packages... / Browse / search for qrbill / Install

    Or by running a command in the Package Manager Console

Install-Package Codecrete.SwissQRBill.Generator -Version 2.0.0	
  1. Add the code:
using Codecrete.SwissQRBill.Generator;
using System;
using System.IO;

namespace Codecrete.SwissQRBill.Examples.Basic
{
    class Program
    {
        static void Main(string[] args)
        {
            // Setup bill data
            Bill bill = new Bill
            {
                // creditor data
                Account = "CH4431999123000889012",
                Creditor = new Address
                {
                    Name = "Robert Schneider AG",
                    AddressLine1 = "Rue du Lac 1268/2/22",
                    AddressLine2 = "2501 Biel",
                    CountryCode = "CH"
                },

                // payment data
                Amount = 199.95m,
                Currency = "CHF",
                
                // debtor data
                Debtor = new Address
                {
                    Name = "Pia-Maria Rutschmann-Schnyder",
                    AddressLine1 = "Grosse Marktgasse 28",
                    AddressLine2 = "9400 Rorschach",
                    CountryCode = "CH"
                },

                // more payment data
                Reference = "210000000003139471430009017",
                UnstructuredMessage = "Abonnement für 2020"
            };

            // Generate QR bill
            byte[] svg = QRBill.Generate(bill);

            // Save generated SVG file
            const string path = "qrbill.svg";
            File.WriteAllBytes(path, svg);
            Console.WriteLine($"QR bill saved at { Path.GetFullPath(path) }");
        }
    }
}
  1. Run it

API Documention

See DocFX API Documentation

More information

This library is the .NET version of Swiss QR Bill. There is also a Java version with the same features. More information about both libraries can be found in the Wiki.

Other programming languages

If you are looking for a library for yet another programming language or for a library with professional services, you might want to check out Services & Tools on MoneyToday.ch.

You can’t perform that action at this time.