Skip to main content

StorePay payment gateway SDK for Python

Project description

mongolian-payment-storepay

StorePay payment gateway SDK for Python. Supports both synchronous and asynchronous usage.

Installation

pip install mongolian-payment-storepay

Usage

Synchronous

from mongolian_payment_storepay import StorePayClient, StorePayConfig, StorePayLoanInput

client = StorePayClient(StorePayConfig(
    app_username="your_app_username",
    app_password="your_app_password",
    username="your_username",
    password="your_password",
    auth_url="https://auth.storepay.mn",
    base_url="https://api.storepay.mn",
    store_id="your_store_id",
    callback_url="https://example.com/callback",
))

# Create a loan
loan_id = client.loan(StorePayLoanInput(
    description="Order #001",
    mobile_number="99112233",
    amount=50000,
))

print(loan_id)  # Loan ID

# Check loan status
confirmed = client.loan_check(str(loan_id))
print(confirmed)  # True if confirmed

# Check user possible amount
amount = client.user_possible_amount("99112233")
print(amount)

# Clean up
client.close()

Asynchronous

import asyncio
from mongolian_payment_storepay import AsyncStorePayClient, StorePayConfig, StorePayLoanInput

async def main():
    async with AsyncStorePayClient(StorePayConfig(
        app_username="your_app_username",
        app_password="your_app_password",
        username="your_username",
        password="your_password",
        auth_url="https://auth.storepay.mn",
        base_url="https://api.storepay.mn",
        store_id="your_store_id",
        callback_url="https://example.com/callback",
    )) as client:
        loan_id = await client.loan(StorePayLoanInput(
            description="Order #001",
            mobile_number="99112233",
            amount=50000,
        ))

        confirmed = await client.loan_check(str(loan_id))
        print(confirmed)

asyncio.run(main())

Configuration from Environment Variables

from mongolian_payment_storepay import StorePayClient, load_config_from_env

client = StorePayClient(load_config_from_env())

Required environment variables:

Variable Description
STOREPAY_APP_USERNAME OAuth app username
STOREPAY_APP_PASSWORD OAuth app password
STOREPAY_USERNAME Basic Auth username
STOREPAY_PASSWORD Basic Auth password
STOREPAY_AUTH_URL Auth server URL
STOREPAY_BASE_URL API base URL
STOREPAY_STORE_ID Merchant store ID
STOREPAY_CALLBACK_URL Callback URL for loan notifications

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_storepay-1.0.0.tar.gz (9.1 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_storepay-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for mongolian_payment_storepay-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0a89f9de9722a48bd0ac399a83a39f927b66d60e084e65b742adb4bdb2003ed0
MD5 9fbea0aba8d1ad1bdbf3be034f95c8e0
BLAKE2b-256 780081238070207cd10aee013c68d22b1bcfc93be4db5660511b30f044f136e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mongolian_payment_storepay-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03fad3893eaf1c16e703e81f89491c469fc327f98122b70edc1d977c7bffcb8c
MD5 05cd0b1af09d1a174d9fc4212379c726
BLAKE2b-256 dcae7e71ec7484485721e4a2f6524bef0f4632bfa34552db846093e27aa525a6

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