🍃 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
x
iOSx
Android
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 Supported
See the example app for detailed implementation information.
Features | Android | iOS |
---|---|---|
Generate Individual | ✔ | ✔ |
Generate Merchant | ✔ | ✔ |
Generate Deeplink | ✔ | ✔ |
Verify | ✔ | ✔ |
Decode | ✔ | ✔ |
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,
),
See the example for runnable examples of various usages.
Bugs or Requests
If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.
See Contributing.md.
Support
Don't forget to give it a like 👍 or a star ⭐