Skip to main content

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


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.0.tar.gz (203.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bakong_v2-1.0.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file bakong_v2-1.0.0.tar.gz.

File metadata

  • Download URL: bakong_v2-1.0.0.tar.gz
  • Upload date:
  • Size: 203.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for bakong_v2-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8fec9a18eb7102027c47558603e877b36bd3546afa82dec935395539f43163a4
MD5 70137284adf15c3569ced0f7450ecb9a
BLAKE2b-256 dfd4416738e60dbec23548fbe76dc4c53b1297e4270382acea8b04d803a75374

See more details on using hashes here.

File details

Details for the file bakong_v2-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bakong_v2-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for bakong_v2-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a1b073525999be3541e7919cc24ece114b6833a9455e9289ee44679ad41ec5a
MD5 6c5d6dfbe89b18818af27579e9f5ab3c
BLAKE2b-256 b14eb16f58f21feff11ad775c9bdecc8651b6b12ea8c5bfacf28e6a59e539b9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page