khqr_sdk 1.0.0 khqr_sdk: ^1.0.0 copied to clipboard
KHQR is a standardization of QR Code (EMV) that will promote wider use of mobile retail payments in Cambodia. By prescribing a KHQR (1 QR for all), a single KHQR Code can accept payments via different [...]
🍃 KHQR SDK 🍃
Note
This KHQR SDK plugin is not officially release from NBC.
This is a simple interface layer that connects your Dart code directly to the original native platform-specific SDK, bridging Flutter and native functionality seamlessly.
KHQR SDK Document Reference #
The standardization of KHQR code specifications will help promote wider use of mobile retail payments in Cambodia and provide consistent user experience for merchants and consumers. It can enable interoperability in the payment industry. A common QR code would facilitate payments among different schemes, e-wallets and banks and would encourage small merchants to adopt KHQR code as payment method. KHQR is created for retail or remittance in Cambodia and Cross-Border. It only requires a single QR for receiving transactions from any payment provider through Bakong including Bakong App.
Supported Platforms #
- ✅ iOS
- ✅ Android
- ❌ Web
- ❌ MacOS
- ❌ Windows
- ❌ Linux
Native KHQR SDK Version #
- iOS using
BakongKHQR
(v1.0.0.15) - Android using
kh.gov.nbc.bakong_khqr:sdk-java:1.0.0.13
Features #
- Core SDK
- ✅ Generate KHQR (Individual / Merchant)
- ✅ Verification (Valid / Invalid)
- ✅ Decode KHQR Information
- ✅ Generate KHQR Deeplink
- Widget
- ✅ KHQR Card Widget
Platform specific setup #
iOS #
- Add source to Podfile (ios/Podfile)
source "https://sambo:ycfXmxxRbyzEmozY9z6n@gitlab.nbc.gov.kh/khqr/khqr-ios-pod.git"
- Run pod install (make sure your terminal is in ios folder)
pod install
Android #
- No need to do anything it's working out of the box.
Usage #
Create instance of KHQR SDK #
import 'package:khqr_sdk/khqr_sdk.dart';
final _khqrSdk = KhqrSdk();
Generate KHQR (Individual) #
final info = IndividualInfo(
bakongAccountId: 'kimhak@dev',
merchantName: 'Kimhak',
);
final khqrData = await _khqrSdk.generateIndividual(info);
Generate KHQR (Merchant) #
final info = MerchantInfo(
bakongAccountId: 'kimhak@dev',
acquiringBank: 'Dev Bank',
merchantId: '123456',
merchantName: 'Kimhak',
);
final khqrData = await _khqrSdk.generateMerchant(info);
Verify KHQR #
const qrCode = '00020101021129140010kimhak@dev520459995303116540105802KH5906Kimhak6010Phnom Penh991700131730993158840630414C8';
final isValid = await _khqrSdk.verify(qrCode);
Decode KHQR #
const qrCode = '00020101021129140010kimhak@dev520459995303116540105802KH5906Kimhak6010Phnom Penh991700131730993158840630414C8';
final khqrDecodeData = await _khqrSdk.decode(qrCode);
Generate KHQR Deeplink #
const qrCode = '00020101021129140010kimhak@dev520459995303116540105802KH5906Kimhak6010Phnom Penh991700131730993158840630414C8';
final sourceInfo = SourceInfo(
appName: 'Example App',
appIconUrl: 'http://cdn.example.com/icons.logo.png',
appDeepLinkCallBack: 'http://app.example.com/callback',
);
final deeplinkInfo = DeeplinkInfo(
qr: qrCode,
url: 'http://api.example.com/v1/generate_deeplink_by_qr',
sourceInfo: sourceInfo,
);
final deeplinkData = await _khqrSdk.generateDeepLink(deeplinkInfo);
KHQR Card Widget #
KhqrCardWidget(
width: 300.0,
receiverName: 'Kimhak',
amount: 0,
currency: KhqrCurrency.khr,
qr: khqrContent,
),