1. Go to this page and download the library: Download farzai/promptpay 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/ */
farzai / promptpay example snippets
use Farzai\PromptPay\PromptPay;
// Generate QR code (backward compatible)
$qrCode = PromptPay::create('0899999999', 100);
echo $qrCode; // Raw payload string
// Customer scans and enters amount themselves
$qrCode = PromptPay::generate('0899999999')->build();
// Amount is pre-filled in payment app
$result = PromptPay::qrCode('0899999999', 150.75)
->toDataUri('png');
// Phone Number (10 digits)
PromptPay::generate('0899999999');
// Tax ID / Citizen ID (13 digits)
PromptPay::generate('1234567890123');
// E-Wallet ID (15 digits)
PromptPay::generate('123456789012345');
// Special characters are automatically removed
PromptPay::generate('089-999-9999'); // Works!
use Nyholm\Psr7\Factory\Psr17Factory;
// Create PSR-17 factory (implements both ResponseFactory and StreamFactory)
$factory = new Psr17Factory();
$response = PromptPay::generate('0899999999')
->withAmount(100)
->toResponse($factory, $factory);
// Returns PSR-7 ResponseInterface
// Perfect for Laravel, Symfony, Slim, etc.
return $response;
use GuzzleHttp\Psr7\HttpFactory;
$factory = new HttpFactory();
$response = PromptPay::generate('0899999999')
->withAmount(100)
->toResponse($factory, $factory);
use Symfony\Component\Console\Output\ConsoleOutput;
$output = new ConsoleOutput();
PromptPay::generate('0899999999')
->withAmount(100)
->toConsole($output);