khqr_sdk 2.0.0 copy "khqr_sdk: ^2.0.0" to clipboard
khqr_sdk: ^2.0.0 copied to clipboard

Standardization of QR Code (EMV) that will promote wider use of mobile retail payments in Cambodia.

🍃 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.


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

9
likes
160
points
370
downloads
screenshot

Publisher

verified publishermrrhak.com

Weekly Downloads

Standardization of QR Code (EMV) that will promote wider use of mobile retail payments in Cambodia.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#khqr #khqr-sdk #khqr-code #bakong-khqr #bakong

Documentation

API reference

Funding

Consider supporting this project:

ko-fi.com

License

MIT (license)

Dependencies

auto_size_text, crypto, flutter, flutter_svg, http, intl, pretty_qr_code

More

Packages that depend on khqr_sdk