sprain / php-swiss-qr-bill

A PHP library to create Swiss QR bills | QR-Rechnung in PHP erstellen
MIT License
274 stars 79 forks source link

How is the reference QR calculated? #174

Closed samayo closed 2 years ago

samayo commented 2 years ago

How do we calculate Referenz? It doesn't work not matter which library I used.

I always get "Invalid QR" and when uploading online it points to the references as being the issue.

This is just a demo,

image

kohlerdominik commented 2 years ago

With my Raiffeisen account the validator says, th IBAN is invalid. Should this be a valid IBAN?

samayo commented 2 years ago

The QR reference may only be used with the so-called QR-IBAN, which is issued to customers by their bank. The Creditor Reference (SCOR) has the same function as a QR reference. The difference is solely that the calculation thereof follows a different logic. Furthermore, it can be used in international payment traffic, while the QR reference is limited to Switzerland and Liechtenstein. A prerequisite for use of the SCOR is the concurrent use of the IBAN.

I still don't understand what this means. Can the reference number work with regular IBAN?

kohlerdominik commented 2 years ago

The QR reference may only be used with the so-called QR-IBAN, which is issued to customers by their bank. The Creditor Reference (SCOR) has the same function as a QR reference. The difference is solely that the calculation thereof follows a different logic. Furthermore, it can be used in international payment traffic, while the QR reference is limited to Switzerland and Liechtenstein. A prerequisite for use of the SCOR is the concurrent use of the IBAN.

I still don't understand what this means. Can the reference number work with regular IBAN?

No, for QR reference you need to issue an QR-IBAN. This QR-IBAN is usually provided on request only.

But AFAIK you can use RfCreditorReferenceGenerator with the regular IBAN, which might be what your looking for.

samayo commented 2 years ago

Thanks s lot

samayo commented 2 years ago

Hello, sorry for reopening this issue but it seems like no matter what I put for the reference the QR code is invalid with the regular IBAN, do you know what could be the cause of this issue?

If I leave the QR Reference empty, the Swiss Post App says the QR is invalid If I fill the QR Reference with a valid code RF02 36 it still says the QR is invalid

what do you think is the problem?

sprain commented 2 years ago

I suppose your are mixing QrReference and RfCreditorReference.

Maybe this example will help you: https://github.com/sprain/php-swiss-qr-bill/blob/master/example/example_scor.php