Metadata-Version: 2.4
Name: bakong-v2
Version: 1.0.0
Summary: A Python package for Bakong KHQR payment integration using the BakongV2 API. (Unofficial)
Home-page: https://bakong-v2.vercel.app
Author: Lim Visa
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: image
Requires-Dist: pillow; extra == "image"
Requires-Dist: qrcode; extra == "image"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-python
Dynamic: summary

# Bakong-V2

A Python package for Bakong KHQR payment integration powered by [BakongV2 API](https://bakong-v2.vercel.app).

All requests go through the BakongV2 relay — no direct connection to NBC needed, no Cambodia IP required.

## Installation

```bash
pip install bakong-v2
```

For QR image generation:

```bash
pip install "bakong-v2[image]"
```

## Quick Start

```python
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
