Methods

Crypto Pay API methods implementation.

CryptoPay.get_me()

getMe method.

Use this method to test your app’s authentication token. Requires no parameters. On success, returns basic information about an app.

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

Return type:

App

CryptoPay.create_invoice(amount, asset=None, *, currency_type=None, fiat=None, accepted_assets=None, swap_to=None, description=None, hidden_message=None, paid_btn_name=None, paid_btn_url=None, payload=None, allow_comments=None, allow_anonymous=None, expires_in=None)

createInvoice method.

Use this method to create a new invoice. On success, returns an object of the created aiosend.types.Invoice.

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

Parameters:
  • amount (float) – Amount of the invoice in float. For example: 125.50

  • currency_type (CurrencyType | None) – Optional. Type of the price, can be “crypto” or “fiat”. Defaults to crypto.

  • asset (Asset | None) – Optional. Required if currency_type is “crypto”. Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC”.

  • fiat (Fiat | None) – Optional. Required if currency_type is “fiat”. Fiat currency code. Supported fiat currencies: “USD”, “EUR”, “RUB”, “BYN”, “UAH”, “GBP”, “CNY”, “KZT”, “UZS”, “GEL”, “TRY”, “AMD”, “THB”, “INR”, “BRL”, “IDR”, “AZN”, “AED”, “PLN” and “ILS”.

  • accepted_assets (list[Asset] | None) – Optional. List of cryptocurrency alphabetic codes. Assets which can be used to pay the invoice. Available only if currency_type is “fiat”. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet). Defaults to all currencies.

  • swap_to (Asset | None) – Optional. The asset that will be attempted to be swapped into after the user makes a payment (the swap is not guaranteed). Supported assets: “USDT”, “TON”, “TRX”, “ETH”, “SOL”, “BTC”, “LTC”.

  • description (str | None) – Optional. Description for the invoice. User will see this description when they pay the invoice. Up to 1024 characters.

  • hidden_message (str | None) – Optional. Text of the message which will be presented to a user after the invoice is paid. Up to 2048 characters.

  • paid_btn_name (PaidBtnName | None) – Optional. Label of the button which will be presented to a user after the invoice is paid.

  • paid_btn_url (str | None) – Optional. Required if paid_btn_name is specified. URL opened using the button which will be presented to a user after the invoice is paid. You can set any callback link (for example, a success link or link to homepage). Starts with https or http.

  • payload (str | None) – Optional. Any data you want to attach to the invoice (for example, user ID, payment ID, ect). Up to 4kb.

  • allow_comments (bool | None) – Optional. Allow a user to add a comment to the payment. Defaults to True.

  • allow_anonymous (bool | None) – Optional. Allow a user to pay the invoice anonymously. Defaults to True.

  • expires_in (int | None) – Optional. You can set a payment time limit for the invoice in seconds. Values between 1-2678400 are accepted.

Return type:

Invoice

CryptoPay.delete_invoice(invoice_id)

deleteInvoice method.

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

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

Parameters:

invoice_id (int) – Invoice ID to be deleted.

Return type:

bool

Tip

To use /create_check method you need to enable it to the restriction settings in @CryptoBot as follows:

🏝 Crypto Pay -> My Apps -> <Your App> -> Security -> Checks -> Enable.

CryptoPay.create_check(amount, asset, pin_to_user_id=None, pin_to_username=None)

createCheck method.

Use this method to create a new check. On success, returns an object of the created aiosend.types.Check.

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

Parameters:
  • amount (float) – Amount of the check in float. For example: 125.50

  • asset (Asset) – Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

  • pin_to_user_id (int | None) – Optional. ID of the user who will be able to activate the check.

  • pin_to_username (str | None) – Optional. A user with the specified username will be able to activate the check.

Return type:

Check

CryptoPay.delete_check(check_id)

deleteCheck method.

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

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

Parameters:

check_id (int) – Check ID to be deleted.

Return type:

bool

Tip

To use /transfer method you need to enable it to the restriction settings in @CryptoBot as follows:

🏝 Crypto Pay -> My Apps -> <Your App> -> Security -> Transfers -> Enable.

CryptoPay.transfer(user_id, asset, amount, spend_id=None, comment=None, *, disable_send_notification=None)

transfer method.

Use this method to send coins from your app’s balance to a user. On success, returns completed aiosend.types.Transfer. This method must first be enabled in the security settings of your app.

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

Parameters:
  • user_id (int) – User ID in Telegram. User must have previously used @CryptoBot (@CryptoTestnetBot for testnet).

  • asset (Asset) – Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

  • amount (float) – Amount of the transfer in float. The minimum and maximum amount limits for each of the supported assets roughly correspond to 1-25000 USD. Use aiosend.CryptoPay.get_exchange_rates() to convert amounts. For example: 125.50

  • spend_id (str | None) – Random UTF-8 string unique per transfer for idempotent requests. The same spend_id can be accepted only once from your app. Up to 64 symbols.

  • comment (str | None) – Optional. Comment for the transfer. Users will see this comment in the notification about the transfer. Up to 1024 symbols.

  • disable_send_notification (bool | None) – Optional. Pass true to not send to the user the notification about the transfer. Defaults to False.

Return type:

Transfer

CryptoPay.get_invoices(asset=None, fiat=None, invoice_ids=None, status=None, offset=None, count=None)

getInvoices method.

Use this method to get invoices created by your app. On success, returns array of aiosend.types.Invoice.

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

Parameters:
  • asset (Asset | None) – Optional. Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet). Defaults to all currencies.

  • fiat (Fiat | None) – Optional. Fiat currency code. Supported fiat currencies: “USD”, “EUR”, “RUB”, “BYN”, “UAH”, “GBP”, “CNY”, “KZT”, “UZS”, “GEL”, “TRY”, “AMD”, “THB”, “INR”, “BRL”, “IDR”, “AZN”, “AED”, “PLN” and “ILS”. Defaults to all currencies.

  • invoice_ids (list[int] | None) – Optional. List of invoice IDs separated by comma.

  • status (Optional[Literal[ACTIVE, PAID]]) – Optional. Status of invoices to be returned. Available statuses: “active” and “paid”. Defaults to all statuses.

  • offset (int | None) – Optional. Offset needed to return a specific subset of invoices. Defaults to 0.

  • count (int | None) – Optional. Number of invoices to be returned. Values between 1-1000 are accepted. Defaults to 100.

Return type:

list[Invoice]

CryptoPay.get_checks(asset=None, check_ids=None, status=None, offset=None, count=None)

getChecks method.

Use this method to get checks created by your app. On success, returns array of aiosend.types.Check.

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

Parameters:
  • asset (Asset | None) – Optional. Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet). Defaults to all currencies.

  • check_ids (list[int] | None) – Optional. List of check IDs separated by comma.

  • status (CheckStatus | None) – Optional. Status of check to be returned. Available statuses: “active” and “activated”. Defaults to all statuses.

  • offset (int | None) – Optional. Offset needed to return a specific subset of check. Defaults to 0.

  • count (int | None) – Optional. Number of checks to be returned. Values between 1-1000 are accepted. Defaults to 100.

Return type:

list[Check]

CryptoPay.get_transfers(asset=None, transfer_ids=None, spend_id=None, offset=None, count=None)

getTransfers method.

Use this method to get transfers created by your app. On success, returns array of aiosend.types.Transfer.

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

Parameters:
  • asset (Asset | None) – Optional. Cryptocurrency alphabetic code. Supported assets: “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet). Defaults to all currencies.

  • transfer_ids (list[int] | None) – Optional. List of transfer IDs separated by comma.

  • spend_id (str | None) – Optional. Unique UTF-8 transfer string.

  • offset (int | None) – Optional. Offset needed to return a specific subset of transfers. Defaults to 0.

  • count (int | None) – Optional. Number of transfers to be returned. Values between 1-1000 are accepted. Defaults to 100.

Return type:

list[Transfer]

CryptoPay.get_balance()

getBalance method.

Use this method to get balances of your app. Requires no parameters. Returns array of aiosend.types.Balance.

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

Return type:

list[Balance]

CryptoPay.get_exchange_rates()

getExchangeRates method.

Use this method to get exchange rates of supported currencies. Requires no parameters. Returns array of aiosend.types.ExchangeRate.

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

Return type:

list[ExchangeRate]

CryptoPay.get_currencies()

getCurrencies method.

Use this method to get a list of supported currencies. Requires no parameters. Returns a list of fiat and cryptocurrency alphabetic codes.

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

Return type:

list[Currency]

CryptoPay.get_stats(start_at=None, end_at=None)

getStats method.

Use this method to get app statistics. On success, returns aiosend.types.AppStats.

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

Parameters:
  • start_at (datetime | None) – Optional. Date from which start calculating statistics. Default is current date minus 24 hours.

  • end_at (datetime | None) – Optional. The date on which to finish calculating statistics. Default is current date.

Return type:

AppStats