1. Go to this page and download the library: Download liopay/vietqr 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/ */
liopay / vietqr example snippets
use Liopay\VietQR\Builder\QRIBFTBuilder;
$builder = new QRIBFTBuilder();
$qrString = $builder
->setPointOfInitiation('12') // Dynamic QR
->setBeneficiaryBankBin('970436')
->setConsumerId('1017595600')
->setIBFTToAccount()
->setAmount('180000')
->setPurposeOfTransaction('thanh toan don hang')
->build();
// Result: 00020101021238540010A00000072701240006970436011010175956000208QRIBFTTA530370454061800005802VN62230819thanh toan don hang630470FA
use Liopay\VietQR\Parser\QRParser;
$parser = new QRParser();
$qrData = $parser->parse($qrString);
echo $qrData->getConsumerId(); // "1017595600"
echo $qrData->getAmount(); // "180000"
echo $qrData->getServiceCode(); // "QRIBFTTA"
echo $qrData->getPurposeOfTransaction(); // "thanh toan don hang"
$builder = new QRIBFTBuilder();
$qr = $builder
->setPointOfInitiation('12') // Dynamic
->setBeneficiaryBankBin('970436')
->setConsumerId('1017595600')
->setIBFTToAccount()
->setAmount('180000')
->setPurposeOfTransaction('thanh toan don hang')
->build();