Skip to content
Back to top
View this page

# TransactionPartner

class telegram.TransactionPartner(type, *, api_kwargs=None)

  Bases: `telegram.TelegramObject`

  This object describes the source of a transaction, or its recipient for outgoing transactions. Currently, it can be one of:

  - `TransactionPartnerUser`

  - `TransactionPartnerChat`

  - `TransactionPartnerAffiliateProgram`

  - `TransactionPartnerFragment`

  - `TransactionPartnerTelegramAds`

  - `TransactionPartnerTelegramApi`

  - `TransactionPartnerOther`

  Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their `type` is equal.

  Available In

  - `telegram.StarTransaction.receiver`

  - `telegram.StarTransaction.source`

  Added in version 21.4.

  Changed in version 21.11: Added `TransactionPartnerChat`

  Parameters:

    type (`str`) – The type of the transaction partner.

  type

    The type of the transaction partner.

    Type:

      `str`

  AFFILIATE_PROGRAM = 'affiliate_program'

    `telegram.constants.TransactionPartnerType.AFFILIATE_PROGRAM`

    Added in version 21.9.

  CHAT = 'chat'

    `telegram.constants.TransactionPartnerType.CHAT`

    Added in version 21.11.

  FRAGMENT = 'fragment'

    `telegram.constants.TransactionPartnerType.FRAGMENT`

  OTHER = 'other'

    `telegram.constants.TransactionPartnerType.OTHER`

  TELEGRAM_ADS = 'telegram_ads'

    `telegram.constants.TransactionPartnerType.TELEGRAM_ADS`

  TELEGRAM_API = 'telegram_api'

    `telegram.constants.TransactionPartnerType.TELEGRAM_API`

  USER = 'user'

    `telegram.constants.TransactionPartnerType.USER`

  classmethod de_json(data, bot=None)

    Converts JSON data to the appropriate `TransactionPartner` object, i.e. takes care of selecting the correct subclass.

    Parameters:

      - data (dict[`str`, …]) – The JSON data.

      - bot (`telegram.Bot`) – The bot associated with this object.

    Returns:

      The Telegram object.