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.8.tar.gz
(22.6 kB
view details)
Built Distribution
aiocpa-0.1.8-py3-none-any.whl
(42.3 kB
view details)
File details
Details for the file aiocpa-0.1.8.tar.gz
.
File metadata
- Download URL: aiocpa-0.1.8.tar.gz
- Upload date:
- Size: 22.6 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 | cc3a1bcb93ac650a8342dcc943517f6926a73ab6e990616d990525bf1a4bd161 |
|
MD5 | 8de4cd98bf7640c909a3893f395d1c14 |
|
BLAKE2b-256 | 93c552fe83e07581131425ffb2030923575b48c6c077742c7c8bbf07bf1a0399 |
Provenance
File details
Details for the file aiocpa-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: aiocpa-0.1.8-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 | ccfed264344bd46331b71b4183675be2853b192f3d9523eb31c35002db840124 |
|
MD5 | acda7e241de57c41e57b1fadf1d76736 |
|
BLAKE2b-256 | 15b29c1802a368c78d97cd4ac6edab25d91786133630e39a4142cf8b063deb75 |