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 (
LabeledPrice
| List ofLabeledPrice
) – Price with label. If you add multiple prices, the prices will be added up. For stars invoice you can only have one item.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 (
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.quote_entities (List of
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 (
InlineKeyboardMarkup
, optional) – An inline keyboard. If empty, one ‘Buy’ button will be shown.
- Returns:
Message
– On success, the sent message is returned.
Example
# USD (single prices) app.send_invoice( chat_id, title="Product Name", description="Product Description", currency="USD", prices=types.LabeledPrice("Product", 1000), provider="Stripe_provider_codes", provider_data="{}" ) # USD (multiple prices) app.send_invoice( chat_id, title="Product Name", description="Product Description", currency="USD", prices=[ types.LabeledPrice("Product 1", 1000), types.LabeledPrice("Product 2", 2000) ], provider="Stripe_provider_codes", provider_data="{}" ) # Telegram Stars app.send_invoice( chat_id, title="Product Name", description="Product Description", currency="XTR", prices=types.LabeledPrice("Product", 1000) )