Metadata-Version: 2.4
Name: cambodia_bank
Version: 1.0.0
Summary: Dependency-free KHQR toolkit for Cambodia (Bakong, TrueMoney TRMC, ABA).
Keywords: khqr,bakong,truemoney,trmc,aba,cambodia,qrcode
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: image
Requires-Dist: qrcode[pil]>=7; extra == "image"

# cambodia_bank

A small, dependency-free KHQR toolkit for Cambodia.

## Supported banks

- **Bakong** — generate KHQR from an account id (``user@bkrt``)
- **TRMC (TrueMoney Cambodia)** — generate KHQR from a merchant id;
  the account ``trmckhppxxx@trmc`` is applied automatically
- **ABA KHQR** — from a PayWay payment link

## Install

```bash
pip install cambodia_bank
```

Optional, for QR images:

```bash
pip install "cambodia_bank[image]"
```

## Usage

```python
from cambodia_bank import KHQR

khqr = KHQR()

# Bakong
qr = khqr.create_qr(
    bank="bakong",
    account_id="eh_theng@bkrt",
    merchant_name="Leurizz Store",
    amount=1,
    currency="USD",
)

# TrueMoney
qr = khqr.create_qr(
    bank="trmc",
    account_id="13985958",
    merchant_name="VISA LIM",
    amount=1.15,
    currency="USD",
)

# ABA from a PayWay link
qr = khqr.create_qr(
    bank="abakhqr",
    payment_link="https://link.payway.com.kh/ABAPAYxxxx",
    amount=1,
)
```

`print(qr)` shows a JSON response with the QR string and its `md5`.

### Check a payment

```python
status = khqr.check_payment(bank="bakong", md5="<32-char md5>")
print(status)
```

Bakong/TRMC checks hit the Bakong check service
(`https://cambodia-bank.zorost4re.com/check`), overridable with the
`BAKONG_CHECK_URL` environment variable. Passing a Bakong developer token
(`KHQR(bakong_token="...")`) uses the official Bakong Open API instead.

ABA checks use `tran_id` + `client_id` from the ABA PayWay QR.
