QR Reference

This example shows how to create a QR reference using the qr_reference_util functions.

#include <string>
#include <iostream>

#include <qrinvoice/util/qr_reference_util.hpp>

// ...

// QR references can be created without restrictions from numeric input with up to 26 digits, the 27th digit is used as check digit
const std::string &qrReference = qrinvoice::qr_reference_util::create_qr_reference("127");

std::cout << qrReference << std::endl;
// prints 000000000000000000000001273

If your bank supplies you with customer IDs, the createQrReference method can add them as a prefix to your reference numbers:

#include <string>
#include <iostream>

#include <qrinvoice/util/qr_reference_util.hpp>

// ...

const std::string &qrReference = qrinvoice::qr_reference_util::create_qr_reference("123", "127"); // Customer ID 123 with reference number 127

std::cout << qrReference << std::endl;
// prints 123000000000000000000001279

Creditor reference

This example shows how to create a Creditor reference using the creditor_reference_util functions.

#include <string>
#include <iostream>

#include <qrinvoice/util/creditor_reference_util.hpp>

// ...

// Creditor references can be created from alphanumeric (0-9a-zA-Z) input with up to 21 chars, 2 chars are used for "RF" prefix and two for the check digits

const std::string &creditorReference = qrinvoice::creditor_reference_util::create_creditor_reference("123");

std::cout << creditorReference << std::endl;
// prints RF78123