blob: 54c9227fed5a4ae9a1350aa9dfde1fed36c4f4a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# async-crypto-pay-api



Async Crypto Pay API wrapper for [Telegram Crypto Bot](https://t.me/cryptobot) written in Python 3.10+.
## Requirements
- Python 3.10 or higher
- Valid Crypto Bot API token ([get one here](https://t.me/CryptoBot?start=pay))
## Installation
```bash
pip install async-crypto-pay-api
```
## Example
```python
from asyncio import run
from async_crypto_pay_api import CryptoPayApi
from async_crypto_pay_api.models import CurrencyType, FiatAsset
crypto = CryptoPayApi("{token}")
async def main() -> None:
# Context manager handles connection lifecycle
async with crypto:
app_info = await crypto.get_me()
print(app_info.model_dump_json(indent=4))
# Create payment invoice
invoice = await crypto.create_invoice(
currency_type=CurrencyType.FIAT,
fiat=FiatAsset.USD,
amount=100,
)
print(f"Invoice URL: {invoice.bot_invoice_url}")
run(main())
```
## License
This project is licensed under the GNU Lesser General Public License v3.0 only.
See [LICENSE](LICENSE) for details.
## Contributing
Contributions are welcome! Please open an issue or submit a PR for:
- Bug fixes
- New features
- Documentation improvements
|