stripe/model/shipping_rate.rs
1use serde::{Serialize, Deserialize};
2use super::ShippingRateFixedAmount;
3/**Shipping rates describe the price of shipping presented to your customers and
4applied to a purchase. For more information, see [Charge for shipping](https://stripe.com/docs/payments/during-payment/charge-shipping).*/
5#[derive(Debug, Clone, Serialize, Deserialize, Default)]
6pub struct ShippingRate {
7 ///Whether the shipping rate can be used for new purchases. Defaults to `true`.
8 pub active: bool,
9 ///Time at which the object was created. Measured in seconds since the Unix epoch.
10 pub created: i64,
11 ///The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub delivery_estimate: Option<serde_json::Value>,
14 ///The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub display_name: Option<String>,
17 ///
18 #[serde(skip_serializing_if = "Option::is_none")]
19 pub fixed_amount: Option<ShippingRateFixedAmount>,
20 ///Unique identifier for the object.
21 pub id: String,
22 ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
23 pub livemode: bool,
24 ///Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
25 pub metadata: serde_json::Value,
26 ///String representing the object's type. Objects of the same type share the same value.
27 pub object: String,
28 ///Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub tax_behavior: Option<String>,
31 ///A [tax code](https://stripe.com/docs/tax/tax-categories) ID. The Shipping tax code is `txcd_92010001`.
32 #[serde(skip_serializing_if = "Option::is_none")]
33 pub tax_code: Option<serde_json::Value>,
34 ///The type of calculation to use on the shipping rate. Can only be `fixed_amount` for now.
35 #[serde(rename = "type")]
36 pub type_: String,
37}
38impl std::fmt::Display for ShippingRate {
39 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
40 write!(f, "{}", serde_json::to_string(self).unwrap())
41 }
42}