Download the PHP package mortogo321/laravel-thai-promptpay without Composer
On this page you can find all versions of the php package mortogo321/laravel-thai-promptpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mortogo321/laravel-thai-promptpay
More information about mortogo321/laravel-thai-promptpay
Files in mortogo321/laravel-thai-promptpay
Package laravel-thai-promptpay
Short Description Thai PromptPay QR Code Payment Generator for Laravel
License MIT
Homepage https://github.com/mortogo321/laravel-thai-promptpay
Informations about the package laravel-thai-promptpay
Laravel Thai PromptPay
A Laravel package for generating Thai PromptPay QR codes following the BOT (Bank of Thailand) Thai QR Payment Standard. Supports phone numbers, National ID, Tax ID, and e-Wallet with full validation.
Supported Formats
| Type | Supported | Sub-tag | Format | Example |
|---|---|---|---|---|
| Mobile Phone | ✅ | 01 | 10 digits (06/08/09) | 0812345678 |
| National ID | ✅ | 02 | 13 digits | 1234567890123 |
| Tax ID | ✅ | 02 | 13 digits | 0123456789012 |
| e-Wallet | ✅ | 03 | 15 digits | 123456789012345 |
| Bank Account | ❌ | - | NOT SUPPORTED | BOT spec: reserved |
Note: Bank account numbers are NOT supported per BOT specification (marked as "reserved" - no Thai banks have implemented this).
Features
- Generate PromptPay QR codes compliant with BOT Thai QR Payment Standard
- Support for phone numbers, National ID, Tax ID, and e-Wallet
- Validation methods for identifier and amount checking
- Thai National ID checksum validation
- Payload CRC verification for integrity checking
- Support for fixed amount and open amount payments
- Returns QR code as data URI or binary PNG
- Built-in AJAX/API endpoints with rate limiting
- Works with Axios, Fetch, Vue.js, React, and any frontend framework
- Laravel auto-discovery support
- Full test suite (68 tests, 151 assertions)
Requirements
- PHP 8.2 - 8.5
- Laravel 10.x, 11.x, or 12.x
Installation
The package will automatically register its service provider.
Publish Configuration (Optional)
Basic Usage
Using Facade
Using Dependency Injection
Validation
Validate Identifier
Validate Amount
Validate Payload Integrity
Type Detection
Get Supported Formats
Display QR Code in Blade
AJAX/API Usage
Available API Endpoints
All endpoints are rate-limited to 60 requests per minute.
Generate QR Code
POST /promptpay/generate
Get Payload Only
POST /promptpay/payload
Download QR Code
POST /promptpay/download
API Response Format
Success Response (200)
Error Response (422)
Identifier Format Details
Phone Numbers
0812345678- Thai mobile (10 digits starting with 06/08/09)812345678- Without leading 0 (9 digits)66812345678- International format0066812345678- PromptPay format
National ID / Tax ID
1234567890123- 13-digit number- Includes checksum validation for National ID
e-Wallet
123456789012345- 15-digit e-Wallet ID
API Reference
validate(string $identifier): array
Validate identifier without generating QR.
validateAmount(?float $amount): array
Validate payment amount (max 2 decimal places, max 999,999,999.99).
validatePayload(string $payload): bool
Verify CRC16-CCITT checksum of a complete payload.
getIdentifierType(string $identifier): ?string
Get identifier type ('mobile', 'tax_id', 'ewallet', or null).
isMobileNumber(string $identifier): bool
Check if valid Thai mobile number (06/08/09).
isNationalId(string $identifier): bool
Check if valid National ID with checksum validation.
isTaxId(string $identifier): bool
Check if valid Tax ID (13 digits).
generatePayload(string $identifier, ?float $amount = null): string
Generate PromptPay EMV QR code payload string.
generateQRCode(string $identifier, ?float $amount = null, int $size = 300): string
Generate QR code image as data URI.
generateQRCodeBinary(string $identifier, ?float $amount = null, int $size = 300): string
Generate QR code as binary PNG data.
getSupportedFormats(): array
Get list of all supported identifier formats.
Technical Specification
This package follows the BOT (Bank of Thailand) Thai QR Payment Standard:
- AID:
A000000677010111(PromptPay Application ID) - Sub-tag 01: Mobile phone number (
0066XXXXXXXXXformat) - Sub-tag 02: National ID / Tax ID (13 digits)
- Sub-tag 03: e-Wallet ID (15 digits)
- CRC: CRC16-CCITT checksum (EMVCo standard)
Reference: BOT Thai QR Payment Specification
Testing
Test Coverage: 68 tests, 151 assertions
Code Quality
This package uses Laravel Pint for code style.
A pre-commit hook is included to automatically check code style before commits.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Run tests (
composer test) - Run linting (
composer lint:fix) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License
Credits
- Mor
- Built with endroid/qr-code
Support
If you discover any issues, please create an issue on GitHub.
All versions of laravel-thai-promptpay with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
endroid/qr-code Version ^5.0|^6.0