PHP code example of vocolboy / promptpay-generator

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

    

vocolboy / promptpay-generator example snippets


echo EMV::generatePHPDataByQRCode("00020101021229370016A000000677010111011300669123456785802TH53037645406100.00630492CB");

#output
string(506) "$data = [
    EMV::calculateString('00', '01'),
    EMV::calculateString('01', '12'),
    EMV::calculateString(
        '29',
        EMV::serialize([
            EMV::calculateString('00', 'A000000677010111'),
            EMV::calculateString('01', '0066912345678'),
        ])
    ),
    EMV::calculateString('58', 'TH'),
    EMV::calculateString('53', '764'),
    EMV::calculateString('54', '100.00'),
    EMV::calculateString('63', '92CB'),
];

$data[] = EMV::calculateString('63', EMV::crc16($data));"
shell
composer 

$promptpayId = '0912345678';
$amount = '100';

echo PromptPay::generate($promptpayId, $amount);
//00020101021229370016A000000677010111011300669123456785802TH53037645406100.00630492CB

$gcashId = 'DWQM4TK3JDO26GF27'
echo GCashLib::generate(payeeUserId: $gcashId);