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/bakong_relay_bot
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.1.tar.gz
(203.5 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.1-py3-none-any.whl
(208.3 kB
view details)
File details
Details for the file bakong_v2-1.0.1.tar.gz.
File metadata
- Download URL: bakong_v2-1.0.1.tar.gz
- Upload date:
- Size: 203.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f29fb2e92def37bea95da06ff37e4a1bc7a01969871a38548bcb68c0966dc6c
|
|
| MD5 |
48d2087944f901dbbbed0b257efacbc7
|
|
| BLAKE2b-256 |
74b1e9f656eaa9a007610165b65f042aa8e86ec48f59ab3a578c8bd2a1d0e6ec
|
File details
Details for the file bakong_v2-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bakong_v2-1.0.1-py3-none-any.whl
- Upload date:
- Size: 208.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 |
8294410e72a35a2016f895e3eb56a768da76c85cc61b73acf72ff37c9fca5aed
|
|
| MD5 |
60c7a466ad537f5a9f70143915402b50
|
|
| BLAKE2b-256 |
ef9b9eefc6e113dca7430bb809b870777c0f5bfbde9340eb02dd6f1aa0f7b5a0
|