I’m using SwissQRCodetext to create SwissQR code (Version 22.2.0).
If property BillInformation is not set (null) the QR code validation on https://validation.iso-payments.ch/ fails with remark: Das Element <StrdBkgInf> darf nicht leer sein, wenn dieses geliefert wird. Ausnahme: Wenn nachfolgende Elemente verwendet werden.
Code snippet to create the QR code:
//create Swiss QR Bill
SwissQRCodetext swissQRCode = new SwissQRCodetext();
swissQRCode.Bill.Version = SwissQRBill.QrBillStandardVersion.V2_0;
swissQRCode.Bill.Account = "CH4431999123000889012";
swissQRCode.Bill.Amount = 1000.25m;
swissQRCode.Bill.Currency = "CHF";
swissQRCode.Bill.Reference = "210000000003139471430009017";
swissQRCode.Bill.Creditor = new Address
{
Name = "Muster & Söhne",
Street = "Musterstrasse",
HouseNo = "12b",
PostalCode = "8200",
Town = "Zürich",
CountryCode = "CH"
};
swissQRCode.Bill.Debtor = new Address
{
Name = "Muster AG",
Street = "Musterstrasse",
HouseNo = "1",
PostalCode = "3030",
Town = "Bern",
CountryCode = "CH"
};
//encode Swiss QR Bill
ComplexBarcodeGenerator generator = new ComplexBarcodeGenerator(swissQRCode);
generator.Parameters.Barcode.XDimension.Pixels = 4;
generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ECIEncoding;
generator.Parameters.Barcode.QR.QrECIEncoding = ECIEncodings.UTF8;
string fileNmae = $"SwissQRBill-{Guid.NewGuid()}.png";
generator.Save(fileNmae);
Specification of Billinformation (StrdBkgnInf)
SwissQRBill-634e222f-1a11-4df8-8890-bc25656ac499.png (2.5 KB)