Download the PHP package liopay/vietqr without Composer
On this page you can find all versions of the php package liopay/vietqr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download liopay/vietqr
More information about liopay/vietqr
Files in liopay/vietqr
Package vietqr
Short Description Production-ready PHP library for building and parsing VietQR (NAPAS FastFund 24/7 IBFT) QR codes compliant with EMVCo 1.5.2 specification.
License MIT
Homepage https://liopay.vn
Informations about the package vietqr
VietQR
English | Tiếng Việt
Production-ready PHP library for building and parsing VietQR (NAPAS FastFund 24/7 IBFT) QR codes compliant with EMVCo 1.5.2 specification.
Features
- EMVCo 1.5.2 Compliant - Follows NAPAS QR Switching specification v1.5.2
- Build QR Codes - Generate QR codes for all service types (PUSH/CASH/IBFT)
- Parse QR Strings - Parse any VietQR string into structured data
- Full Validation - Comprehensive validation per NAPAS specification
- CRC16-CCITT - Automatic checksum calculation and verification
- Zero Dependencies - No external runtime dependencies
- PHP 7.4+ - Strict typing throughout
- PSR-4 Autoloading - Modern PHP package structure
Installation
Quick Start
Build an Inter-Bank Fund Transfer QR Code
Parse a QR Code
Service Types
VietQR supports four service types:
1. QRIBFTTA - Inter-Bank Fund Transfer to Account
Peer-to-peer transfer to bank account.
2. QRIBFTTC - Inter-Bank Fund Transfer to Card
Peer-to-peer transfer to card number.
3. QRPUSH - Payment Service
Standard merchant payment QR codes.
4. QRCASH - ATM Cash Withdrawal
QR codes for ATM cash withdrawal. Note: Reference Label and Terminal Label are mandatory.
Specification Constants
Required Values
- AID:
A000000727(NAPAS Application Identifier) - Currency:
704(VND - Vietnamese Dong) - Country:
VN(Vietnam)
Data Object IDs (Root Level)
| ID | Name | Required |
|---|---|---|
| 00 | Payload Format Indicator | ✓ |
| 01 | Point of Initiation | Optional |
| 38 | Merchant Account Information | ✓ |
| 52 | Merchant Category Code | ✓ |
| 53 | Transaction Currency | ✓ |
| 54 | Transaction Amount | Conditional |
| 58 | Country Code | ✓ |
| 59 | Merchant Name | ✓ |
| 60 | Merchant City | ✓ |
| 62 | Additional Data Field | Optional |
| 63 | CRC Checksum | ✓ |
Point of Initiation Values
11- Static QR (reusable for multiple transactions)12- Dynamic QR (single-use transaction)
TLV Encoding
VietQR uses TLV (Tag-Length-Value) encoding:
CRC Checksum
VietQR uses CRC16-CCITT False:
- Polynomial:
0x1021 - Init Value:
0xFFFF - Applied to all data including
"6304"but excluding CRC value
Validation
All builders perform automatic validation:
- ✓ Field length constraints
- ✓ Required field presence
- ✓ Format validation (numeric, alphanumeric)
- ✓ MCC code validation
- ✓ Service code validation
- ✓ CRC checksum calculation
- ✓ Additional Data Field mandatory fields per QR type
Exception Handling
Value Objects
Immutable, validated value objects for type safety:
Testing
Run the test suite:
Run PHPStan static analysis:
Check code style:
Fix code style:
Requirements
- PHP >= 7.4
Specification Compliance
This library implements:
- NAPAS QR Switching Technical Specifications v1.5.2
- EMVCo QR Code Specification for Payment Systems: Merchant-Presented Mode
License
MIT License. See LICENSE for details.
Credits
Developed by Liopay
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions, please use the GitHub issue tracker.