1. Go to this page and download the library: Download chainplatform/pay 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/ */
use ChainPlatform\Pay\QRPay;
use ChainPlatform\Pay\BanksObject;
$accountNumber = '99MM24011M34875080';
$momoQR = QRPay::initVietQR([
'bankBin' => BanksObject::banviet()->bin,
'bankNumber' => $accountNumber,
]);
// Mã tham chiếu riêng của MoMo
$momoQR->additionalData->reference = 'MOMOW2W' . substr($accountNumber, 10);
// Trường ID 80 = 3 số cuối số điện thoại
$momoQR->setUnreservedField('80', '046');
echo $momoQR->build();
$qrPay = new QRPay($originalContent);
// Sửa thông tin
$qrPay->amount = '10000';
$qrPay->additionalData->purpose = 'Cam on nhe - thu vien tao ma thanh toan QRPay tren PHP';
// Build lại
$newQR = $qrPay->build();
// Output
/*
00020101021238550010A000000727012500069704220111887876271330208QRIBFTTA53037045405100005802VN62580854Cam on nhe - thu vien tao ma thanh toan QRPay tren PHP6304EC87
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.