PHP code example of hrmpfz / pay-by-square
1. Go to this page and download the library: Download hrmpfz/pay-by-square library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hrmpfz / pay-by-square example snippets
use Hrmpfz\PayBySquare\Payment;
use Hrmpfz\PayBySquare\PayBySquare;
// 1. Vytvorte a nakonfigurujte platobný príkaz
$payment = Payment::create()
->iban('SK0000000000000000000000')
->bic('BANKSKBX')
->amount('49.00')
->currency('EUR')
->variableSymbol('202600123')
->message('Registracny poplatok')
->dueDate(new DateTimeImmutable('2026-07-13'));
// 2. Vygenerujte surový PAY by square payload (formát Base32Hex)
$payload = PayBySquare::encode($payment);
echo "PAY by square retazec: " . $payload . "\n";
// 3. Vykreslite priamo do súborov
// Vykreslenie SVG QR kódu:
PayBySquare::svg($payment, __DIR__ . '/payment.svg');
// Vykreslenie PNG QR kódu (vyžaduje PHP GD rozšírenie):
PayBySquare::png($payment, __DIR__ . '/payment.png');