HiPay payment gateway SDK for Python
Project description
mongolian-payment-hipay
HiPay payment gateway SDK for Python.
Installation
pip install mongolian-payment-hipay
Quick Start
from mongolian_payment_hipay import HiPayClient, HiPayConfig
client = HiPayClient(HiPayConfig(
endpoint="https://merchant.hipay.mn/api",
token="YOUR_BEARER_TOKEN",
entity_id="YOUR_ENTITY_ID",
))
# Create a checkout
checkout = client.checkout(50000)
print(checkout.qr_data)
print(checkout.checkout_id)
# Check checkout status
status = client.get_checkout(checkout.checkout_id)
print(status.status)
# Get payment details
payment = client.get_payment("payment-id")
print(payment.payment_brand)
# Submit a payment correction (refund)
correction = client.payment_correction("payment-id")
print(correction.correction_payment_id)
# Get a statement
statement = client.statement("2026-01-15")
for item in statement.data.list:
print(item.payment_id, item.amount)
Async Usage
from mongolian_payment_hipay import AsyncHiPayClient, HiPayConfig
async with AsyncHiPayClient(HiPayConfig(
endpoint="https://merchant.hipay.mn/api",
token="YOUR_BEARER_TOKEN",
entity_id="YOUR_ENTITY_ID",
)) as client:
checkout = await client.checkout(50000)
print(checkout.qr_data)
Environment Variables
You can load configuration from environment variables:
from mongolian_payment_hipay import HiPayClient, load_config_from_env
# Reads HIPAY_ENDPOINT, HIPAY_TOKEN, HIPAY_ENTITY_ID
config = load_config_from_env()
client = HiPayClient(config)
Checkout with Items
from mongolian_payment_hipay import CheckOutItem, CheckoutOptions
checkout = client.checkout(
50000,
CheckoutOptions(
ip_address="192.168.1.1",
items=[
CheckOutItem(
itemno="SKU001",
names="Product Name",
price=25000,
quantity=2,
brand="Brand",
measure="pcs",
vat=2500,
citytax=100,
)
],
),
)
Error Handling
from mongolian_payment_hipay import HiPayError
try:
checkout = client.checkout(50000)
except HiPayError as e:
print(e) # Error message
print(e.code) # Response code
print(e.details) # Validation error details
print(e.response) # Raw response body
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_hipay-1.0.0.tar.gz.
File metadata
- Download URL: mongolian_payment_hipay-1.0.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
135fcb92b761efe00ba4232006094ec8cf85eb4b8450f773400049f86df3c915
|
|
| MD5 |
e269f4af1a07ff835ce761f178258a8b
|
|
| BLAKE2b-256 |
24b58cff871ddd7701b5ca87d52733ff292fa5419928fbbfa1b542c3ca4009c4
|
File details
Details for the file mongolian_payment_hipay-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mongolian_payment_hipay-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.4 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 |
6806a5dc2f1f5a787b0848872dbcacf1d46aec9b17ffb04e3267f3b8d6188a47
|
|
| MD5 |
21d15380ae2b086c8147f2c40c7c9656
|
|
| BLAKE2b-256 |
3828b0cf75ff455deab4768fc68b2ffe105bf3f665a372b4d7670d812b98003a
|