Golomt Bank payment gateway SDK for Python
Project description
mongolian-payment-golomt
Golomt Bank payment gateway SDK for Python.
Provides both synchronous and asynchronous clients for the Golomt Bank ecommerce payment API, with automatic HMAC-SHA256 checksum generation and bearer token authentication.
Installation
pip install mongolian-payment-golomt
Quick Start
Synchronous
from mongolian_payment_golomt import GolomtClient, GolomtConfig, CreateInvoiceInput
client = GolomtClient(GolomtConfig(
endpoint="https://ecommerce.golomtbank.com",
secret="your-hmac-secret",
bearer_token="your-bearer-token",
))
# Create an invoice
invoice = client.create_invoice(CreateInvoiceInput(
amount=1000,
transaction_id="txn-001",
return_type="POST",
callback="https://yoursite.com/callback",
get_token=False,
social_deeplink=False,
))
# Get payment URL
url = client.get_payment_url(invoice.invoice)
print(url)
# Check transaction status
status = client.inquiry("txn-001")
print(status.status)
client.close()
Asynchronous
import asyncio
from mongolian_payment_golomt import AsyncGolomtClient, GolomtConfig, CreateInvoiceInput
async def main():
async with AsyncGolomtClient(GolomtConfig(
endpoint="https://ecommerce.golomtbank.com",
secret="your-hmac-secret",
bearer_token="your-bearer-token",
)) as client:
invoice = await client.create_invoice(CreateInvoiceInput(
amount=1000,
transaction_id="txn-001",
return_type="POST",
callback="https://yoursite.com/callback",
get_token=False,
social_deeplink=False,
))
print(invoice.invoice)
asyncio.run(main())
Load Config from Environment
from mongolian_payment_golomt import GolomtClient, load_config_from_env
config = load_config_from_env()
client = GolomtClient(config)
Required environment variables:
| Variable | Description |
|---|---|
GOLOMT_ENDPOINT |
Base URL of the Golomt Bank API |
GOLOMT_SECRET |
HMAC-SHA256 secret key |
GOLOMT_BEARER_TOKEN |
Bearer token for Authorization header |
API Reference
GolomtClient / AsyncGolomtClient
| Method | Description |
|---|---|
create_invoice(input) |
Create a payment invoice |
inquiry(transaction_id) |
Check transaction status |
pay_by_token(amount, token, transaction_id, lang) |
Pay using a saved token |
get_payment_url(invoice, lang, payment_method) |
Build payment redirect URL |
Constants
| Class | Values |
|---|---|
Lang |
MN, EN |
PaymentMethod |
PAYMENT, SOCIALPAY |
ReturnType |
POST, GET, MOBILE |
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_golomt-1.0.0.tar.gz.
File metadata
- Download URL: mongolian_payment_golomt-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95223f6b09eaf1974830245af51f1ca203f839614c2ea54010ed6d767e325c65
|
|
| MD5 |
cecec7eb8c6e98cfed239132816e5d8c
|
|
| BLAKE2b-256 |
6d6b8fd10d4992dc8dee4eb70902a30d5b7e9035de970249eb85a805c594821e
|
File details
Details for the file mongolian_payment_golomt-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mongolian_payment_golomt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.6 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 |
18a70cb7cd600ab5bafba2b3f88f805d179ff980d40130d5cf273e1a590857fa
|
|
| MD5 |
6a0fec8748962cf26c833bc1c512942c
|
|
| BLAKE2b-256 |
5d33af81e9511afe29da2404f6eeeac286b63145a11b363126bff8ba0b9ffd03
|