mongolian-payment-khanbank
Khan Bank payment gateway SDK for Python. Supports both synchronous and asynchronous usage.
Installation
pip install mongolian-payment-khanbank
Usage
Synchronous
from mongolian_payment_khanbank import KhanBankClient, KhanBankConfig, OrderRegisterInput
client = KhanBankClient(KhanBankConfig(
endpoint="https://ecommerce.khanbank.com/payment/rest",
username="your_username",
password="your_password",
))
# Register a new order
result = client.register_order(OrderRegisterInput(
order_number="ORD-001",
amount=50000,
success_callback="https://example.com/success",
fail_callback="https://example.com/fail",
))
print(result.order_id) # Bank-assigned order ID
print(result.form_url) # Redirect user to this URL
# Check order status
status = client.check_order(result.order_id)
print(status.success) # True if payment succeeded
print(status.error_code)
print(status.error_message)
Asynchronous
import asyncio
from mongolian_payment_khanbank import AsyncKhanBankClient, KhanBankConfig, OrderRegisterInput
async def main():
async with AsyncKhanBankClient(KhanBankConfig(
endpoint="https://ecommerce.khanbank.com/payment/rest",
username="your_username",
password="your_password",
)) as client:
result = await client.register_order(OrderRegisterInput(
order_number="ORD-001",
amount=50000,
success_callback="https://example.com/success",
fail_callback="https://example.com/fail",
))
status = await client.check_order(result.order_id)
print(status.success)
asyncio.run(main())
Configuration from Environment Variables
from mongolian_payment_khanbank import KhanBankClient, load_config_from_env
client = KhanBankClient(load_config_from_env())
Required environment variables:
| Variable | Description |
|---|---|
KHANBANK_ENDPOINT |
Khan Bank API base URL |
KHANBANK_USERNAME |
API username |
KHANBANK_PASSWORD |
API password |
Optional environment variables:
| Variable | Description | Default |
|---|---|---|
KHANBANK_LANGUAGE |
Language code (mn or en) |
mn |
License
MIT
Metadata
Release files for mongolian-payment-khanbank 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mongolian_payment_khanbank-1.0.0.tar.gz | 7.0 kB | Without provenance | Details for mongolian_payment_khanbank-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mongolian_payment_khanbank-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mongolian_payment_khanbank-1.0.0-py3-none-any.whl |
Total release size: 14.0 kB
Release files / mongolian_payment_khanbank-1.0.0.tar.gz
| Download URL | mongolian_payment_khanbank-1.0.0.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2275efe5fa4791150f07109ad43a51d7f0b24e70f9659dc1b750b3770a0ad45f
|
|
BLAKE2b-256 checksum How to use checksums |
438722e1e63c95a150059e3ed1e41650a0a650cfed1bff9ec0f9c2db6c5137a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / mongolian_payment_khanbank-1.0.0-py3-none-any.whl
| Download URL | mongolian_payment_khanbank-1.0.0-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce58d2be474d0b8150438208980deb2d43d829f47966c7911824b2c0ae1abf1b
|
|
BLAKE2b-256 checksum How to use checksums |
8bf8f4d0bd4d1a21f7b701b04acffdeca082e43bbb7b31de54f513b3bde6c5d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Security for mongolian-payment-khanbank 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.