thai_promptpay_flutter 0.1.0
thai_promptpay_flutter: ^0.1.0 copied to clipboard
Flutter widgets that render a Thai PromptPay (EMVCo) QR code from a mobile number, National ID / Tax ID or e-Wallet, with an optional amount.
thai_promptpay_flutter #
Flutter widgets ที่วาด QR พร้อมเพย์ (Thai PromptPay / EMVCo) จากเบอร์มือถือ / เลขบัตรประชาชน-ภาษี / e-Wallet พร้อมจำนวนเงิน
Flutter widgets that render a Thai PromptPay (EMVCo) QR code from a mobile number, National ID / Tax ID or e-Wallet, with an optional amount.
This is the Flutter rendering layer on top of the pure-Dart
thai_promptpay codec (kept pure-Dart
so it still runs back-end / CLI). This package adds the widgets — it depends on
flutter + qr_flutter + thai_promptpay
thainum(for the baht text), and re-exports the codec, so importing this package alone gives youencodePromptPay/decodePromptPay/PromptPayTargetetc. too.
flutter pub add thai_promptpay_flutter
PromptPayQr — the QR widget #
import 'package:thai_promptpay_flutter/thai_promptpay_flutter.dart';
// Convenience constructors (accept 0812345678, 081-234-5678, +66…):
PromptPayQr.mobile('0812345678', amountSatang: 10000); // 100.00 baht
PromptPayQr.nationalId('1101700230708');
PromptPayQr.eWallet('004999000000001', size: 180);
// Or pass a target directly:
PromptPayQr(
target: const PromptPayTarget(PromptPayType.mobile, '0812345678'),
amountSatang: 5000,
size: 240,
);
Money is in integer satang (1 baht = 100 satang) — exact, no double. If the
number/ID is invalid the widget shows errorBuilder (a default placeholder when
null) instead of throwing:
PromptPayQr.mobile(
userInput,
errorBuilder: (context, error) => const Text('Invalid PromptPay number'),
);
PromptPayQrCard — a drop-in card #
A Material card with the QR, a title, the recipient, and the amount shown as Thai
baht text (via thainum):
PromptPayQrCard(
target: const PromptPayTarget(PromptPayType.mobile, '0812345678'),
amountSatang: 10000, // shows '฿100.00' + 'หนึ่งร้อยบาทถ้วน'
title: 'พร้อมเพย์ / PromptPay',
recipientLabel: 'ร้านกาแฟ',
);
Notes #
- Output is verified through the codec —
thai_promptpayis checked byte-for-byte against the canonical PromptPay references. - Scope: personal PromptPay (mobile / National ID / e-Wallet). Bill-Payment is not included yet.
License #
MIT © 2026 MaIII (ultramcu)