This PHP library hanle generation of QR Code Payment.
You can install the library using Composer:
composer require matok/pay-by-square-svkYou need https://en.wikipedia.org/wiki/XZ_Utils in order to generate pyament QR Code. To set this dependecy you have to pass path to this application in constructor.
use Matok\PayBySquare\PaymentGenerator\Generator;
...
$generator = new Generator('/usr/bin/xz');use Matok\PayBySquare\Value\DueDate;
use Matok\PayBySquare\Value\Iban;
use Matok\PayBySquare\Value\PriceEur;
use Matok\PayBySquare\Value\Message;
...
$iban = new Iban('SK39 8360 5207 0042 0320 8125');
$price = new PriceEur('2.50');
$variableSymbol = VariableSymbol(123);
$message = new Message('my payment message');
$payment = $generator->generatePayment(
$iban,
$price,
$variableSymbol,
$message,
DueDate::today()
);You have several possibilities how to display QR Code:
// inline:
echo '<img src="' . $payment->toQrCode()->toPngInline(); .'" alt="qr code">';// generate in controller:
header('Content-Type: image/png');
echo $payment->toQrCode()->toPng();// you can generate QR Code by any library using payment string
showQrCode($payment->toString());This library is released under the MIT License.