import ch.codeblock.qrinvoice.QrInvoiceCodeCreator;
import ch.codeblock.qrinvoice.model.QrInvoice;
import ch.codeblock.qrinvoice.model.builder.QrInvoiceBuilder;
// ...
final QrInvoice qrInvoice = // create using QrInvoiceBuilder;
// the resulting String is the Swiss Payments Code which is the one encoded in the QR-Code
final String swissPaymentsCode = QrInvoiceCodeCreator.create()
.qrInvoice(qrInvoice)
.createSwissPaymentsCode();
System.out.println(swissPaymentsCode);