A Python package for Bakong KHQR payment integration using the BakongV2 API. (Unofficial)
Project description
Bakong-V2
A Python package for Bakong KHQR payment integration powered by BakongV2 API.
All requests go through the BakongV2 relay — no direct connection to NBC needed, no Cambodia IP required.
Installation
pip install bakong-v2
For QR image generation:
pip install "bakong-v2[image]"
Quick Start
from bakong_v2 import KHQR
# Use your token from https://t.me/KHQRNotificationBot
khqr = KHQR("your_token_here")
# Generate QR string (local, no API call)
qr = khqr.create_qr(
bank_account="your_name@bank",
merchant_name="Your Name",
merchant_city="Phnom Penh",
amount=9800,
currency="KHR",
)
# Generate MD5 hash (local, no API call)
md5 = khqr.generate_md5(qr)
# Check payment status
status = khqr.check_payment(md5)
print(status) # "PAID" or "UNPAID"
# Get payment details
info = khqr.get_payment(md5)
print(info)
# Generate deeplink
link = khqr.generate_deeplink(
qr=qr,
appDeepLinkCallback="https://your-site.com/callback",
appIconUrl="https://your-site.com/logo.png",
appName="MyApp",
)
print(link)
All Methods
| Method | Description |
|---|---|
create_qr() |
Generate KHQR string locally |
generate_md5() |
Compute MD5 hash of QR string |
generate_deeplink() |
Generate Bakong deeplink |
check_payment(md5) |
Check payment by MD5 → "PAID"/"UNPAID" |
get_payment(md5) |
Get payment details by MD5 |
check_payment_by_hash(hash) |
Check payment by transaction hash |
get_payment_by_hash(hash) |
Get payment details by hash |
check_payment_by_short_hash(hash, amount, currency) |
Check payment by short hash |
get_payment_by_short_hash(hash, amount, currency) |
Get payment details by short hash |
check_payment_by_instruction_ref(ref) |
Check payment by instruction ref |
check_payment_by_external_ref(ref) |
Check payment by external ref |
check_account(account_id) |
Check Bakong account info |
check_bulk_payments(md5_list) |
Bulk check by MD5 list (max 50) |
check_bulk_payments_by_hash(hash_list) |
Bulk check by hash list (max 50) |
qr_image() |
Generate QR image (requires [image] extras) |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bakong_v2-1.0.2.tar.gz
(15.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
bakong_v2-1.0.2-py3-none-any.whl
(20.3 kB
view details)
File details
Details for the file bakong_v2-1.0.2.tar.gz.
File metadata
- Download URL: bakong_v2-1.0.2.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6912eb7f987f91114493dffbe6f35f40d2470ddc611e9a3f179299aa92898c0
|
|
| MD5 |
ba41779f5f8b8194c947feeacc13da45
|
|
| BLAKE2b-256 |
4abec7ed42114b1d73f58f92cbde29e6fbc53f53a71f00b0a4c0ceaccd4392dc
|
File details
Details for the file bakong_v2-1.0.2-py3-none-any.whl.
File metadata
- Download URL: bakong_v2-1.0.2-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9bf9a43a2669063ddb03afb5c00267ada5f4c01b97b0f57317665aec2f59eb7
|
|
| MD5 |
4dfb9b0d1748650ffb4e8229845ccebb
|
|
| BLAKE2b-256 |
60c19a6f2c120b2d1f312494ab3e16c6f3fb8af56c7271dce81facd13241d7b8
|