Skip to content

NEFORCEO/aiosend

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

393 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aiosend

Python Crypto Pay API Documentation Status Pydantic v2 Aiohttp uv Code linter: ruff Checked with mypy

aiosend is a synchronous & asynchronous Crypto Pay API client.

Quick start

import asyncio
from aiosend import CryptoPay


async def main():
    cp = CryptoPay(token="TOKEN")
    app = await cp.get_me()
    print(app.name)  # Your App's Name


if __name__ == "__main__":
    asyncio.run(main())

aiogram 3.x integration example

import asyncio
from aiogram import Bot, Dispatcher
from aiosend 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.poll(message=message)


@cp.invoice_paid()
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.start_polling(),
    )


if __name__ == "__main__":
    asyncio.run(main())

About

synchronous & asynchronous Crypto Pay API client.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%