# Telegram Wallet Pay
Python async client for [Telegram Wallet Pay API](https://pay.wallet.tg) 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`
[![Python](https://img.shields.io/pypi/pyversions/telegram-wallet-pay.svg)](https://pypi.org/project/telegram-wallet-pay/)
[![pypi](https://img.shields.io/pypi/v/telegram-wallet-pay?label=pypi%20package)](https://pypi.org/project/telegram-wallet-pay/)
[![Tests](https://github.com/Olegt0rr/TelegramWalletPay/actions/workflows/tests.yml/badge.svg)](https://github.com/Olegt0rr/TelegramWalletPay/actions/workflows/tests.yml)
[![Coverage](https://img.shields.io/codecov/c/github/Olegt0rr/TelegramWalletPay)](https://app.codecov.io/gh/Olegt0rr/TelegramWalletPay)
[![Code linter: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org)
[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😎-FFDD67.svg)](https://gitmoji.dev)
---
## 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
```python
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
```python
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)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/02_telegram_bot.py)
* [Webhook handler example (FastAPI)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/03_webhook_handler_fastapi.py)
* [Webhook handler example (aiohttp)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/04_webhook_handler_aiohttp.py)
Also, feel free to open the
[folder with examples](https://github.com/Olegt0rr/TelegramWalletPay/tree/main/examples),
and if there is something missing there, describe your needs in [issue](https://github.com/Olegt0rr/TelegramWalletPay/issues/new/choose).
Raw data
{
"_id": null,
"home_page": null,
"name": "telegram-wallet-pay",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "Oleg Abramov <oleg@trueweb.app>",
"keywords": "API, Pay, Telegram, Wallet, async",
"author": null,
"author_email": "Oleg Abramov <oleg@trueweb.app>",
"download_url": "https://files.pythonhosted.org/packages/df/f6/8397699e41b6b97651b373bb7d2ec80b55efb5c80d2fcda82324768a20b5/telegram_wallet_pay-0.8.0.tar.gz",
"platform": null,
"description": "# Telegram Wallet Pay\n\nPython async client for [Telegram Wallet Pay API](https://pay.wallet.tg) made of `aiohttp` and `pydantic`\n\n**Also contains:**\n - `pydantic` models for every schema, even for incoming webhooks\n - signature validation tool, including ready-made `Depends` for `FastAPI`\n\n[![Python](https://img.shields.io/pypi/pyversions/telegram-wallet-pay.svg)](https://pypi.org/project/telegram-wallet-pay/)\n[![pypi](https://img.shields.io/pypi/v/telegram-wallet-pay?label=pypi%20package)](https://pypi.org/project/telegram-wallet-pay/)\n[![Tests](https://github.com/Olegt0rr/TelegramWalletPay/actions/workflows/tests.yml/badge.svg)](https://github.com/Olegt0rr/TelegramWalletPay/actions/workflows/tests.yml)\n[![Coverage](https://img.shields.io/codecov/c/github/Olegt0rr/TelegramWalletPay)](https://app.codecov.io/gh/Olegt0rr/TelegramWalletPay)\n\n[![Code linter: ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org)\n[![Gitmoji](https://img.shields.io/badge/gitmoji-%20\ud83d\ude0e-FFDD67.svg)](https://gitmoji.dev)\n---\n\n## Get started\n\n### Read Telegram Wallet Pay API docs\n\nhttps://docs.wallet.tg/pay/#section/Get-started\n\n### Install our library\n\n```\npip install telegram-wallet-pay\n```\n\n### Create order\n\n```python\nimport asyncio\nimport os\nfrom uuid import uuid4\n\nfrom telegram_wallet_pay import TelegramWalletPay\n\n# store TELEGRAM_WALLET_PAY_TOKEN to your .env\n# wallet token can be issued via https://pay.wallet.tg/\nTOKEN = os.getenv(\"TELEGRAM_WALLET_PAY_TOKEN\")\n\n\nasync def main() -> None:\n \"\"\"Create order.\"\"\"\n # create wallet client instance\n wallet = TelegramWalletPay(TOKEN)\n\n # create your first order\n response = await wallet.create_order(\n amount=40,\n currency_code=\"EUR\",\n description=\"TestPayment\",\n external_id=str(uuid4()),\n timeout_seconds=5 * 60,\n customer_telegram_user_id=66812456,\n )\n\n # let's print creation response\n print(\"Response:\", response)\n print(\"Order:\", response.data)\n\n # don't forget close API-client instance on your app shutdown\n await wallet.close()\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n\n```\n\n\n### Get order preview\n\n```python\nimport asyncio\nimport os\n\nfrom telegram_wallet_pay import TelegramWalletPay\n\n# store TELEGRAM_WALLET_PAY_TOKEN to your .env\n# wallet token can be issued via https://pay.wallet.tg/\nTOKEN = os.getenv(\"TELEGRAM_WALLET_PAY_TOKEN\")\n\n\nasync def main() -> None:\n \"\"\"Get order preview.\"\"\"\n # create wallet client instance\n wallet = TelegramWalletPay(TOKEN)\n\n # get order preview\n response = await wallet.get_order_preview(\"<your-order-id>\")\n\n # let's print received response\n print(\"Response:\", response)\n print(\"Order Preview:\", response.data)\n\n # don't forget close API-client instance on your app shutdown\n await wallet.close()\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n\n```\n\n\n## Other examples\n\n* [Telegram bot example (aiogram)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/02_telegram_bot.py)\n* [Webhook handler example (FastAPI)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/03_webhook_handler_fastapi.py)\n* [Webhook handler example (aiohttp)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/04_webhook_handler_aiohttp.py)\n\nAlso, feel free to open the\n[folder with examples](https://github.com/Olegt0rr/TelegramWalletPay/tree/main/examples),\nand if there is something missing there, describe your needs in [issue](https://github.com/Olegt0rr/TelegramWalletPay/issues/new/choose).\n",
"bugtrack_url": null,
"license": null,
"summary": "Async client for Telegram Wallet Pay API",
"version": "0.8.0",
"project_urls": {
"Documentation": "https://docs.wallet.tg/pay/",
"Repository": "https://github.com/Olegt0rr/TelegramWalletPay"
},
"split_keywords": [
"api",
" pay",
" telegram",
" wallet",
" async"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a94c8d2290e053b581cdc6247b704f359069a68bf6199474ce37547d03d46178",
"md5": "c8d4a0e60b4e157aa1001647e2a23a8e",
"sha256": "93942e74887c552862bb5a3894c14801c2e423a60f0c351a58b4f4d5495399dd"
},
"downloads": -1,
"filename": "telegram_wallet_pay-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c8d4a0e60b4e157aa1001647e2a23a8e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 19932,
"upload_time": "2024-05-17T06:46:21",
"upload_time_iso_8601": "2024-05-17T06:46:21.080413Z",
"url": "https://files.pythonhosted.org/packages/a9/4c/8d2290e053b581cdc6247b704f359069a68bf6199474ce37547d03d46178/telegram_wallet_pay-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dff68397699e41b6b97651b373bb7d2ec80b55efb5c80d2fcda82324768a20b5",
"md5": "e85d0ed493c7b9bedfc0b584c431fc07",
"sha256": "5bfee6307c7dccb3ec0a615c24c85df106c72d980cbf4ede12cf10476063e4fe"
},
"downloads": -1,
"filename": "telegram_wallet_pay-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "e85d0ed493c7b9bedfc0b584c431fc07",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 20679,
"upload_time": "2024-05-17T06:46:22",
"upload_time_iso_8601": "2024-05-17T06:46:22.846406Z",
"url": "https://files.pythonhosted.org/packages/df/f6/8397699e41b6b97651b373bb7d2ec80b55efb5c80d2fcda82324768a20b5/telegram_wallet_pay-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 06:46:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Olegt0rr",
"github_project": "TelegramWalletPay",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "telegram-wallet-pay"
}