ion-bazan / pl-qr-payment
This library helps you generate payment QR codes for Polish bank mobile applications
Installs: 33 825
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 2
Open Issues: 1
Requires
- php: ^8.1
Requires (Dev)
- endroid/qr-code: ^4.0
- infection/infection: ~0.26.14
- phpunit/phpunit: ^9.5
Suggests
- endroid/qr-code: Allows generating QR code images
This package is auto-updated.
Last update: 2024-11-18 10:38:23 UTC
README
This library helps you generate payment QR codes for Polish bank mobile applications. This is useful in invoice generators, etc to let your customers pay event faster 💸.
Makes use of endroid/qr-code for QR-code generation but you can use any library, because the QR string is available via getQrString()
method.
Please note, that this library is only suitable for Polish bank systems
Installation
Use Composer to install the library.
composer require ion-bazan/pl-qr-payment
Minimal usage example
use IonBazan\PaymentQR\Poland\QrPayment; $payment = new QrPayment( '4249000050026313017364142', // Account number 'Testowy odbiorca', // Recipient name 'Tytuł płatności', // Payment title 12345 // Amount in gr ); /** @var \Endroid\QrCode\QrCode $qrCode */ $qrCode = $payment->getQrCode(); // Do anything you want with the QrCode object header('Content-Type: '.$qrCode->getContentType()); echo $qrCode->writeString();
Advanced usage
use IonBazan\PaymentQR\Poland\QrPayment; $payment = new QrPayment( '4249000050026313017364142', // Account number 'Testowy odbiorca', // Recipient name 'Tytuł płatności', // Payment title 12345, // Amount in gr '5214349636', // Recipient NIP (optional) 'PL', // Country code (only PL is supported) (optional) '11223344', // Customer ID for Direct Debit (optional) '990066' // Invoobill ID (optional) ); $qrString = $payment->getQrString(); // You can encode it using the QR library of your choice ... echo $qrString; // ... or just print it for debug
Validation
Currently, this library does not offer any fancy validation. It tries to stop you from breaking things by stripping invalid characters but don't expect too much. You should already have your data valid before generating the QR code.
Footnotes
This library is a quick approach to implement so called Rekomendacja Związku Banków Polskich dotycząca kodu dwuwymiarowego („2D”), umożliwiającego realizację polecenia przelewu oraz aktywację usług bankowych na rynku polskim - wersja 1.0
According to that document, QR codes should have following parameters:
License
This library is under the MIT license.