Types

Crypto Pay API types implementation.

class aiosend.types.App(**data)

App object.

This object represents the Crypto Pay app.

app_id: int

Crypto Pay app id.

name: str

Crypto Pay app name.

payment_processing_bot_username: str

Telegram username of the payment processing bot.

class aiosend.types.AppStats(**data)

AppStats object.

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

conversion: float

Conversion of all created invoices.

created_invoice_count: int

Total created invoice count.

end_at: datetime

The date on which the statistics calculation was ended in ISO 8601 format.

paid_invoice_count: int

Total paid invoice count.

start_at: datetime

The date on which the statistics calculation was started in ISO 8601 format.

unique_users_count: int

The unique number of users who have paid the invoice.

volume: float

Total volume of paid invoices in USD.

class aiosend.types.Balance(**data)

Balance object.

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

available: float

Total available amount in float.

currency_code: Asset | str

Cryptocurrency alphabetic code. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

onhold: float

Unavailable amount currently is on hold in float.

class aiosend.types.Check(**data)

Check object.

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

activated_at: datetime | None

Date the check was activated in ISO 8601 format.

amount: float

Amount of the check in float.

asset: Asset | str

Cryptocurrency alphabetic code. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

bot_check_url: str

URL should be provided to the user to activate the check.

check_id: int

Unique ID for this check.

created_at: datetime

Date the check was created in ISO 8601 format.

hash: str

Hash of the check.

status: CheckStatus | str

Status of the check, can be “active” or “activated”.

class aiosend.types.CryptoPayObject(**data)

Base object class for types.

class aiosend.types.Currency(**data)

Currency object.

This object represents an Crypto Pay currency.

code: Fiat | Asset | str

Currency code.

decimals: int

Currency decimals.

is_blockchain: bool

True, if the currency is blockchain currency.

is_fiat: bool

True, if the currency is fiat.

is_stablecoin: bool

True, if the currency is stablecoin.

name: str

Currency name.

url: str | None

Currency url.

class aiosend.types.Error(**data)

API error model.

code: int
name: str
class aiosend.types.ExchangeRate(**data)

ExchangeRate object.

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

is_crypto: bool

True, if the source is the cryptocurrency.

is_fiat: bool

True, if the source is the fiat currency.

is_valid: bool

True, if the received rate is up-to-date.

rate: float

The current rate of the source asset valued in the target currency.

source: Asset | Fiat | str

Currency alphabetic code. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC”.

target: Fiat | str

Fiat currency code. Currently, can be “USD”, “EUR”, “RUB”, “BYN”, “UAH”, “GBP”, “CNY”, “KZT”, “UZS”, “GEL”, “TRY”, “AMD”, “THB”, “INR”, “BRL”, “IDR”, “AZN”, “AED”, “PLN” and “ILS”.

class aiosend.types.Invoice(**data)

Invoice object.

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

accepted_assets: list[Asset | str] | None

Optional. List of assets which can be used to pay the invoice. Available only if currency_type is “fiat”. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

allow_anonymous: bool

True, if the user can pay the invoice anonymously.

allow_comments: bool

True, if the user can add comment to the payment.

amount: float

Amount of the invoice for which the invoice was created.

asset: Asset | str | None

Optional. Cryptocurrency code. Available only if the value of the field currency_type is “crypto”. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

bot_invoice_url: str

URL should be provided to the user to pay the invoice.

comment: str | None

Optional. Comment to the payment from the user.

created_at: datetime

Date the invoice was created in ISO 8601 format.

currency_type: CurrencyType | str

Type of the price, can be “crypto” or “fiat”.

description: str | None

Optional. Description for this invoice.

expiration_date: datetime | None

Optional. Date the invoice expires in ISO 8601 format.

fee: str | None

Optional. Amount of charged service fees. Available only in the payload of the webhook update (described here for reference).

fee_amount: float | None

Optional. Amount of service fees charged when the invoice was paid. Available only if status is “paid”.

fee_asset: Asset | str | None

Optional. Asset of service fees charged when the invoice was paid. Available only if status is “paid”.

fee_in_usd: float | None

Optional. Amount in USD of service fees charged when the invoice was paid. Available only if status is “paid”.

fiat: Fiat | str | None

Optional. Fiat currency code. Available only if the value of the field currency_type is “fiat”. Currently one of “USD”, “EUR”, “RUB”, “BYN”, “UAH”, “GBP”, “CNY”, “KZT”, “UZS”, “GEL”, “TRY”, “AMD”, “THB”, “INR”, “BRL”, “IDR”, “AZN”, “AED”, “PLN” and “ILS”.

hash: str

Hash of the invoice.

hidden_message: str | None

Optional. Text of the hidden message for this invoice.

invoice_id: int

Unique ID for this invoice.

is_swapped: bool | None

Optional. For invoices with the “paid” status, this flag indicates whether the swap was successful (only applicable if swap_to is set).

mini_app_invoice_url: str

Use this URL to pay an invoice to the Telegram Mini App version.

paid_amount: float | None

Optional. Amount of the invoice for which the invoice was paid. Available only if currency_type is “fiat” and status is “paid”.

paid_anonymously: bool | None

True, if the invoice was paid anonymously.

paid_asset: Asset | str | None

Optional. Cryptocurrency alphabetic code for which the invoice was paid. Available only if currency_type is “fiat” and status is “paid”.

paid_at: datetime | None

Optional. Date the invoice was paid in ISO 8601 format.

paid_btn_name: PaidBtnName | str | None

Optional. Label of the button, can be “viewItem”, “openChannel”, “openBot” or “callback”.

paid_btn_url: str | None

Optional. URL opened using the button.

paid_fiat_rate: float | None

Optional. The rate of the paid_asset valued in the fiat currency. Available only if the value of the field currency_type is “fiat” and the value of the field status is “paid”.

paid_usd_rate: float | None

Optional. Price of the asset in USD. Available only if status is “paid”.

pay_url: str | None

Deprecated. URL should be provided to the user to pay the invoice (described here for reference).

payload: str | None

Optional. Previously provided data for this invoice.

status: InvoiceStatus | str | None

Status of the transfer, can be “active”, “paid” or “expired”.

swap_to: Asset | str | None

“USDT”, “TON”, “TRX”, “ETH”, “SOL”, “BTC”, “LTC”.

Type:

Optional. The asset that will be attempted to be swapped into after the user makes a payment (the swap is not guaranteed). Supported assets

swapped_output: float | None

Optional. If is_swapped is True, stores the amount received as a result of the swap (in the swapped_to asset).

swapped_rate: float | None

Optional. If is_swapped is True, stores the exchange rate at which the swap was executed.

swapped_to: Asset | None

Optional. If is_swapped is True, stores the asset into which the swap was made.

swapped_uid: str | None

Optional. If is_swapped is True, stores the unique identifier of the swap.

swapped_usd_amount: float | None

Optional. If is_swapped is True, stores the resulting swap amount in USD.

swapped_usd_rate: float | None

Optional. If is_swapped is True, stores the USD exchange rate of the currency from swapped_to.

usd_rate: str | None

Optional. Price of the asset in USD. Available only in the Webhook update payload.

web_app_invoice_url: str

Use this URL to pay an invoice to the Web version of Crypto Bot.

class aiosend.types.ItemsList(**data)

Items list.

This model is used to convert a dictionary with the items key to a list.

items: _CryptoPayType
class aiosend.types.Response(**data)

API response model.

error: Error | None
ok: bool
result: _CryptoPayType | ItemsList | None
class aiosend.types.Transfer(**data)

Transfer object.

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

amount: float

Amount of the transfer in float.

asset: Asset | str

Cryptocurrency alphabetic code. Currently, can be “USDT”, “TON”, “BTC”, “ETH”, “LTC”, “BNB”, “TRX” and “USDC” (and “JET” for testnet).

comment: str | None

Optional. Comment for this transfer.

completed_at: datetime

Date the transfer was completed in ISO 8601 format.

spend_id: str | None

Unique UTF-8 string.

status: Literal['completed']

Status of the transfer, can only be “completed”.

transfer_id: int

Unique ID for this transfer.

user_id: int

Telegram user ID the transfer was sent to.

class aiosend.types.Update(**data)

Update object.

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

payload: Invoice

Payload contains the class Invoice.

request_date: datetime

Date the request was sent in ISO 8601 format.

update_id: int

Non-unique update ID.

update_type: UpdateType

invoice_paid - the update sent when the invoice is paid.

Type:

Webhook update type. Supported update types