TokiPay payment gateway SDK for Python
Project description
mongolian-payment-tokipay
TokiPay payment gateway SDK for Python.
Installation
pip install mongolian-payment-tokipay
Usage
from mongolian_payment_tokipay import TokiPayClient, TokiPayConfig, TokiPayPaymentInput
client = TokiPayClient(TokiPayConfig(
endpoint="https://api.tokipay.mn",
api_key="YOUR_API_KEY",
im_api_key="YOUR_IM_API_KEY",
authorization="YOUR_AUTH_TOKEN",
merchant_id="YOUR_MERCHANT_ID",
success_url="https://example.com/success",
failure_url="https://example.com/failure",
))
# Create a QR payment
result = client.payment_qr(TokiPayPaymentInput(
order_id="order_123",
amount=10000,
notes="Payment for order #123",
))
print(result.data.request_id)
Async usage
import asyncio
from mongolian_payment_tokipay import AsyncTokiPayClient, TokiPayConfig, TokiPayPaymentInput
async def main():
async with AsyncTokiPayClient(TokiPayConfig(
endpoint="https://api.tokipay.mn",
api_key="YOUR_API_KEY",
im_api_key="YOUR_IM_API_KEY",
authorization="YOUR_AUTH_TOKEN",
merchant_id="YOUR_MERCHANT_ID",
success_url="https://example.com/success",
failure_url="https://example.com/failure",
)) as client:
result = await client.payment_qr(TokiPayPaymentInput(
order_id="order_123",
amount=10000,
notes="Payment for order #123",
))
print(result.data.request_id)
asyncio.run(main())
Load config from environment
from mongolian_payment_tokipay import TokiPayClient, load_config_from_env
client = TokiPayClient(load_config_from_env())
Required environment variables: TOKIPAY_ENDPOINT, TOKIPAY_API_KEY, TOKIPAY_IM_API_KEY, TOKIPAY_AUTHORIZATION, TOKIPAY_MERCHANT_ID, TOKIPAY_SUCCESS_URL, TOKIPAY_FAILURE_URL.
Optional: TOKIPAY_APP_SCHEMA_IOS.
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_tokipay-1.0.0.tar.gz.
File metadata
- Download URL: mongolian_payment_tokipay-1.0.0.tar.gz
- Upload date:
- Size: 10.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 |
0b913ee7a4e76f4ed97f2a11dec03ab0a2604d09b2b31c7621046a689c4634d4
|
|
| MD5 |
f0eb7a771d5c32f3dd7bb9e7e353e02b
|
|
| BLAKE2b-256 |
cb9ac0a958b1c01e5dbc6eadbe92e6f445bd4ef55666a3310d7eb6cf4219bf2b
|
File details
Details for the file mongolian_payment_tokipay-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mongolian_payment_tokipay-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.3 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 |
a6c39a3a947617869b3adeac3165b8aa0893f1acb0d54f9d42046780f1e1583c
|
|
| MD5 |
fdc19c7f5844494f8921483786648737
|
|
| BLAKE2b-256 |
6d22609ffd81f51491e49a2136d49f2786fb88f4cb406e3e33a49164b6018486
|