Telegram Wallet Pay
Python async client for Telegram Wallet Pay API
made of aiohttp and pydantic
Also contains:
pydanticmodels for every schema, even for incoming webhooks- signature validation tools:
- ready-made
DependsforFastAPI - ready-made decorator for
aiohttpserver
- ready-made
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
# store TELEGRAM_WALLET_PAY_TOKEN to your .env
# wallet token can be issued via https://pay.wallet.tg/
TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")
async def main() -> None:
"""Create order."""
# create wallet client instance
wallet = TelegramWalletPay(TOKEN)
# create your first order
response = await wallet.create_order(
amount=40,
currency_code="EUR",
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
# store TELEGRAM_WALLET_PAY_TOKEN to your .env
# wallet token can be issued via https://pay.wallet.tg/
TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")
async def main() -> None:
"""Get order preview."""
# create wallet client instance
wallet = TelegramWalletPay(TOKEN)
# get order preview
response = await wallet.get_order_preview("<your-order-id>")
# let's print received response
print("Response:", response)
print("Order Preview:", response.data)
# don't forget close API-client instance on your app shutdown
await wallet.close()
if __name__ == "__main__":
asyncio.run(main())
Other examples
Also, feel free to open the folder with examples, and if there is something missing there, describe your needs in issue.
Release files for telegram-wallet-pay 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| telegram_wallet_pay-1.0.0.tar.gz | 21.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| telegram_wallet_pay-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.7 kB
Release files / telegram_wallet_pay-1.0.0.tar.gz
| Download URL | telegram_wallet_pay-1.0.0.tar.gz |
|---|---|
| Size | 21.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cdf310d8281e24a4c805000695cce4be0c6c4f3fbbcf48a5eeb6110348165a3
|
|
BLAKE2b-256 checksum How to use checksums |
ca69b18e20496106bcf0156514728f77522ff884361f72b35b7338356a0032ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / telegram_wallet_pay-1.0.0-py3-none-any.whl
| Download URL | telegram_wallet_pay-1.0.0-py3-none-any.whl |
|---|---|
| Size | 20.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27cb79b642df978b55f7abad9903f961f6f0734a7ef1b81602e321cbac7e680d
|
|
BLAKE2b-256 checksum How to use checksums |
18249c953f77a1d731fe9f42f47437f3301a5a3bac4135f051746b6802040bc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|