Skip to main content

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

Python Code linter: ruff Checked with mypy Linters

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 wallet pay
TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")


async def main():
    # create API-client instance
    wallet = TelegramWalletPay(TOKEN)

    # create your first order
    result = await wallet.create_order(
        amount=40,
        currency_code="RUB",
        description="Test Payment",
        external_id=str(uuid4()),
        timeout_seconds=5 * 60,
        customer_telegram_user_id=66812456,
    )

    # let's print creation result
    print("Result:", result)
    print("Order:", result.data)

    # also you can update order status via `get_preview` method
    result = await wallet.get_preview(result.data.id)
    print("Updated Order Preview:", result.data)

    # don't forget close API-client instance on your app shutdown
    await wallet.close()


if __name__ == "__main__":
    asyncio.run(main())

Project details


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.0.4.tar.gz (7.2 kB view hashes)

Uploaded Source

Built Distribution

telegram_wallet_pay-0.0.4-py3-none-any.whl (8.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page