Shortcut methods

These methods simplify the use of standard Crypto Pay API methods and also provide additional functionality to the objects.

Updating objects

Balance.update()

Shortcut for method aiosend.CryptoPay.get_balance().

Use this method to update balance object.

Source: https://help.send.tg/en/articles/10279948-crypto-pay-api#h_86005049de

Return type:

None

Check.update()

Shortcut for method aiosend.CryptoPay.get_checks().

Use this method to update check object.

Source: https://help.send.tg/en/articles/10279948-crypto-pay-api#h_d23dda1828

Return type:

None

ExchangeRate.update()

Shortcut for method aiosend.CryptoPay.get_exchange_rates().

Use this method to update ExchangeRate object.

Source: https://help.send.tg/en/articles/10279948-crypto-pay-api#h_bc0e2dee1c

Return type:

None

Invoice.update()

Shortcut for method aiosend.CryptoPay.get_invoices().

Use this method to update invoice object.

Source: https://help.send.tg/en/articles/10279948-crypto-pay-api#h_e4c2ccb208

Return type:

None

Deleting objects

Check.delete()

Shortcut for method aiosend.CryptoPay.delete_check().

Use this method to delete check created by your app. Returns True on success.

Source: https://help.send.tg/en/articles/10279948-crypto-pay-api#h_b27428d56a

Return type:

bool

Invoice.delete()

Shortcut for method aiosend.CryptoPay.delete_invoice().

Use this method to delete invoice created by your app. Returns True on success.

Source: https://help.send.tg/en/articles/10279948-crypto-pay-api#h_da2ea9f39c

Return type:

bool

QR code of object

property Check.qr: str

Get check qr code.

property Invoice.qr: str

Get invoice qr code.

Check image

Check.get_image(fiat)

Get check preview image.

Return type:

str

Poll objects

Check.poll(**kwargs)

Send the check to the polling manager.

Use this method to check the status of the check until the timeout expires.

Parameters:

kwargs (object) – additional payload for the handler.

Return type:

None

Invoice.poll(**kwargs)

Send the invoice to the polling manager.

Use this method to check the status of the invoice until the timeout expires.

Parameters:

kwargs (object) – additional payload for the handler.

Return type:

None

Usage examples

import asyncio
from aiosend import CryptoPay

async def main() -> None:
    cp = CryptoPay("TOKEN")

    invoice = await cp.create_invoice(1, "USDT")

    print(invoice.status)  # active
    await asyncio.sleep(10)  # payment
    await invoice.update()
    print(invoice.status)  # paid

    print(invoice.qr)  # qr code link

    await invoice.delete()  # delete the invoice

if __name__ == "__main__":
    asyncio.run(main())
import asyncio
from aiosend import CryptoPay

async def main() -> None:
    cp = CryptoPay("TOKEN")

    check = await cp.create_check(1, "USDT")

    # invoice preview image with fiat conversion
    print(await check.get_image("USD"))

    print(check.qr)  # check qr code link

    await check.delete()  # delete check

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