Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mongolian_payment_golomt-1.0.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mongolian_payment_golomt-1.0.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mongolian_payment_golomt-1.0.0.tar.gz.

File metadata

File hashes

Hashes for mongolian_payment_golomt-1.0.0.tar.gz
Algorithm Hash digest
SHA256 95223f6b09eaf1974830245af51f1ca203f839614c2ea54010ed6d767e325c65
MD5 cecec7eb8c6e98cfed239132816e5d8c
BLAKE2b-256 6d6b8fd10d4992dc8dee4eb70902a30d5b7e9035de970249eb85a805c594821e

See more details on using hashes here.

File details

Details for the file mongolian_payment_golomt-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mongolian_payment_golomt-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18a70cb7cd600ab5bafba2b3f88f805d179ff980d40130d5cf273e1a590857fa
MD5 6a0fec8748962cf26c833bc1c512942c
BLAKE2b-256 5d33af81e9511afe29da2404f6eeeac286b63145a11b363126bff8ba0b9ffd03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page