PHP code example of bonami / qr-platba

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

    

bonami / qr-platba example snippets




iskith\QRInvoice\QRInvoice;

$qrInvoice = (new QRInvoice)
    ->setAccount('12-3456789012/0100')
    ->setVariableSymbol('2016001234')
    ->setMessage('Toto je první QR platba.')
    ->setSpecificSymbol('0308')
    ->setSpecificSymbol('1234')
    ->setCurrency('CZK') // Výchozí je CZK, lze zadat jakýkoli ISO kód měny
    ->setDueDate(new \DateTime());

echo $qrInvoice->getQRCodeImage(); // Zobrazí <img> tag s kódem, viz níže

echo QRInvoice::create('12-3456789012/0100', 987.60)
    ->setMessage('QR platba je parádní!')
    ->getQRCodeImage();



iskith\QRInvoice\QRInvoice;

$qrInvoice = QRInvoice::create('27-16060243/0300', 495.00, '012150672')
    ->setInvoiceId('012150672')
    ->setDueDate(new \DateTime('2015-12-17'))
    ->setInvoiceDate(new \DateTime('2015-12-01'))
    ->setTaxDate(new \DateTime('2015-12-01'))
    ->setTaxPerformance(0)
    ->setCompanyTaxId('CZ60194383')
    ->setCompanyRegistrationId('60194383')
    ->setInvoiceSubjectTaxId('CZ12345678')
    ->setTaxBase(409.09, 0)
    ->setTaxAmount(85.91, 0);

echo $qrInvoice->getQRCodeImage(); // Zobrazí <img> tag s kódem, viz níže



iskith\QRInvoice\QRInvoice;

$qrInvoice = (new QRInvoice)
    ->setIsOnlyInvoice(true)
    ->setIban('CZ9701000000007098760287+KOMBCZPP')
    ->setAmount(61189.00)
    ->setVariableSymbol('3310001054')
    ->setInvoiceId('2001401154')
    ->setInvoiceDocumentType(9)
    ->setDueDate(new \DateTime('2018-04-12'))
    ->setInvoiceDate(new \DateTime('2014-04-04'))
    ->setTaxDate(new \DateTime('2014-04-04'))
    ->setTaxPerformance(0)
    ->setCompanyTaxId('CZ25568736')
    ->setCompanyRegistrationId('25568736')
    ->setInvoiceSubjectTaxId('CZ25568736')
    ->setInvoiceSubjectRegistrationId('25568736')
    ->setMessage('Dodávka vybavení interiéru hotelu Kamzík')
    ->setTaxBase(26492.70, 0)
    ->setTaxAmount(5563.47, 0)
    ->setTaxBase(25333.10, 1)
    ->setTaxAmount(3799.97, 1)
    ->setNoTaxAmount(-0.24)
    ->setInvoiceIncludingDeposit(false);

echo $qrInvoice->getQRCodeImage(); // Zobrazí <img> tag s kódem, viz níže

// Uloží png o velikosti 100x100 px
$qrInvoice->saveQRCodeImage('qrcode.png', 'png', 100);

// Uloží svg o velikosti 100x100 px s 10 px marginem
$qrInvoice->saveQRCodeImage('qrcode.svg', 'svg', 100, 10);

// data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUAAAAFAAQMAAAD3XjfpAAAA...
echo $qrInvoice->getQRCodeImage(false);