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.11.tar.gz
(22.5 kB
view details)
Built Distribution
aiocpa-0.1.11-py3-none-any.whl
(42.0 kB
view details)
File details
Details for the file aiocpa-0.1.11.tar.gz
.
File metadata
- Download URL: aiocpa-0.1.11.tar.gz
- Upload date:
- Size: 22.5 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 | 7bdbbeabae63b2ef1fa5d81a9c1bfea9269a5f2731b91e0e018fa49469b60c0d |
|
MD5 | 22143c659377752d6080bbee6b2b4f8e |
|
BLAKE2b-256 | 72da3e7bb0febb1be5e7079f8787682bf401d4c77eb337ebeea5eff9dab07b07 |
Provenance
File details
Details for the file aiocpa-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: aiocpa-0.1.11-py3-none-any.whl
- Upload date:
- Size: 42.0 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 | 8dbd5da802b93a98bb0114f82eece4051e2f7ddaba94d12431e15b9b17a2652d |
|
MD5 | 30df4f57bbb8df6ff6d9254e208c6dc4 |
|
BLAKE2b-256 | 83ce5ee9a44f78b8e9c239ac2cbff6039c722bc76c40d5648e519398eba01130 |