PHP code example of hubipe / huqrpayment

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

    

hubipe / huqrpayment example snippets




use hubipe\HuQrPayment\QrPayment;

$payment = new QrPayment('HU42117730161111101800000000');




use hubipe\HuQrPayment\QrPayment;
use hubipe\HuQrPayment\Iban\IBAN;

$payment = new QrPayment(new IBAN('HU42117730161111101800000000'));




use hubipe\HuQrPayment\QrPayment;
use Rikudou\Iban\Iban\HungarianIbanAdapter;

$payment = new QrPayment(new HungarianIbanAdapter('11773016-11111018-00000000'));




use hubipe\HuQrPayment\Enums\CharacterSet;
use hubipe\HuQrPayment\Enums\IdCode;
use hubipe\HuQrPayment\Enums\Purpose;
use hubipe\HuQrPayment\QrPayment;

$payment = new QrPayment('HU42117730161111101800000000');
$payment
    ->setIdCode(IdCode::TRANSFER_ORDER)
    ->setCharacterSet(CharacterSet::UTF_8)
    ->setBic('OTPVHUHB')
    ->setName('My company name')
    ->setAmount(53250)
    ->setCurrency('HUF')
    ->setDueDate(new DateTimeImmutable('+3 days'))
    ->setPaymentSituationIdentifier(Purpose::PURCHASE_SALE_OF_GOODS)
    ->setRemittance('Payment for goods')
    ->setShopId('SHOP1')
    ->setMerchantDeviceId('Terminal 1')
    ->setReceiptId('1234984657S')
    ->setPayeeInternalId('Payee internal identification')
    ->setLoyaltyId('GOLDEN_CUSTOMER')
    ->setNavVerificationCode('FXC4');




use hubipe\HuQrPayment\QrPayment;
use Endroid\QrCode\QrCode;

$payment = new QrPayment(...);

$qrCode = $payment->getQrCode();

// get the raw image data and display them in the browser
header('Content-Type: image/png');
echo $qrCode->getRawString();

// use in an img html tag
echo "<img src='{$qrCode->getDataUri()}'>";

// write to a file
$qrCode->writeToFile('/tmp/some-file.png');

// get the raw object from the underlying system
$raw = $qrCode->getRawObject();
// let's assume we're using endroid/qr-code v4
assert($raw instanceof QrCode);
// do some custom transformations
$raw->setLabelFontSize(15);
// the object is still referenced by the adapter, meaning we can now render it the same way as before
echo "<img src='{$qrCode->getDataUri()}'>";