flutter_bakong_payway 1.0.1 copy "flutter_bakong_payway: ^1.0.1" to clipboard
flutter_bakong_payway: ^1.0.1 copied to clipboard

A Flutter plugin for generating Bakong KHQR payment codes. Supports Android, iOS, and Web. KHQR is Cambodia's centralized QR payment system.

Flutter Bakong Payway #

A Flutter plugin for generating Bakong KHQR payment codes. Supports Android, iOS, and Web platforms.

KHQR is Cambodia's centralized QR code payment system - Scan. Pay. Done.

pub package License: MIT

☕ Support & Donate #

If you find this package helpful, consider supporting the development:

Donate via KHQR
KUN VENG ANN
Scan with any Bakong-supported banking app

Features #

  • ✅ Generate Individual KHQR codes (personal accounts)
  • ✅ Generate Merchant KHQR codes (business accounts)
  • ✅ Support for USD and KHR currencies
  • ✅ Cross-platform: Android, iOS, and Web
  • ✅ Easy-to-use API with type-safe models
  • ✅ Auto-configuration (minimal setup required)

Installation #

Add this to your pubspec.yaml:

dependencies:
  flutter_bakong_payway: ^1.0.0

Then run:

flutter pub get

Platform Setup #

Android #

No additional setup required. The plugin automatically includes the BakongKHQR SDK.

iOS #

No additional setup required. The plugin embeds the BakongKHQR SDK via CocoaPods.

Web #

Web requires 2 JavaScript files in your web/ folder:

Step 1: Download the SDK

Download khqr-1.0.6.min.js from:

Save it to your web/ folder as khqr-sdk.min.js

Step 2: Copy the Wrapper

Copy khqr_wrapper.js from the example project:

Save it to your web/ folder.

Step 3: Update index.html

Add these scripts to your web/index.html before the Flutter bootstrap script:

<head>
  <!-- ... other head content ... -->
  
  <!-- BakongKHQR SDK - Add this -->
  <script src="khqr-sdk.min.js"></script>
  
  <!-- KHQR Wrapper - Add this -->
  <script src="khqr_wrapper.js"></script>
</head>

Your web/ folder structure should look like:

web/
├── index.html          (modified)
├── khqr-sdk.min.js     (downloaded)
├── khqr_wrapper.js     (copied from example)
├── manifest.json
└── icons/

Note: The scripts must be loaded before Flutter initializes. Place them in the <head> section.

Usage #

Import the package #

import 'package:flutter_bakong_payway/flutter_bakong_payway.dart';

Generate Individual KHQR #

final bakong = FlutterBakongPayway();

final info = IndividualInfo(
  accountId: 'your_account@bank',
  merchantName: 'John Doe',
  currency: KHQRCurrency.usd,
  amount: 10.00,
);

final result = await bakong.generateIndividualQR(info);

print('QR Data: ${result?.qr}');
print('MD5: ${result?.md5}');

Generate Merchant KHQR #

final bakong = FlutterBakongPayway();

final info = MerchantInfo(
  accountId: 'merchant@bank',
  merchantId: 'M001',
  merchantName: 'ABC Store',
  acquiringBank: 'ABA Bank',
  currency: KHQRCurrency.khr,
  amount: 50000.0,
  merchantCity: 'Phnom Penh',
);

final result = await bakong.generateMerchantQR(info);

print('QR Data: ${result?.qr}');
print('MD5: ${result?.md5}');

Currency Options #

// US Dollar
currency: KHQRCurrency.usd

// Khmer Riel
currency: KHQRCurrency.khr

Display QR Code #

Use any QR code package like qr_flutter:

import 'package:qr_flutter/qr_flutter.dart';

QrImageView(
  data: result?.qr ?? '',
  version: QrVersions.auto,
  size: 250,
)

API Reference #

IndividualInfo #

Parameter Type Required Description
accountId String Bakong account ID (e.g., "user@bank")
merchantName String Account holder name
currency KHQRCurrency USD or KHR
amount double Payment amount
merchantCity String City (default: "Phnom Penh")
billNumber String Invoice/bill number
mobileNumber String Contact phone number
storeLabel String Store name
terminalLabel String Terminal identifier
expirationTimestamp int Expiration time (auto-set if amount > 0)

MerchantInfo #

Parameter Type Required Description
accountId String Bakong account ID
merchantId String Merchant ID
merchantName String Business name
acquiringBank String Bank name
currency KHQRCurrency USD or KHR
amount double Payment amount
merchantCity String City (default: "Phnom Penh")
billNumber String Invoice/bill number
mobileNumber String Contact phone number
storeLabel String Store name
terminalLabel String Terminal identifier
expirationTimestamp int Expiration time (auto-set if amount > 0)

KHQRData (Response) #

Field Type Description
qr String The KHQR string to encode as QR code
md5 String MD5 hash of the QR data

Example #

See the example folder for a complete demo app.

cd example
flutter run

Notes #

  • When amount > 0, an expiration timestamp is automatically set to 5 minutes from now if not provided.
  • The plugin handles all platform-specific configurations internally.
  • For Web, ensure the SDK scripts are loaded before Flutter initializes.

License #

MIT License - see LICENSE for details.

Credits #

4
likes
0
points
212
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for generating Bakong KHQR payment codes. Supports Android, iOS, and Web. KHQR is Cambodia's centralized QR payment system.

Repository (GitHub)
View/report issues

Topics

#payment #qrcode #cambodia #bakong #khqr

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface, web

More

Packages that depend on flutter_bakong_payway

Packages that implement flutter_bakong_payway