PHP code example of kenlas / mnb-qr-code-payment-generator-php
1. Go to this page and download the library: Download kenlas/mnb-qr-code-payment-generator-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/ */
kenlas / mnb-qr-code-payment-generator-php example snippets
$iban = MnbQrCodePayment\Utils::hungarianBbanToIban('11773016-11111018');
$generator = new MnbQrCodePayment\Generator();
$data = $generator
->setMethod('HCT')
->setBic('OTPVHUHB')
->setName('Szabó Jenő')
->setIban($iban)
->setAmount(1000)
->setExpiration(new DateTime('now + 30 minutes'))
->setPaymentSituation('GDSV')
->setMessage('hello')
->setShopId('1234')
->setDeviceId('POS')
->setInvoiceId('MY-2020/108')
->setCustomerId('4682')
->setTransactionId('4687-8765-9624-1245-2022')
->setLoyaltyId('4682')
->setNavVerificationCode('FXC4')
->generate();
$image = new MnbQrCodePayment\QrCodeImage($data);
$image->display();
$image->saveTo('my.png');
echo $image->asDataUri();
$customRenderer = new Endroid\QrCode\QrCode();
$customRenderer->setSize(400);
$customRenderer->setMargin(20);
$customRenderer->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]);
$customRenderer->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);
$image->setRenderer($customRenderer);