telegram-wallet-pay 0.8.1

Creator: bradpython12

Last updated:

0 purchases

telegram-wallet-pay 0.8.1 Image
telegram-wallet-pay 0.8.1 Images

Languages

Categories

Add to Cart

Description:

telegramwalletpay 0.8.1

Telegram Wallet Pay
Python async client for Telegram Wallet Pay API made of aiohttp and pydantic
Also contains:

pydantic models for every schema, even for incoming webhooks
signature validation tool, including ready-made Depends for FastAPI








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

Telegram bot example (aiogram)
Webhook handler example (FastAPI)
Webhook handler example (aiohttp)

Also, feel free to open the
folder with examples,
and if there is something missing there, describe your needs in issue.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.