Skip to content

Compare: Advanced usage Payload generators

Showing with 47 additions and 17 deletions.
  1. +7 −14 Advanced-usage---Payload-generators.md
  2. +4 −1 Advanced-usage---QR-Code-renderers.md
  3. +36 −2 Release-Notes.md
21 changes: 7 additions & 14 deletions Advanced-usage---Payload-generators.md

How to use it - simple way

var payload = new Girocode("DE33100205000001194700", "BFSWDE33BER", "Uncyclomedia", 1337.99m);
Girocode generator = new Girocode("DE33100205000001194700", "BFSWDE33BER", "Uncyclomedia", 1337.99m);
string payload = generator.ToString();

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload);
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.M);
QRCode qrCode = new QRCode(qrCodeData);
var qrCodeAsBitmap = qrCode.GetGraphic(20);

Parameter table

There is 1 overload:

Good to know

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%).

Important: As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.

How to use it - simple way

var payload = new PayloadGenerator.SlovenianUpnQr(payerName, payerAddress, payerPlace, 
                                    recipientName, recipientAddress, recipientPlace, 
                                    recipientIban, 
                                    description, 
                                    amount, 
                                    recipientSiModel, recipientSiReference, 
                                    code);
//or if you need requested date of debitor’s payment (payment deadline) included
var payload = new PayloadGenerator.SlovenianUpnQr(payerName, payerAddress, payerPlace, 
                                    recipientName, recipientAddress, recipientPlace, 
                                    recipientIban, 
                                    description, 
                                    amount, 
                                    deadline,
                                    recipientSiModel, recipientSiReference, 
                                    code);

QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload.ToString(), QRCodeGenerator.ECCLevel.M, 
                                     false, false, 
                                     QRCodeGenerator.EciMode.Iso8859_2,
                                     15);
//or overloaded method                                     
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload);

QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(5);
qrCodeImage.Save(@"GeneratedQRCode.bmp");

Parameter table

Good to know

Important: As per official specification Slovenian UPN QR codes have to be generated with ECC-Level M (15%), ECI Mode set to ISO8859-2, Byte mode and QR Version of 15. If you pass the Payload-class itself to the QRCoder (as shown in the last example) then you don't have to set this parameters, since the Payload-class does this automatically.

How to use it - simple way

SwissQrCode.Contact contactGeneral = SwissQrCode.Contact.WithStructuredAddress("John Doe", "3003", "Bern", "CH", "Parlamentsgebäude", "1");
SwissQrCode.Iban iban = new SwissQrCode.Iban("CH2609000000857666015", PayloadGenerator.SwissQrCode.Iban.IbanType.QrIban);
SwissQrCode.Reference reference = new SwissQrCode.Reference(SwissQrCode.Reference.ReferenceType.QRR, "990005000000000320071012303", SwissQrCode.Reference.ReferenceTextType.QrReference);
SwissQrCode.AdditionalInformation additionalInformation = new SwissQrCode.AdditionalInformation("This is my unstructured message.", "Some bill information here...");
SwissQrCode.Currency currency = SwissQrCode.Currency.CHF;
decimal amount = 100.25m;

SwissQrCode payload = new SwissQrCode(iban, currency, contactGeneral, additionalInformation, reference, null, amount, null, null);
SwissQrCode generator = new SwissQrCode(iban, currency, contactGeneral, additionalInformation, reference, null, amount, null, null);
string payload = generator.ToString();

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload);
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.M, forceUtf8: true);
QRCode qrCode = new QRCode(qrCodeData);
var qrCodeAsBitmap = qrCode.GetGraphic(20, Color.Black, Color.White, (Bitmap)Bitmap.FromFile(Application.StartupPath + "\\CH-Kreuz_7mm.png"), 14, 1);

Parameter table

There is 1 overload:

Good to know

  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%).
  • Important: As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
  • Important: As per official specification a Swiss cross logo (can be downloaded here) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)
  • Important: When passing a SwissQRCode payload to the CreateQrCode()-function, always set the forceUtf8-parameter to true.

Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,10 @@ Use this payload type if you want to share payment contact information and/or ba
#### How to use it - simple way

```csharp
Girocode generator = new Girocode("DE33100205000001194700", "BFSWDE33BER", "Uncyclomedia", 1337.99m);
string payload = generator.ToString();
var payload = new Girocode("DE33100205000001194700", "BFSWDE33BER", "Uncyclomedia", 1337.99m);

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.M);
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload);
QRCode qrCode = new QRCode(qrCodeData);
var qrCodeAsBitmap = qrCode.GetGraphic(20);
```
Expand All @@ -449,7 +448,7 @@ Description: Generates the Girocode payload with different options.
|encoding|GirocodeEncoding|GirocodeEncoding. ISO_8859_1|Encoding of the Girocode payload. Default: ISO-8859-1|

#### Good to know
**Important:** As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%).
**Important:** As per official specification QR codes with Girocode payloads have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().

Girocode competes (atleast for German-speaking countries) with the Bezahlcode. Even if Girocode has less features, it is more common than Bezahlcode. So choose the right payload type in respect of your users and the features you want to use.

Expand Down Expand Up @@ -798,11 +797,6 @@ var payload = new PayloadGenerator.SlovenianUpnQr(payerName, payerAddress, payer
recipientSiModel, recipientSiReference,
code);

QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload.ToString(), QRCodeGenerator.ECCLevel.M,
false, false,
QRCodeGenerator.EciMode.Iso8859_2,
15);
//or overloaded method
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload);

QRCode qrCode = new QRCode(qrCodeData);
Expand Down Expand Up @@ -894,11 +888,10 @@ SwissQrCode.AdditionalInformation additionalInformation = new SwissQrCode.Additi
SwissQrCode.Currency currency = SwissQrCode.Currency.CHF;
decimal amount = 100.25m;

SwissQrCode generator = new SwissQrCode(iban, currency, contactGeneral, additionalInformation, reference, null, amount, null, null);
string payload = generator.ToString();
SwissQrCode payload = new SwissQrCode(iban, currency, contactGeneral, additionalInformation, reference, null, amount, null, null);

QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload, QRCodeGenerator.ECCLevel.M, forceUtf8: true);
QRCodeData qrCodeData = qrGenerator.CreateQrCode(payload);
QRCode qrCode = new QRCode(qrCodeData);
var qrCodeAsBitmap = qrCode.GetGraphic(20, Color.Black, Color.White, (Bitmap)Bitmap.FromFile(Application.StartupPath + "\\CH-Kreuz_7mm.png"), 14, 1);
```
Expand Down Expand Up @@ -926,9 +919,9 @@ Description: Generates a new Swiss Qr code.

#### Good to know

- **Important:** As per official specification Swiss QR codes have to be generated with ECC-Level M (15%).
- **Important:** As per official specification Swiss QR codes have to be generated with ECC-Level M (15%). The necessary EccLevel is already set in the payload. Therefore, please always pass the entire payload object to the CreateQrCode function instead of calling ToString().
- **Important:** As per official specification a Swiss cross logo (can be downloaded [here](https://www.six-group.com/dam/download/banking-services/standardization/qr-bill/swiss-cross-graphic-en.zip)) has to be drawn on the code with a size of ~14%. (Per spec the Swiss cross has to be 7mm per side and the Swiss Qr code should be printed with 46mm without quiet zones or 49,2mm per side with quietzones. So we get 7/(49,2/100) = 14% icon size.)
- **Important:** When passing a SwissQRCode payload to the `CreateQrCode()`-function, always set the `forceUtf8`-parameter to `true`.


***

Expand Down