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.14.tar.gz
(27.4 kB
view details)
Built Distribution
aiocpa-0.1.14-py3-none-any.whl
(46.5 kB
view details)
File details
Details for the file aiocpa-0.1.14.tar.gz
.
File metadata
- Download URL: aiocpa-0.1.14.tar.gz
- Upload date:
- Size: 27.4 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 | 556bfea997880f1365d3822d26ea57e2cfaecb231128ea1e7e50ad1f778147bb |
|
MD5 | 122848fa0b0c5c3bc545cbbc74d7f99f |
|
BLAKE2b-256 | e6d385fb23d8a730713aeba357e59cefc01eb8429bef122cbe932ce29636d036 |
File details
Details for the file aiocpa-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: aiocpa-0.1.14-py3-none-any.whl
- Upload date:
- Size: 46.5 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 | c43148103e24a16d59896d6db395ed66a2cd5772ff308dfea10aa36b7f433589 |
|
MD5 | 80b6521dab8587bcdbb85e21425fd47b |
|
BLAKE2b-256 | 2bffeb1b860e36277c13f98672038323c3e2bdf1a47c53bf86f826054792a9ed |