This example shows how to create the raw Swiss Payments Code. It is the textual representation of all data encoded in the QR code.

#include <string>
#include <iostream>

#include <qrinvoice/model/qr_invoice.hpp>
#include <qrinvoice/code_creator.hpp>

// ...

const qrinvoice::model::qr_invoice qr_invoice = // create using qr_invoice::builder;

// the resulting String is the Swiss Payments Code which is the one encoded in the QR-Code
qrinvoice::code_creator code_creator;
std::string spc = code_creator.create_swiss_payments_code();
std::cout << spc << std::endl;

Prints a SPC like the following

SPC
0200
1
CH4431999123000889012
S
Robert Schneider AG
Rue du Lac
1268
2501
Biel
CH







1949.75
CHF
S
Pia-Maria Rutschmann-Schnyder
Grosse Marktgasse
28
9400
Rorschach
CH
QRR
210000000003139471430009017
Instruction of 03.04.2019
EPD
//S1/10/10201409/11/190512/20/1400.000-53/30/106017086/31/180508/32/7.7/40/2:10;0:30
Name AV1: UV;UltraPay005;12345
Name AV2: XY;XYService;54321