Class Invoice

Hierarchy (view full)

Constructors

Properties

currency: string

Three-letter ISO 4217 currency code, or “XTR” for payments in Telegram Stars

description: string

Product description

startParameter: string

Unique bot deep-linking parameter that can be used to generate this invoice

title: string

Product name

totalAmount: number

Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).

Accessors

Methods

  • Protected

    Patches the current instance with new data

    Parameters

    • data: Record<string, any>

      The data to patch the instance with

    Returns Record<string, any>

    The patched data

  • Protected

    Updates the current instance with new data and returns a clone of the updated instance

    Parameters

    • data: Record<string, any>

      The data to update the instance with

    Returns Base

    A clone of the updated instance

  • Use this method to create a link for an invoice.

    Parameters

    • payload: string

      Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes

    • prices: LabeledPrice[]

      Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)

    • Optionaloptions: Omit<{
          currency: string;
          description: string;
          isFlexible?: boolean;
          maxTipAmount?: number;
          needEmail?: boolean;
          needName?: boolean;
          needPhoneNumber?: boolean;
          needShippingAddress?: boolean;
          payload: string;
          photoHeight?: number;
          photoSize?: number;
          photoUrl?: string;
          photoWidth?: number;
          prices: LabeledPrice[];
          providerData?: string;
          providerToken?: string;
          sendEmailToProvider?: boolean;
          sendPhoneNumberToProvider?: boolean;
          suggestedTipAmounts?: number[];
          title: string;
      },
          | "currency"
          | "description"
          | "title"
          | "payload"
          | "prices"
          | "maxTipAmount">

      out parameters

    Returns Promise<string>

    Returns the created invoice link as String on success.