PHP code example of cuongnm / viet_qr_pay_generator
1. Go to this page and download the library: Download cuongnm/viet_qr_pay_generator 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/ */
cuongnm / viet_qr_pay_generator example snippets
use cuongnm\viet_qr_pay_generator\QRPay;
$merchantId = '123456789'; // Replace with your merchant ID
$acqId = '987654321'; // Replace with your acquirer ID
$amount = 10000; // Amount in VND
$ref = 'Test Transaction'; // Reference or description of the transaction
$returnText = true; // Set to true to return text, false for image in base64
$content = QRPay::create()
->merchantId($merchantId) // merchant id
->acqId($acqId) // acquirer id
->amount($amount) // Money
->info($ref) // Ref
->category('5611') // Adding category
->returnText($returnText) // if true, return text. If false, return image in base64
->generateVietQRPay();
// Debug output
echo "\nGenerated VietQR content: " . $content . "\n";
// Generated VietQR content: {"code":200,"desc":"ok","data":"00020101021238560010A0000007270126000998765432101091234567890208QRIBFTTA5204561153037045405100005802VN62200816Test Transaction6304C3FA"}