Metadata-Version: 2.4
Name: bakong-v2
Version: 1.1.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
Project-URL: Source, https://bakong-v2.vercel.app
Keywords: bakong khqr payment cambodia
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: project-url
Dynamic: requires-python
Dynamic: summary

# bakong-v2

A Python package for Bakong KHQR payment integration using the BakongV2 API. (Unofficial)

## Installation

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

## Quick Start

```python
from bakong_v2 import KHQR

# Get your token at https://t.me/bakong_relay_bot
k = KHQR("your_token_here")

# Generate QR code
qr = k.create_qr(
    bank_account="your_account@bank",
    merchant_name="Your Store",
    merchant_city="Phnom Penh",
    amount=10.50,
    currency="USD",
)
print(qr)

# Check payment status
status = k.check_payment("your_md5_hash")
print(status)  # "PAID" or "UNPAID"

# Generate MD5
md5 = k.generate_md5(qr)
print(md5)

# Check Bakong account
account_info = k.check_account("user@bank")
print(account_info)

# Generate deeplink
link = k.generate_deeplink(qr)
print(link)
```

## API Reference

All methods send POST requests to `https://bakong-v2.vercel.app/api/v2/bakong/` with your token as a query parameter.

### `create_qr(bank_account, merchant_name, merchant_city, amount, currency, ...)`
Generate KHQR payment string.

### `generate_md5(qr)`
Generate MD5 hash from a QR string.

### `check_payment(md5)`
Check payment status by MD5 hash. Returns `"PAID"` or `"UNPAID"`.

### `get_payment(md5)`
Get payment details by MD5 hash. Returns transaction dict or `None`.

### `check_account(account_id)`
Check if a Bakong account exists.

### `check_payment_by_hash(hash)`
Check payment by full transaction hash.

### `check_payment_by_short_hash(hash, amount, currency)`
Check payment by short hash (8 chars).

### `check_payment_by_instruction_ref(ref)`
Check payment by instruction reference.

### `check_payment_by_external_ref(ref)`
Check payment by external reference.

### `check_bulk_payments(md5_list)`
Check multiple payments by MD5 hashes (max 50).

### `check_bulk_payments_by_hash(hash_list)`
Check multiple payments by full hashes (max 50).

### `generate_deeplink(qr, ...)`
Generate a Bakong deep link from a QR string.

### `qr_image(qr, format, output_path)`
Generate QR code image.

## Requirements

- Python >= 3.10
- No external dependencies required (uses only standard library)
