send_invoice()¶
- Client.send_invoice()¶
Use this method to send invoices.
Usable by Users Bots
- Parameters:¶
chat_id (``int`` | ``str``) – Unique identifier for the target private chat or username of the target private chat.
title (``str``) – Product name.
description (``str``) – Product description.
currency (``str``) – Three-letter ISO 4217 currency code. XTR for Telegram Stars.
prices (List of :obj:`~pyrogram.types.LabeledPrice`) – Price with label.
provider (``str``, *optional*) – Payment provider. Get this from botfather.
provider_data (``str``, *optional*) – Provider data in json format.
payload (``str``, *optional*) – Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
photo_url (``str``, *optional*) – Photo URL.
photo_size (``int``, *optional*) – Photo size.
photo_mime_type (``str``, *optional*) – Photo MIME type.
start_parameter (``str``, *optional*) – Unique bot deep-linking parameter that can be used to generate this invoice.
extended_media (:obj:`~pyrogram.types.InputMedia`, *optional*) – Additional media.
reply_to_message_id (``int``, *optional*) – If the message is a reply, ID of the original message.
message_thread_id (``int``, *optional*) – Unique identifier for the target message thread (topic) of the forum. for forum supergroups only.
quote_text (``str``, *optional*) – Text to quote. for reply_to_message only.
allow_paid_broadcast (``bool``, *optional*) – Pass True to allow the message to ignore regular broadcast limits for a small fee; for bots only
message_effect_id (``int`` ``64-bit``, *optional*) – Unique identifier of the message effect to be added to the message; for private chats only.
quote_entities (List of :obj:`~pyrogram.types.MessageEntity`, *optional*) – List of special entities that appear in quote_text, which can be specified instead of parse_mode. for reply_to_message only.
reply_markup (:obj:`~pyrogram.types.InlineKeyboardMarkup`, *optional*) – An inline keyboard. If empty, one ‘Buy’ button will be shown.
- Returns:¶
:obj:`~pyrogram.types.Message` (On success, the sent message is returned.)
Example
# USD app.send_invoice(chat_id, types.InputMediaInvoice( title="Product Name", description="Product Description", currency="USD", prices=[types.LabeledPrice("Product", 1000)], provider="Stripe_provider_codes", provider_data="{}" )) # Telegram Stars app.send_invoice(chat_id, types.InputMediaInvoice( title="Product Name", description="Product Description", currency="XTR", prices=[types.LabeledPrice("Product", 1000)] ))