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
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_storepay-1.0.0.tar.gz.
File metadata
- Download URL: mongolian_payment_storepay-1.0.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a89f9de9722a48bd0ac399a83a39f927b66d60e084e65b742adb4bdb2003ed0
|
|
| MD5 |
9fbea0aba8d1ad1bdbf3be034f95c8e0
|
|
| BLAKE2b-256 |
780081238070207cd10aee013c68d22b1bcfc93be4db5660511b30f044f136e0
|
File details
Details for the file mongolian_payment_storepay-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mongolian_payment_storepay-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.2 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 |
03fad3893eaf1c16e703e81f89491c469fc327f98122b70edc1d977c7bffcb8c
|
|
| MD5 |
05cd0b1af09d1a174d9fc4212379c726
|
|
| BLAKE2b-256 |
dcae7e71ec7484485721e4a2f6524bef0f4632bfa34552db846093e27aa525a6
|