sendInvoice

suspend fun TelegramBotApiClient.sendInvoice(requestBody: SendInvoiceRequest): TelegramResponse<Message>

Use this method to send invoices. On success, the sent Message is returned.

suspend fun TelegramBotApiClient.sendInvoice(chatId: Int, title: String, description: String, payload: String, providerToken: String, startParameter: String, currency: String, prices: List<LabeledPrice> = emptyList(), providerData: String? = null, photoUrl: String? = null, photoSize: Int? = null, photoWidth: Int? = null, photoHeight: Int? = null, needName: Boolean = false, needPhoneNumber: Boolean = false, needEmail: Boolean = false, needShippingAddress: Boolean = false, sendPhoneNumberToProvider: Boolean = false, sendEmailToProvider: Boolean = false, isFlexible: Boolean = false, disableNotification: Boolean = false, replyToMessageId: Int? = null, allowSendingWithoutReply: Boolean = false, replyMarkup: InlineKeyboardMarkup? = null): TelegramResponse<Message>

Use this method to send invoices. On success, the sent Message is returned.

Parameters

chatId

Unique identifier for the target private chat

title

Product name, 1-32 characters

description

Product description, 1-255 characters

payload

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

providerToken

Payments provider token, obtained via Botfather

startParameter

Unique deep-linking parameter that can be used to generate this invoice when used as a start parameter

currency

Three-letter ISO 4217 currency code, see more on currencies

prices

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

providerData

A JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.

photoUrl

URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. People like it better when they see what they are paying for.

photoSize

Photo size

photoWidth

Photo width

photoHeight

Photo height

needName

Pass True, if you require the user's full name to complete the order

needPhoneNumber

Pass True, if you require the user's phone number to complete the order

needEmail

Pass True, if you require the user's email address to complete the order

needShippingAddress

Pass True, if you require the user's shipping address to complete the order

sendPhoneNumberToProvider

Pass True, if user's phone number should be sent to provider

sendEmailToProvider

Pass True, if user's email address should be sent to provider

isFlexible

Pass True, if the final price depends on the shipping method

disableNotification

Sends the message silently. Users will receive a notification with no sound.

replyToMessageId

If the message is a reply, ID of the original message

allowSendingWithoutReply

Pass True, if the message should be sent even if the specified replied-to message is not found

replyMarkup

A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.