GithubHelp home page GithubHelp logo

php-promptpay-qr's Introduction

php-promptpay-qr

Latest Version on Packagist Packagist PHP Version GitHub Tests Action Status GitHub Code Style Action Status License: MIT

PHP Library to generate QR Code payload for PromptPay, a Thai QR Code Standard for Payment Transactions, using fluent interface

inspired by dtinth/promptpay-qr and pheerathach/promptpay

adapted from kittinan/php-promptpay-qr

Installation

You can install the package via composer:

composer require keenthekeen/php-promptpay-qr

Usage

use PromptPayQR\Builder;

// Generate PromptPay Payload
Builder::staticMerchantPresentedQR('0899999999')->build();
// 00020101021129370016A000000677010111011300668999999995802TH53037646304FE29

// Generate PromptPay Payload With Amount
Builder::staticMerchantPresentedQR('089-999-9999')->setAmount(420)->build();
// 00020101021229370016A000000677010111011300668999999995802TH53037645406420.006304CF9E

// Generate PromptPay Payload With Amount (one-time use)
Builder::dynamicQR()->creditTransfer()->phoneNumber('083-888-3333')->setAmount(420)->build();

// Generate PromptPay Bill Payment (Tag 30) Payload
Builder::dynamicQR()->billPayment()
  ->setBillerIdentifier('099400015804189', 'Ref1', 'Ref2')
  ->setAmount(1999.99)->build();

// Generate QR Code SVG string
$svgString = Builder::staticMerchantPresentedQR('1-2345-67890-12-3')->toSvgString();
// Laravel example: respond with header Content-Type: image/svg+xml
return response($svgString, 200)->header('Content-Type', 'image/svg+xml')->header('Cache-Control', 'no-store');

// Generate QR Code SVG file
Builder::staticMerchantPresentedQR('1-2345-67890-12-3')->toSvgFile($path);

License

The MIT License (MIT). Please see License File for more information.

php-promptpay-qr's People

Contributors

hackhq avatar k1337 avatar keenthekeen avatar kittinan avatar leekung avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.