Skip to main content

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 tools:
    • ready-made Depends for FastAPI
    • ready-made decorator for aiohttp server

Python pypi Tests Coverage

Code linter: ruff Checked with mypy Gitmoji

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.

Metadata

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)

Source distribution for telegram-wallet-pay 1.0.0
File Size Uploaded Provenance Actions
telegram_wallet_pay-1.0.0.tar.gz 21.7 kB Without provenance Details for telegram_wallet_pay-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for telegram-wallet-pay 1.0.0
File Interpreter ABI Platform Actions
telegram_wallet_pay-1.0.0-py3-none-any.whl Python 3 none any Details for telegram_wallet_pay-1.0.0-py3-none-any.whl

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

Security for telegram-wallet-pay 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page