πŸƒ KHQR SDK πŸƒ

Note

This KHQR SDK package is not officially release from NBC.

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 payment in Cambodia and Cross-Border payment within asean countries. It only requires a single QR for receiving payment from any mobile apps including Bakong app, making QR payment simple for both customers and merchants in Cambodia.

buy me a coffee Ko-fi
Pub Package Pub Likes Pub Score Pub Monthly Downloads Star on Github Forks on Github Contributors Build Status Code size Platform

khqr sdk preview

Features Supported

Features Android iOS Web Windows macOS Linux
Generate Individual βœ” βœ” βœ” βœ” βœ” βœ”
Generate Merchant βœ” βœ” βœ” βœ” βœ” βœ”
Generate Deeplink βœ” βœ” βœ” βœ” βœ” βœ”
Verify βœ” βœ” βœ” βœ” βœ” βœ”
Decode βœ” βœ” βœ” βœ” βœ” βœ”
Decode Non-KHQR βœ” βœ” βœ” βœ” βœ” βœ”
Check Bakong Account βœ” βœ” βœ” βœ” βœ” βœ”
KHQR Card Widget βœ” βœ” βœ” βœ” βœ” βœ”

Usage

Import KHQR SDK Package

import 'package:khqr_sdk/khqr_sdk.dart';

Generate Individual KHQR

final info = IndividualInfo(
  bakongAccountId: 'kimhak@dev',
  merchantName: 'Kimhak',
  accountInformation: '123456789',
  currency: KhqrCurrency.khr,
  amount: 0,
);
final res = KhqrSdk.generateIndividual(info);

Generate Merchant KHQR

final info = MerchantInfo(
  bakongAccountId: 'kimhak@dev',
  acquiringBank: 'Dev Bank',
  merchantId: '123456',
  merchantName: 'Kimhak',
  currency: KhqrCurrency.usd,
  amount: 0,
);
final res = KhqrSdk.generateMerchant(info);

Note

To generate Dynamic QR required to set amount more than zero with expiration

// 1 hour from now
final expire = DateTime.now().millisecondsSinceEpoch + 3600000;
final info = MerchantInfo(
bakongAccountId: 'kimhak@dev',
acquiringBank: 'Dev Bank',
merchantId: '123456',
merchantName: 'Kimhak',
currency: KhqrCurrency.usd,
amount: 100,
expirationTimestamp: expire,
);
final res = KhqrSdk.generateMerchant(info);

Verify KHQR

const qrCode = '00020101021129270010kimhak@dev01091234567895204599953031165802KH5906Kimhak6010Phnom Penh9917001317324625358296304B59E';
final res = KhqrSdk.verify(qrCode);

Decode KHQR

const qrCode = '00020101021129270010kimhak@dev01091234567895204599953031165802KH5906Kimhak6010Phnom Penh9917001317324625358296304B59E';
final res = KhqrSdk.decode(qrCode);

Decode Non-KHQR

const qrCode = '00020101021129270010kimhak@dev01091234567895204599953031165802KH5906Kimhak6010Phnom Penh9917001317324625358296304B59E';
final res = KhqrSdk.decodeNonKhqr(qrCode);
const qrCode = '00020101021129270010kimhak@dev01091234567895204599953031165802KH5906Kimhak6010Phnom Penh9917001317324625358296304B59E';

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 res = await KhqrSdk.generateDeepLink(deeplinkInfo);

Check Bakong Account

  final url = 'https://api-bakong.nbc.gov.kh/v1/check_account_by_id';
  final bakongAccount = 'kimhak@dev';
  final res = await KhqrSdk.checkBakongAccount(url, bakongAccount);

KHQR Card Widget

KhqrCardWidget(
  width: 300.0,
  receiverName: 'Kimhak',
  amount: 0.00,
  keepIntegerDecimal: false,
  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 ⭐

Activities

Alt

Libraries

khqr_sdk