Metadata-Version: 2.4
Name: cryptopay-python-sdk
Version: 0.1.1
Summary: Sync + Async Python client for Telegram Crypto Pay API (Crypto Bot)
Project-URL: Homepage, https://github.com/medovi40k/crypto-pay-api
Project-URL: Repository, https://github.com/medovi40k/crypto-pay-api
Project-URL: Issues, https://github.com/medovi40k/crypto-pay-api/issues
Author: medovi40k
License: MIT License
        
        Copyright (c) 2026
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api,asyncio,crypto,cryptopay,httpx,requests,telegram
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24
Requires-Dist: requests>=2.31
Provides-Extra: dev
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=7.4; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Requires-Dist: types-requests>=2.31; extra == 'dev'
Description-Content-Type: text/markdown

# crypto-pay-api

[![PyPI](https://img.shields.io/pypi/v/crypto-pay-api)](https://pypi.org/project/crypto-pay-api/)
[![Python](https://img.shields.io/pypi/pyversions/crypto-pay-api)](https://pypi.org/project/crypto-pay-api/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

Sync + async Python client for the [Telegram Crypto Pay API](https://help.send.tg/en/articles/10279948-crypto-pay-api).

## Install

```bash
pip install crypto-pay-api
```

## Quick start

**Async** (recommended)

```python
import asyncio
from crypto_pay_api import CryptoPayAsync, CryptoPayConfig

async def main():
    cfg = CryptoPayConfig(token="YOUR_TOKEN")
    async with CryptoPayAsync(cfg) as cp:
        invoice = await cp.create_invoice(asset="USDT", amount=5)
        print(invoice["pay_url"])

asyncio.run(main())
```

**Sync**

```python
from crypto_pay_api import CryptoPay, CryptoPayConfig

cfg = CryptoPayConfig(token="YOUR_TOKEN")
with CryptoPay(cfg) as cp:
    invoice = cp.create_invoice(asset="USDT", amount=5)
    print(invoice["pay_url"])
```

## Configuration

```python
CryptoPayConfig(
    token="YOUR_TOKEN",
    network="mainnet",       # or "testnet"
    timeout=20.0,
    base_url_override=None,  # override API base URL if needed
)
```

## Methods

| Method | Description |
|---|---|
| `get_me()` | App info |
| `create_invoice(...)` | Create a payment invoice |
| `delete_invoice(invoice_id)` | Delete invoice |
| `get_invoices(...)` | List invoices |
| `create_check(...)` | Create a check |
| `delete_check(check_id)` | Delete check |
| `get_checks(...)` | List checks |
| `transfer(...)` | Send coins to a Telegram user |
| `get_transfers(...)` | List transfers |
| `get_balance()` | App balance |
| `get_exchange_rates()` | Current exchange rates |
| `get_currencies()` | Supported currencies |
| `get_stats(...)` | App statistics |

## Webhook verification

```python
from crypto_pay_api import verify_webhook_signature

ok = verify_webhook_signature(
    token="YOUR_TOKEN",
    raw_body=request.body,          # raw bytes
    signature_header=request.headers["crypto-pay-api-signature"],
)
```

## Error handling

```python
from crypto_pay_api import CryptoPayAPIError, CryptoPayHTTPError

try:
    invoice = cp.create_invoice(asset="USDT", amount=5)
except CryptoPayAPIError as e:
    print(e.error_code, e.raw)   # API-level error (ok=false)
except CryptoPayHTTPError as e:
    print(e)                     # network / HTTP error
```

## License

MIT
