MongolChat payment gateway SDK for Python
Project description
mongolian-payment-mongolchat
MongolChat payment gateway SDK for Python. Supports both synchronous and asynchronous usage.
Installation
pip install mongolian-payment-mongolchat
Usage
Synchronous
from mongolian_payment_mongolchat import MongolChatClient, MongolChatConfig, MchatGenerateQrInput, MchatProduct
client = MongolChatClient(MongolChatConfig(
endpoint="https://api.mongolchat.mn",
api_key="your_api_key",
worker_key="your_worker_key",
app_secret="your_app_secret",
branch_no="001",
))
# Generate a QR code
qr = client.generate_qr(MchatGenerateQrInput(
amount=5000,
products=[MchatProduct(product_name="Coffee", quantity="1", price=5000, tag="food")],
title="Coffee Shop",
sub_title="Order #123",
noat="123456",
nhat="654321",
ttd="789",
reference_number="REF-001",
expire_time="2026-12-31T23:59:59",
))
print(qr.qr) # QR code string
# Check QR payment status
status = client.check_qr(qr.qr)
print(status.status)
Asynchronous
import asyncio
from mongolian_payment_mongolchat import AsyncMongolChatClient, MongolChatConfig, MchatGenerateQrInput, MchatProduct
async def main():
async with AsyncMongolChatClient(MongolChatConfig(
endpoint="https://api.mongolchat.mn",
api_key="your_api_key",
worker_key="your_worker_key",
app_secret="your_app_secret",
branch_no="001",
)) as client:
qr = await client.generate_qr(MchatGenerateQrInput(
amount=5000,
products=[MchatProduct(product_name="Coffee", quantity="1", price=5000, tag="food")],
title="Coffee Shop",
sub_title="Order #123",
noat="123456",
nhat="654321",
ttd="789",
reference_number="REF-001",
expire_time="2026-12-31T23:59:59",
))
status = await client.check_qr(qr.qr)
print(status.status)
asyncio.run(main())
Configuration from Environment Variables
from mongolian_payment_mongolchat import MongolChatClient, load_config_from_env
client = MongolChatClient(load_config_from_env())
Required environment variables:
| Variable | Description |
|---|---|
MONGOLCHAT_ENDPOINT |
MongolChat API base URL |
MONGOLCHAT_API_KEY |
API key for the api-key header |
MONGOLCHAT_WORKER_KEY |
Worker key for Authorization: WorkerKey header |
MONGOLCHAT_APP_SECRET |
Application secret |
MONGOLCHAT_BRANCH_NO |
Branch number |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mongolian_payment_mongolchat-1.0.0.tar.gz.
File metadata
- Download URL: mongolian_payment_mongolchat-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
555f58341428169e5d2a30a736ec6b1ef1aad44042c5bea25e26a4c34a9eb1a0
|
|
| MD5 |
6dc74f9c896248777d3e35cf6b3368e5
|
|
| BLAKE2b-256 |
0fafc3b362e38f5f6de4536df927f39c3121b8ba2e89072e94c713a3dc378869
|
File details
Details for the file mongolian_payment_mongolchat-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mongolian_payment_mongolchat-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
905e49ac0c9756ea375a2835c07ae736d53205f7d8cf86f9a9eafaf2f8d83e26
|
|
| MD5 |
85ade785e0bf42bc16cd44bff7baa3bf
|
|
| BLAKE2b-256 |
47a2413bc1ee61bc5e25c5743b89abd11ee02f108ce4244bc094eadf9c542228
|