bogiesoft/qr-payment

用于生成 QR-Payment 和 PromptPay 的 QR 码的 PHP 库

1.1.0 2021-07-05 19:28 UTC

This package is auto-updated.

Last update: 2024-09-13 22:45:56 UTC


README

License: MIT

用于生成 QR-Payment 和 PromptPay 的 QR 码的 PHP 库

需求

  • PHP 7.2+
  • GD 扩展(用于生成 QR 码)

Composer

本包可在 Packagist 上找到,使用 composer 安装最新版本

composer require bogiesoft/qr-payment

使用方法

# To generate PromptPay QR Code
$promptpay = new bogiesoft\PromptPay();

// Grab parameter from URI
// ?amount=99.25&targer=0810993011
$amount = $_GET['amount'] ?? 99.99;
$target = $_GET['target'] ?? '0810993011';

// Display qrcode as PNG image
$promptpay->generateQrCode($target, $amount);


# To generate SCB QR-Payment
$scb = new bogiesoft\ScbQr();

// Grab parameter from URI
// ?amount=99.25&ref_1=CUST1100&ref_2=INV1001&billerId=0115311040039475101
$amount = $_GET['amount'] ?? 0;
$ref_1 = $_GET['ref_1'] ?? 'none';
$ref_2 = $_GET['ref_2'] ?? 'none';

// Put &rawdata=yes to return rawdata
$rawdata = $_GET['rawdata'] ?? 'no';

# '0115311040039475101'; // Biller ID TEST1
$billerId = $_GET['billerId'] ?? '0115311040039475101'; 

// Display qrcode as PNG image
$scb->getqrcode($amount, $ref_1, $ref_2, $billerId);

生成的 PromptPay QR 码示例

贡献

请随时为此项目做出贡献,我们将非常乐意与您合作。

捐赠

如果此项目帮助您节省了开发时间,您可以送我一杯咖啡:)

许可协议

此包采用 MIT 许可协议。有关完整的版权和许可信息,请查看与源代码一起分发的 LICENSE 文件。