PromptParse (Rust)
"All-in-one Rust library for PromptPay & EMVCo QR Codes"
No external dependencies & Cross-platform. You can use it anywhere!
This is a Rust port of maythiwat/promptparse
Features
- Parse — PromptPay & EMVCo QR Code data strings into structs
- Generate — QR Code data from pre-made templates (PromptPay AnyID, PromptPay Bill Payment, TrueMoney, etc.)
- Manipulate — any values from parsed QR Code data and encode back into QR Code data
- Validate — checksum and data structure for known QR Code formats (Slip Verify API Mini QR)
Installation
Add this to your Cargo.toml:
[]
= "1.0.1"
Usage
Parsing data and get value from tag
use parse;
Build QR data and append CRC tag
use ;
Generate PromptPay Bill Payment QR
use ;
Generate PromptPay AnyID QR
use ;
Generate TrueMoney QR
use ;
Validate & extract data from Slip Verify QR
use validate;
Convert BOT Barcode to PromptPay QR Tag 30 (Bill Payment)
use parse_barcode;
Error Handling
The library uses Result<T, PromptParseError> for operations that can fail:
use ;
About This Port
This Rust implementation is a faithful port of the excellent promptparse TypeScript/JavaScript library by Maythiwat Chomchuen. The original library has been thoroughly tested and is widely used in the Thai payment ecosystem.
All credit for the original design, implementation, and testing goes to the original author. This port aims to bring the same reliability and functionality to Rust developers.
References
See Also
- maythiwat/promptparse - Original TypeScript/JavaScript implementation
- phoomin2012/promptparse-php - PHP implementation
License
This project is MIT licensed (see LICENSE), maintaining the same license as the original work.