Async client for Telegram Wallet Pay API
Project description
Telegram Wallet Pay
Python async client for Telegram Wallet Pay API made of aiohttp
and pydantic
Get started
Read Telegram Wallet Pay API docs
https://docs.wallet.tg/pay/#section/Get-started
Install our library
pip install telegram-wallet-pay
Create order
import asyncio
import os
from uuid import uuid4
from telegram_wallet_pay import TelegramWalletPay
# use your token from https://pay.wallet.tg/
TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")
async def main() -> None:
"""Create order."""
wallet = TelegramWalletPay(TOKEN)
# create your first order
response = await wallet.create_order(
amount=40,
currency_code="RUB",
description="TestPayment",
external_id=str(uuid4()),
timeout_seconds=5 * 60,
customer_telegram_user_id=66812456,
)
# let's print creation response
print("Response:", response)
print("Order:", response.data)
# don't forget close API-client instance on your app shutdown
await wallet.close()
if __name__ == "__main__":
asyncio.run(main())
Get order preview
import asyncio
import os
from telegram_wallet_pay import TelegramWalletPay
TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")
async def main() -> None:
"""Get order preview."""
wallet = TelegramWalletPay(TOKEN)
response = await wallet.get_order_preview("<your-order-id>")
print("Response:", response)
print("Order Preview:", response.data)
await wallet.close()
if __name__ == "__main__":
asyncio.run(main())
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
telegram_wallet_pay-0.3.2.tar.gz
(10.5 kB
view hashes)
Built Distribution
Close
Hashes for telegram_wallet_pay-0.3.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 265191f0678c8b52cde48cca65fd3ce1f67cd1d04ce2956d598e2ae5f1c67a9c |
|
MD5 | cb58e1a30e0716ecfdd033308a2d9dc8 |
|
BLAKE2b-256 | d6906ef67001bfd987c72f977eea29e8db7223e32a1a6d4a603050062196c092 |
Close
Hashes for telegram_wallet_pay-0.3.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 049421a074ecb526aa6992f252db6d90083bf0fbe2d66c19dca5aacf6207b62c |
|
MD5 | 0fdf94e2b4e174ca909f9bf99f330701 |
|
BLAKE2b-256 | f27ec8ce4a2324b1d497052d00c3c8a0fe489bfdf6dcc0e4b99b7dac20f2ae51 |