tg_flows/types/successful_payment.rs
1use serde::{Deserialize, Serialize};
2
3use crate::types::{Currency, OrderInfo};
4
5/// This object contains basic information about a successful payment.
6///
7/// [The official docs](https://core.telegram.org/bots/api#successfulpayment).
8#[serde_with_macros::skip_serializing_none]
9#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
10pub struct SuccessfulPayment {
11 /// Three-letter ISO 4217 [currency] code.
12 ///
13 /// [currency]: https://core.telegram.org/bots/payments#supported-currencies
14 pub currency: Currency,
15
16 /// Total price in the smallest units of the currency (integer, not
17 /// float/double). For example, for a price of `US$ 1.45` pass `amount =
18 /// 145`. See the exp parameter in [`currencies.json`], it shows the
19 /// number of digits past the decimal point for each currency (2 for
20 /// the majority of currencies).
21 ///
22 /// [`currencies.json`]: https://core.telegram.org/bots/payments/currencies.json
23 pub total_amount: i32,
24
25 /// Bot specified invoice payload.
26 pub invoice_payload: String,
27
28 /// Identifier of the shipping option chosen by the user.
29 pub shipping_option_id: Option<String>,
30
31 /// Order info provided by the user.
32 #[serde(default)]
33 pub order_info: OrderInfo,
34
35 /// Telegram payment identifier.
36 pub telegram_payment_charge_id: String,
37
38 /// Provider payment identifier.
39 pub provider_payment_charge_id: String,
40}