PHP code example of paybysquare / php

1. Go to this page and download the library: Download paybysquare/php 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/ */

    

paybysquare / php example snippets


use PayBySquare\Payment;
use PayBySquare\PayBySquare;

$payload = PayBySquare::generatePayload(new Payment(
    amount: 25.50,
    iban: 'SK7283300000009111111118',
    beneficiaryName: 'Acme s.r.o.',
    swift: 'FIOZSKBAXXX',
    variableSymbol: '2026001',
    note: 'Invoice FA20260103',
));
// $payload is the string to put into a QR code

$payload = PayBySquare::generatePayload([
    'amount' => 25.50,
    'iban' => 'SK7283300000009111111118',
    'beneficiaryName' => 'Acme s.r.o.',
]);

use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\Image\SvgImageBackEnd;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Writer;

$writer = new Writer(new ImageRenderer(new RendererStyle(256), new SvgImageBackEnd()));
$svg = $writer->writeString($payload);