telegram-wallet-pay


Nametelegram-wallet-pay JSON
Version 0.5.0 PyPI version JSON
download
home_pageNone
SummaryAsync client for Telegram Wallet Pay API
upload_time2024-05-01 11:27:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords api pay telegram wallet async
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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/)
---

## 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

# use your token from https://pay.wallet.tg/
TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")


async def main() -> None:
    """Create order."""
    wallet = TelegramWalletPay(TOKEN)

    # create your first order
    response = await wallet.create_order(
        amount=40,
        currency_code="RUB",
        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

TOKEN = os.getenv("TELEGRAM_WALLET_PAY_TOKEN")


async def main() -> None:
    """Get order preview."""
    wallet = TelegramWalletPay(TOKEN)

    response = await wallet.get_order_preview("<your-order-id>")

    print("Response:", response)
    print("Order Preview:", response.data)

    await wallet.close()


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

```


## Other examples

* [Telegram bot example (aiogram)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/02_bot_example.py)
* [Webhook handler example (FastAPI)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/03_webhook_handler_example.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/b2/3a/abb2a20f035557d07d94f3fd274fd66e0533fbdb9b1de0b2fcb2ad3c8ad2/telegram_wallet_pay-0.5.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[![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---\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# use your token from https://pay.wallet.tg/\nTOKEN = os.getenv(\"TELEGRAM_WALLET_PAY_TOKEN\")\n\n\nasync def main() -> None:\n    \"\"\"Create order.\"\"\"\n    wallet = TelegramWalletPay(TOKEN)\n\n    # create your first order\n    response = await wallet.create_order(\n        amount=40,\n        currency_code=\"RUB\",\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\nTOKEN = os.getenv(\"TELEGRAM_WALLET_PAY_TOKEN\")\n\n\nasync def main() -> None:\n    \"\"\"Get order preview.\"\"\"\n    wallet = TelegramWalletPay(TOKEN)\n\n    response = await wallet.get_order_preview(\"<your-order-id>\")\n\n    print(\"Response:\", response)\n    print(\"Order Preview:\", response.data)\n\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_bot_example.py)\n* [Webhook handler example (FastAPI)](https://github.com/Olegt0rr/TelegramWalletPay/blob/main/examples/03_webhook_handler_example.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.5.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": "f8cc7a843642de00c096487f8325518bfb06d3228304f9a73ad5ceed5972d5ee",
                "md5": "29f8eba0c04d62d5e931e23554c207ef",
                "sha256": "8d37f49891779e0b84e88b3bbea981e4ceb66ba681244e5940c63e85bd57c010"
            },
            "downloads": -1,
            "filename": "telegram_wallet_pay-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "29f8eba0c04d62d5e931e23554c207ef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 16230,
            "upload_time": "2024-05-01T11:27:41",
            "upload_time_iso_8601": "2024-05-01T11:27:41.700079Z",
            "url": "https://files.pythonhosted.org/packages/f8/cc/7a843642de00c096487f8325518bfb06d3228304f9a73ad5ceed5972d5ee/telegram_wallet_pay-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b23aabb2a20f035557d07d94f3fd274fd66e0533fbdb9b1de0b2fcb2ad3c8ad2",
                "md5": "ce9076b92959e87ff6231d59336107cf",
                "sha256": "86276b5359e00f654076f15d10ed6539fca86c5d1e5ca17e265d20fb547cfb80"
            },
            "downloads": -1,
            "filename": "telegram_wallet_pay-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ce9076b92959e87ff6231d59336107cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14375,
            "upload_time": "2024-05-01T11:27:42",
            "upload_time_iso_8601": "2024-05-01T11:27:42.723837Z",
            "url": "https://files.pythonhosted.org/packages/b2/3a/abb2a20f035557d07d94f3fd274fd66e0533fbdb9b1de0b2fcb2ad3c8ad2/telegram_wallet_pay-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-01 11:27:42",
    "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"
}
        
Elapsed time: 0.24832s