teloxide_core/payloads/
send_invoice.rs

1//! Generated by `codegen_payloads`, do not edit by hand.
2
3use serde::Serialize;
4use url::Url;
5
6use crate::types::{
7    InlineKeyboardMarkup, LabeledPrice, Message, Recipient, ReplyParameters, ThreadId,
8};
9
10impl_payload! {
11    /// Use this method to send invoices. On success, the sent [`Message`] is returned.
12    ///
13    /// [`Message`]: crate::types::Message
14    #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
15    pub SendInvoice (SendInvoiceSetters) => Message {
16        required {
17            /// Unique identifier for the target private chat
18            pub chat_id: Recipient [into],
19            /// Product name, 1-32 characters
20            pub title: String [into],
21            /// Product description, 1-255 characters
22            pub description: String [into],
23            /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
24            pub payload: String [into],
25            /// Three-letter ISO 4217 currency code, see [more on currencies]. Pass `XTR` for payments in [Telegram Stars].
26            ///
27            /// [more on currencies]: https://core.telegram.org/bots/payments#supported-currencies
28            /// [Telegram Stars]: https://t.me/BotNews/90
29            pub currency: String [into],
30            /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
31            pub prices: Vec<LabeledPrice> [collect],
32        }
33        optional {
34            /// Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
35            pub message_thread_id: ThreadId,
36            /// Payments provider token, obtained via [Botfather]. Pass `None` for payments in [Telegram Stars].
37            ///
38            /// [Botfather]: https://t.me/botfather
39            /// [Telegram Stars]: https://t.me/BotNews/90
40            pub provider_token: String [into],
41            /// 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
42            ///
43            /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
44            pub max_tip_amount: u32,
45            /// A JSON-serialized array of suggested amounts of tips 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_.
46            pub suggested_tip_amounts: Vec<u32> [collect],
47            /// Unique deep-linking parameter. If left empty, **forwarded copies** of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter
48            pub start_parameter: String [into],
49            /// 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.
50            pub provider_data: String [into],
51            /// 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.
52            pub photo_url: Url,
53            /// Photo size in bytes
54            pub photo_size: u32,
55            /// Photo width
56            pub photo_width: u32,
57            /// Photo height
58            pub photo_height: u32,
59            /// Pass _True_, if you require the user's full name to complete the order
60            pub need_name: bool,
61            /// Pass _True_, if you require the user's phone number to complete the order
62            pub need_phone_number: bool,
63            /// Pass _True_, if you require the user's email address to complete the order
64            pub need_email: bool,
65            /// Pass _True_, if you require the user's shipping address to complete the order
66            pub need_shipping_address: bool,
67            /// Pass _True_, if user's phone number should be sent to provider
68            pub send_phone_number_to_provider: bool,
69            /// Pass _True_, if user's email address should be sent to provider
70            pub send_email_to_provider: bool,
71            /// Pass _True_, if the final price depends on the shipping method
72            pub is_flexible: bool,
73            /// Sends the message [silently]. Users will receive a notification with no sound.
74            ///
75            /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages
76            pub disable_notification: bool,
77            /// Protects the contents of sent messages from forwarding and saving
78            pub protect_content: bool,
79            /// Unique identifier of the message effect to be added to the message; for private chats only
80            pub message_effect_id: String [into],
81            /// Description of the message to reply to
82            pub reply_parameters: ReplyParameters,
83            /// 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.
84            ///
85            /// [inline keyboard]: https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating
86            pub reply_markup: InlineKeyboardMarkup,
87        }
88    }
89}