sync & async Crypto Pay API client.
Project description
aiocpa
aiocpa is a syncronous & asynchronous Crypto Pay API client.
Official documentation
Quick start
import asyncio
from cryptopay import CryptoPay
async def main():
cp = CryptoPay(token="TOKEN")
app = await cp.get_me()
print(app.name) # Your App Name
if __name__ == "__main__":
asyncio.run(main())
aiogram 3.x integration example
import asyncio
from aiogram import Bot, Dispatcher
from cryptopay import CryptoPay
cp = CryptoPay("TOKEN")
bot = Bot("TOKEN")
dp = Dispatcher()
@dp.message()
async def get_invoice(message):
invoice = await cp.create_invoice(1, "USDT")
await message.answer(f"pay: {invoice.bot_invoice_url}")
invoice.await_payment(message=message)
@cp.polling_handler()
async def handle_payment(invoice, message):
await message.answer(f"invoice #{invoice.invoice_id} has been paid")
async def main():
await asyncio.gather(
dp.start_polling(bot),
cp.run_polling(),
)
if __name__ == "__main__":
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aiocpa-0.1.10.tar.gz
(22.7 kB
view details)
Built Distribution
aiocpa-0.1.10-py3-none-any.whl
(42.3 kB
view details)
File details
Details for the file aiocpa-0.1.10.tar.gz
.
File metadata
- Download URL: aiocpa-0.1.10.tar.gz
- Upload date:
- Size: 22.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e69cf745ec92af7303827ead6628c3b17a837613a9d34e2b3943ffc6f8fcba5f |
|
MD5 | 44d331a13bd298c157d3209ac8c83997 |
|
BLAKE2b-256 | db2a65586dc659aa628b0b59d2caf865c3eb390171c6a62a108fa30889462643 |
Provenance
File details
Details for the file aiocpa-0.1.10-py3-none-any.whl
.
File metadata
- Download URL: aiocpa-0.1.10-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.4 CPython/3.13.0 Windows/11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 262550fa704b91a347664f1f0191d16835b9315b399ed02459a6a437abefaf87 |
|
MD5 | fdf0f6d7cb45c03e179d9e1ea5f54979 |
|
BLAKE2b-256 | f11d906848674dd4efae99ea5a8000c3b4f82f2927ca7b125b54958f13a5daca |