InputMessageContent.invoice constructor

const InputMessageContent.invoice({
  1. @JsonKey(name: 'title') required String title,
  2. @JsonKey(name: 'description') required String description,
  3. @JsonKey(name: 'payload') required String payload,
  4. @JsonKey(name: 'provider_token') String? providerToken,
  5. @JsonKey(name: 'currency') required String currency,
  6. @JsonKey(name: 'prices') required List<LabeledPrice> prices,
  7. @JsonKey(name: 'max_tip_amount') int? maxTipAmount,
  8. @JsonKey(name: 'suggested_tip_amounts') List<int>? suggestedTipAmounts,
  9. @JsonKey(name: 'provider_data') String? providerData,
  10. @JsonKey(name: 'photo_url') String? photoUrl,
  11. @JsonKey(name: 'photo_size') int? photoSize,
  12. @JsonKey(name: 'photo_width') int? photoWidth,
  13. @JsonKey(name: 'photo_height') int? photoHeight,
  14. @JsonKey(name: 'need_name') bool? needName,
  15. @JsonKey(name: 'need_phone_number') bool? needPhoneNumber,
  16. @JsonKey(name: 'need_email') bool? needEmail,
  17. @JsonKey(name: 'need_shipping_address') bool? needShippingAddress,
  18. @JsonKey(name: 'send_phone_number_to_provider') bool? sendPhoneNumberToProvider,
  19. @JsonKey(name: 'send_email_to_provider') bool? sendEmailToProvider,
  20. @JsonKey(name: 'is_flexible') bool? isFlexible,
})

Represents the content of an invoice message to be sent as the result of an inline query.

Implementation

const factory InputMessageContent.invoice({
  /// Product name, 1-32 characters
  @JsonKey(name: 'title') required final String title,

  /// Product description, 1-255 characters
  @JsonKey(name: 'description') required final String description,

  /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to
  /// the user, use for your internal processes.
  @JsonKey(name: 'payload') required final String payload,

  /// Optional. Payment provider token, obtained via @BotFather. Pass an empty
  /// string for payments in Telegram Stars.
  @JsonKey(name: 'provider_token') final String? providerToken,

  /// Three-letter ISO 4217 currency code, [see more on
  /// currencies](https://core.telegram.org/bots/payments#supported-currencies)
  @JsonKey(name: 'currency') required final String currency,

  /// Price breakdown, a JSON-serialized list of components (e.g. product
  /// price, tax, discount, delivery cost, delivery tax, bonus, etc.)
  @JsonKey(name: 'prices') required final List<LabeledPrice> prices,

  /// Optional. The maximum accepted amount for tips in the smallest units of
  /// the currency (integer, not float/double). For example, for a maximum tip
  /// of US$ 1.45 pass max_tip_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). Defaults to 0
  @JsonKey(name: 'max_tip_amount') final int? maxTipAmount,

  /// Optional. A JSON-serialized array of suggested amounts of tip in the
  /// smallest units of the currency (integer, not float/double). At most 4
  /// suggested tip amounts can be specified. The suggested tip amounts must
  /// be positive, passed in a strictly increased order and must not exceed
  /// max_tip_amount.
  @JsonKey(name: 'suggested_tip_amounts')
  final List<int>? suggestedTipAmounts,

  /// Optional. A JSON-serialized object for data about the invoice, which
  /// will be shared with the payment provider. A detailed description of the
  /// required fields should be provided by the payment provider.
  @JsonKey(name: 'provider_data') final String? providerData,

  /// Optional. URL of the product photo for the invoice. Can be a photo of
  /// the goods or a marketing image for a service.
  @JsonKey(name: 'photo_url') final String? photoUrl,

  /// Optional. Photo size in bytes
  @JsonKey(name: 'photo_size') final int? photoSize,

  /// Optional. Photo width
  @JsonKey(name: 'photo_width') final int? photoWidth,

  /// Optional. Photo height
  @JsonKey(name: 'photo_height') final int? photoHeight,

  /// Optional. Pass True if you require the user's full name to complete the
  /// order
  @JsonKey(name: 'need_name') final bool? needName,

  /// Optional. Pass True if you require the user's phone number to complete
  /// the order
  @JsonKey(name: 'need_phone_number') final bool? needPhoneNumber,

  /// Optional. Pass True if you require the user's email address to complete
  /// the order
  @JsonKey(name: 'need_email') final bool? needEmail,

  /// Optional. Pass True if you require the user's shipping address to
  /// complete the order
  @JsonKey(name: 'need_shipping_address') final bool? needShippingAddress,

  /// Optional. Pass True if the user's phone number should be sent to
  /// provider
  @JsonKey(name: 'send_phone_number_to_provider')
  final bool? sendPhoneNumberToProvider,

  /// Optional. Pass True if the user's email address should be sent to
  /// provider
  @JsonKey(name: 'send_email_to_provider') final bool? sendEmailToProvider,

  /// Optional. Pass True if the final price depends on the shipping method
  @JsonKey(name: 'is_flexible') final bool? isFlexible,
}) = InputInvoiceMessageContent;