stripe/resources/generated/
price.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::client::{Client, Response};
6use crate::ids::PriceId;
7use crate::params::{
8    CurrencyMap, Expand, Expandable, IdOrCreate, List, Metadata, Object, Paginable, RangeQuery,
9    Timestamp,
10};
11use crate::resources::{CreateProduct, Currency, CustomUnitAmount, Product, UpTo};
12use serde::{Deserialize, Serialize};
13
14/// The resource representing a Stripe "Price".
15///
16/// For more details see <https://stripe.com/docs/api/prices/object>
17#[derive(Clone, Debug, Default, Deserialize, Serialize)]
18pub struct Price {
19    /// Unique identifier for the object.
20    pub id: PriceId,
21
22    /// Whether the price can be used for new purchases.
23    #[serde(skip_serializing_if = "Option::is_none")]
24    pub active: Option<bool>,
25
26    /// Describes how to compute the price per period.
27    ///
28    /// Either `per_unit` or `tiered`.
29    /// `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`).
30    /// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
31    #[serde(skip_serializing_if = "Option::is_none")]
32    pub billing_scheme: Option<PriceBillingScheme>,
33
34    /// Time at which the object was created.
35    ///
36    /// Measured in seconds since the Unix epoch.
37    #[serde(skip_serializing_if = "Option::is_none")]
38    pub created: Option<Timestamp>,
39
40    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
41    ///
42    /// Must be a [supported currency](https://stripe.com/docs/currencies).
43    #[serde(skip_serializing_if = "Option::is_none")]
44    pub currency: Option<Currency>,
45
46    /// Prices defined in each available currency option.
47    ///
48    /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
49    #[serde(skip_serializing_if = "Option::is_none")]
50    pub currency_options: Option<CurrencyMap<CurrencyOption>>,
51
52    /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
53    #[serde(skip_serializing_if = "Option::is_none")]
54    pub custom_unit_amount: Option<CustomUnitAmount>,
55
56    // Always true for a deleted object
57    #[serde(default)]
58    pub deleted: bool,
59
60    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
61    #[serde(skip_serializing_if = "Option::is_none")]
62    pub livemode: Option<bool>,
63
64    /// A lookup key used to retrieve prices dynamically from a static string.
65    ///
66    /// This may be up to 200 characters.
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub lookup_key: Option<String>,
69
70    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
71    ///
72    /// This can be useful for storing additional information about the object in a structured format.
73    #[serde(skip_serializing_if = "Option::is_none")]
74    pub metadata: Option<Metadata>,
75
76    /// A brief description of the price, hidden from customers.
77    #[serde(skip_serializing_if = "Option::is_none")]
78    pub nickname: Option<String>,
79
80    /// The ID of the product this price is associated with.
81    #[serde(skip_serializing_if = "Option::is_none")]
82    pub product: Option<Expandable<Product>>,
83
84    /// The recurring components of a price such as `interval` and `usage_type`.
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub recurring: Option<Recurring>,
87
88    /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
89    ///
90    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
91    /// One of `inclusive`, `exclusive`, or `unspecified`.
92    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
93    #[serde(skip_serializing_if = "Option::is_none")]
94    pub tax_behavior: Option<PriceTaxBehavior>,
95
96    /// Each element represents a pricing tier.
97    ///
98    /// This parameter requires `billing_scheme` to be set to `tiered`.
99    /// See also the documentation for `billing_scheme`.
100    #[serde(skip_serializing_if = "Option::is_none")]
101    pub tiers: Option<Vec<PriceTier>>,
102
103    /// Defines if the tiering price should be `graduated` or `volume` based.
104    ///
105    /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price.
106    /// In `graduated` tiering, pricing can change as the quantity grows.
107    #[serde(skip_serializing_if = "Option::is_none")]
108    pub tiers_mode: Option<PriceTiersMode>,
109
110    /// Apply a transformation to the reported usage or set quantity before computing the amount billed.
111    ///
112    /// Cannot be combined with `tiers`.
113    #[serde(skip_serializing_if = "Option::is_none")]
114    pub transform_quantity: Option<TransformQuantity>,
115
116    /// One of `one_time` or `recurring` depending on whether the price is for a one-time purchase or a recurring (subscription) purchase.
117    #[serde(rename = "type")]
118    #[serde(skip_serializing_if = "Option::is_none")]
119    pub type_: Option<PriceType>,
120
121    /// The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.
122    ///
123    /// Only set if `billing_scheme=per_unit`.
124    #[serde(skip_serializing_if = "Option::is_none")]
125    pub unit_amount: Option<i64>,
126
127    /// The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.
128    ///
129    /// Only set if `billing_scheme=per_unit`.
130    #[serde(skip_serializing_if = "Option::is_none")]
131    pub unit_amount_decimal: Option<String>,
132}
133
134impl Price {
135    /// Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing).
136    ///
137    /// For the list of inactive prices, set `active` to false.
138    pub fn list(client: &Client, params: &ListPrices<'_>) -> Response<List<Price>> {
139        client.get_query("/prices", params)
140    }
141
142    /// Creates a new price for an existing product.
143    ///
144    /// The price can be recurring or one-time.
145    pub fn create(client: &Client, params: CreatePrice<'_>) -> Response<Price> {
146        #[allow(clippy::needless_borrows_for_generic_args)]
147        client.post_form("/prices", &params)
148    }
149
150    /// Retrieves the price with the given ID.
151    pub fn retrieve(client: &Client, id: &PriceId, expand: &[&str]) -> Response<Price> {
152        client.get_query(&format!("/prices/{}", id), Expand { expand })
153    }
154
155    /// Updates the specified price by setting the values of the parameters passed.
156    ///
157    /// Any parameters not provided are left unchanged.
158    pub fn update(client: &Client, id: &PriceId, params: UpdatePrice<'_>) -> Response<Price> {
159        #[allow(clippy::needless_borrows_for_generic_args)]
160        client.post_form(&format!("/prices/{}", id), &params)
161    }
162}
163
164impl Object for Price {
165    type Id = PriceId;
166    fn id(&self) -> Self::Id {
167        self.id.clone()
168    }
169    fn object(&self) -> &'static str {
170        "price"
171    }
172}
173
174#[derive(Clone, Debug, Default, Deserialize, Serialize)]
175pub struct CurrencyOption {
176    /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
177    pub custom_unit_amount: Option<CustomUnitAmount>,
178
179    /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
180    ///
181    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
182    /// One of `inclusive`, `exclusive`, or `unspecified`.
183    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
184    pub tax_behavior: Option<CurrencyOptionTaxBehavior>,
185
186    /// Each element represents a pricing tier.
187    ///
188    /// This parameter requires `billing_scheme` to be set to `tiered`.
189    /// See also the documentation for `billing_scheme`.
190    #[serde(skip_serializing_if = "Option::is_none")]
191    pub tiers: Option<Vec<PriceTier>>,
192
193    /// The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible.
194    ///
195    /// Only set if `billing_scheme=per_unit`.
196    pub unit_amount: Option<i64>,
197
198    /// The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places.
199    ///
200    /// Only set if `billing_scheme=per_unit`.
201    pub unit_amount_decimal: Option<String>,
202}
203
204#[derive(Clone, Debug, Default, Deserialize, Serialize)]
205pub struct PriceTier {
206    /// Price for the entire tier.
207    pub flat_amount: Option<i64>,
208
209    /// Same as `flat_amount`, but contains a decimal value with at most 12 decimal places.
210    pub flat_amount_decimal: Option<String>,
211
212    /// Per unit price for units relevant to the tier.
213    pub unit_amount: Option<i64>,
214
215    /// Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
216    pub unit_amount_decimal: Option<String>,
217
218    /// Up to and including to this quantity will be contained in the tier.
219    pub up_to: Option<i64>,
220}
221
222#[derive(Clone, Debug, Default, Deserialize, Serialize)]
223pub struct Recurring {
224    /// Specifies a usage aggregation strategy for prices of `usage_type=metered`.
225    ///
226    /// Defaults to `sum`.
227    pub aggregate_usage: Option<RecurringAggregateUsage>,
228
229    /// The frequency at which a subscription is billed.
230    ///
231    /// One of `day`, `week`, `month` or `year`.
232    pub interval: RecurringInterval,
233
234    /// The number of intervals (specified in the `interval` attribute) between subscription billings.
235    ///
236    /// For example, `interval=month` and `interval_count=3` bills every 3 months.
237    pub interval_count: u64,
238
239    /// Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).
240    pub trial_period_days: Option<u32>,
241
242    /// Configures how the quantity per period should be determined.
243    ///
244    /// Can be either `metered` or `licensed`.
245    /// `licensed` automatically bills the `quantity` set when adding it to a subscription.
246    /// `metered` aggregates the total usage based on usage records.
247    /// Defaults to `licensed`.
248    pub usage_type: RecurringUsageType,
249}
250
251#[derive(Clone, Debug, Default, Deserialize, Serialize)]
252pub struct TransformQuantity {
253    /// Divide usage by this number.
254    pub divide_by: i64,
255
256    /// After division, either round the result `up` or `down`.
257    pub round: TransformQuantityRound,
258}
259
260/// The parameters for `Price::create`.
261#[derive(Clone, Debug, Serialize)]
262pub struct CreatePrice<'a> {
263    /// Whether the price can be used for new purchases.
264    ///
265    /// Defaults to `true`.
266    #[serde(skip_serializing_if = "Option::is_none")]
267    pub active: Option<bool>,
268
269    /// Describes how to compute the price per period.
270    ///
271    /// Either `per_unit` or `tiered`.
272    /// `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`).
273    /// `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.
274    #[serde(skip_serializing_if = "Option::is_none")]
275    pub billing_scheme: Option<PriceBillingScheme>,
276
277    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
278    ///
279    /// Must be a [supported currency](https://stripe.com/docs/currencies).
280    pub currency: Currency,
281
282    /// Prices defined in each available currency option.
283    ///
284    /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
285    #[serde(skip_serializing_if = "Option::is_none")]
286    pub currency_options: Option<CurrencyMap<CreatePriceCurrencyOptions>>,
287
288    /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
289    #[serde(skip_serializing_if = "Option::is_none")]
290    pub custom_unit_amount: Option<CreatePriceCustomUnitAmount>,
291
292    /// Specifies which fields in the response should be expanded.
293    #[serde(skip_serializing_if = "Expand::is_empty")]
294    pub expand: &'a [&'a str],
295
296    /// A lookup key used to retrieve prices dynamically from a static string.
297    ///
298    /// This may be up to 200 characters.
299    #[serde(skip_serializing_if = "Option::is_none")]
300    pub lookup_key: Option<&'a str>,
301
302    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
303    ///
304    /// This can be useful for storing additional information about the object in a structured format.
305    /// Individual keys can be unset by posting an empty value to them.
306    /// All keys can be unset by posting an empty value to `metadata`.
307    #[serde(skip_serializing_if = "Option::is_none")]
308    pub metadata: Option<Metadata>,
309
310    /// A brief description of the price, hidden from customers.
311    #[serde(skip_serializing_if = "Option::is_none")]
312    pub nickname: Option<&'a str>,
313
314    /// The ID of the product that this price will belong to.
315    #[serde(skip_serializing_if = "Option::is_none")]
316    pub product: Option<IdOrCreate<'a, CreateProduct<'a>>>,
317
318    /// These fields can be used to create a new product that this price will belong to.
319    #[serde(skip_serializing_if = "Option::is_none")]
320    pub product_data: Option<CreatePriceProductData>,
321
322    /// The recurring components of a price such as `interval` and `usage_type`.
323    #[serde(skip_serializing_if = "Option::is_none")]
324    pub recurring: Option<CreatePriceRecurring>,
325
326    /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
327    ///
328    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
329    /// One of `inclusive`, `exclusive`, or `unspecified`.
330    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
331    #[serde(skip_serializing_if = "Option::is_none")]
332    pub tax_behavior: Option<PriceTaxBehavior>,
333
334    /// Each element represents a pricing tier.
335    ///
336    /// This parameter requires `billing_scheme` to be set to `tiered`.
337    /// See also the documentation for `billing_scheme`.
338    #[serde(skip_serializing_if = "Option::is_none")]
339    pub tiers: Option<Vec<CreatePriceTiers>>,
340
341    /// Defines if the tiering price should be `graduated` or `volume` based.
342    ///
343    /// In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.
344    #[serde(skip_serializing_if = "Option::is_none")]
345    pub tiers_mode: Option<PriceTiersMode>,
346
347    /// If set to true, will atomically remove the lookup key from the existing price, and assign it to this price.
348    #[serde(skip_serializing_if = "Option::is_none")]
349    pub transfer_lookup_key: Option<bool>,
350
351    /// Apply a transformation to the reported usage or set quantity before computing the billed price.
352    ///
353    /// Cannot be combined with `tiers`.
354    #[serde(skip_serializing_if = "Option::is_none")]
355    pub transform_quantity: Option<CreatePriceTransformQuantity>,
356
357    /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
358    ///
359    /// One of `unit_amount` or `custom_unit_amount` is required, unless `billing_scheme=tiered`.
360    #[serde(skip_serializing_if = "Option::is_none")]
361    pub unit_amount: Option<i64>,
362
363    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
364    ///
365    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
366    #[serde(skip_serializing_if = "Option::is_none")]
367    pub unit_amount_decimal: Option<&'a str>,
368}
369
370impl<'a> CreatePrice<'a> {
371    pub fn new(currency: Currency) -> Self {
372        CreatePrice {
373            active: Default::default(),
374            billing_scheme: Default::default(),
375            currency,
376            currency_options: Default::default(),
377            custom_unit_amount: Default::default(),
378            expand: Default::default(),
379            lookup_key: Default::default(),
380            metadata: Default::default(),
381            nickname: Default::default(),
382            product: Default::default(),
383            product_data: Default::default(),
384            recurring: Default::default(),
385            tax_behavior: Default::default(),
386            tiers: Default::default(),
387            tiers_mode: Default::default(),
388            transfer_lookup_key: Default::default(),
389            transform_quantity: Default::default(),
390            unit_amount: Default::default(),
391            unit_amount_decimal: Default::default(),
392        }
393    }
394}
395
396/// The parameters for `Price::list`.
397#[derive(Clone, Debug, Serialize, Default)]
398pub struct ListPrices<'a> {
399    /// Only return prices that are active or inactive (e.g., pass `false` to list all inactive prices).
400    #[serde(skip_serializing_if = "Option::is_none")]
401    pub active: Option<bool>,
402
403    /// A filter on the list, based on the object `created` field.
404    ///
405    /// The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
406    #[serde(skip_serializing_if = "Option::is_none")]
407    pub created: Option<RangeQuery<Timestamp>>,
408
409    /// Only return prices for the given currency.
410    #[serde(skip_serializing_if = "Option::is_none")]
411    pub currency: Option<Currency>,
412
413    /// A cursor for use in pagination.
414    ///
415    /// `ending_before` is an object ID that defines your place in the list.
416    /// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
417    #[serde(skip_serializing_if = "Option::is_none")]
418    pub ending_before: Option<PriceId>,
419
420    /// Specifies which fields in the response should be expanded.
421    #[serde(skip_serializing_if = "Expand::is_empty")]
422    pub expand: &'a [&'a str],
423
424    /// A limit on the number of objects to be returned.
425    ///
426    /// Limit can range between 1 and 100, and the default is 10.
427    #[serde(skip_serializing_if = "Option::is_none")]
428    pub limit: Option<u64>,
429
430    /// Only return the price with these lookup_keys, if any exist.
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub lookup_keys: Option<Vec<String>>,
433
434    /// Only return prices for the given product.
435    #[serde(skip_serializing_if = "Option::is_none")]
436    pub product: Option<IdOrCreate<'a, CreateProduct<'a>>>,
437
438    /// Only return prices with these recurring fields.
439    #[serde(skip_serializing_if = "Option::is_none")]
440    pub recurring: Option<ListPricesRecurring>,
441
442    /// A cursor for use in pagination.
443    ///
444    /// `starting_after` is an object ID that defines your place in the list.
445    /// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
446    #[serde(skip_serializing_if = "Option::is_none")]
447    pub starting_after: Option<PriceId>,
448
449    /// Only return prices of type `recurring` or `one_time`.
450    #[serde(rename = "type")]
451    #[serde(skip_serializing_if = "Option::is_none")]
452    pub type_: Option<PriceType>,
453}
454
455impl<'a> ListPrices<'a> {
456    pub fn new() -> Self {
457        ListPrices {
458            active: Default::default(),
459            created: Default::default(),
460            currency: Default::default(),
461            ending_before: Default::default(),
462            expand: Default::default(),
463            limit: Default::default(),
464            lookup_keys: Default::default(),
465            product: Default::default(),
466            recurring: Default::default(),
467            starting_after: Default::default(),
468            type_: Default::default(),
469        }
470    }
471}
472impl Paginable for ListPrices<'_> {
473    type O = Price;
474    fn set_last(&mut self, item: Self::O) {
475        self.starting_after = Some(item.id());
476    }
477}
478/// The parameters for `Price::update`.
479#[derive(Clone, Debug, Serialize, Default)]
480pub struct UpdatePrice<'a> {
481    /// Whether the price can be used for new purchases.
482    ///
483    /// Defaults to `true`.
484    #[serde(skip_serializing_if = "Option::is_none")]
485    pub active: Option<bool>,
486
487    /// Prices defined in each available currency option.
488    ///
489    /// Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
490    #[serde(skip_serializing_if = "Option::is_none")]
491    pub currency_options: Option<CurrencyMap<UpdatePriceCurrencyOptions>>,
492
493    /// Specifies which fields in the response should be expanded.
494    #[serde(skip_serializing_if = "Expand::is_empty")]
495    pub expand: &'a [&'a str],
496
497    /// A lookup key used to retrieve prices dynamically from a static string.
498    ///
499    /// This may be up to 200 characters.
500    #[serde(skip_serializing_if = "Option::is_none")]
501    pub lookup_key: Option<&'a str>,
502
503    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
504    ///
505    /// This can be useful for storing additional information about the object in a structured format.
506    /// Individual keys can be unset by posting an empty value to them.
507    /// All keys can be unset by posting an empty value to `metadata`.
508    #[serde(skip_serializing_if = "Option::is_none")]
509    pub metadata: Option<Metadata>,
510
511    /// A brief description of the price, hidden from customers.
512    #[serde(skip_serializing_if = "Option::is_none")]
513    pub nickname: Option<&'a str>,
514
515    /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
516    ///
517    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
518    /// One of `inclusive`, `exclusive`, or `unspecified`.
519    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
520    #[serde(skip_serializing_if = "Option::is_none")]
521    pub tax_behavior: Option<PriceTaxBehavior>,
522
523    /// If set to true, will atomically remove the lookup key from the existing price, and assign it to this price.
524    #[serde(skip_serializing_if = "Option::is_none")]
525    pub transfer_lookup_key: Option<bool>,
526}
527
528impl<'a> UpdatePrice<'a> {
529    pub fn new() -> Self {
530        UpdatePrice {
531            active: Default::default(),
532            currency_options: Default::default(),
533            expand: Default::default(),
534            lookup_key: Default::default(),
535            metadata: Default::default(),
536            nickname: Default::default(),
537            tax_behavior: Default::default(),
538            transfer_lookup_key: Default::default(),
539        }
540    }
541}
542
543#[derive(Clone, Debug, Default, Deserialize, Serialize)]
544pub struct CreatePriceCurrencyOptions {
545    /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
546    #[serde(skip_serializing_if = "Option::is_none")]
547    pub custom_unit_amount: Option<CreatePriceCurrencyOptionsCustomUnitAmount>,
548
549    /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
550    ///
551    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
552    /// One of `inclusive`, `exclusive`, or `unspecified`.
553    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
554    #[serde(skip_serializing_if = "Option::is_none")]
555    pub tax_behavior: Option<CreatePriceCurrencyOptionsTaxBehavior>,
556
557    /// Each element represents a pricing tier.
558    ///
559    /// This parameter requires `billing_scheme` to be set to `tiered`.
560    /// See also the documentation for `billing_scheme`.
561    #[serde(skip_serializing_if = "Option::is_none")]
562    pub tiers: Option<Vec<CreatePriceCurrencyOptionsTiers>>,
563
564    /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
565    #[serde(skip_serializing_if = "Option::is_none")]
566    pub unit_amount: Option<i64>,
567
568    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
569    ///
570    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
571    #[serde(skip_serializing_if = "Option::is_none")]
572    pub unit_amount_decimal: Option<String>,
573}
574
575#[derive(Clone, Debug, Default, Deserialize, Serialize)]
576pub struct CreatePriceCustomUnitAmount {
577    /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`.
578    pub enabled: bool,
579
580    /// The maximum unit amount the customer can specify for this item.
581    #[serde(skip_serializing_if = "Option::is_none")]
582    pub maximum: Option<i64>,
583
584    /// The minimum unit amount the customer can specify for this item.
585    ///
586    /// Must be at least the minimum charge amount.
587    #[serde(skip_serializing_if = "Option::is_none")]
588    pub minimum: Option<i64>,
589
590    /// The starting unit amount which can be updated by the customer.
591    #[serde(skip_serializing_if = "Option::is_none")]
592    pub preset: Option<i64>,
593}
594
595#[derive(Clone, Debug, Default, Deserialize, Serialize)]
596pub struct CreatePriceProductData {
597    /// Whether the product is currently available for purchase.
598    ///
599    /// Defaults to `true`.
600    #[serde(skip_serializing_if = "Option::is_none")]
601    pub active: Option<bool>,
602
603    /// The identifier for the product.
604    ///
605    /// Must be unique.
606    /// If not provided, an identifier will be randomly generated.
607    #[serde(skip_serializing_if = "Option::is_none")]
608    pub id: Option<String>,
609
610    /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
611    ///
612    /// This can be useful for storing additional information about the object in a structured format.
613    /// Individual keys can be unset by posting an empty value to them.
614    /// All keys can be unset by posting an empty value to `metadata`.
615    #[serde(skip_serializing_if = "Option::is_none")]
616    pub metadata: Option<Metadata>,
617
618    /// The product's name, meant to be displayable to the customer.
619    pub name: String,
620
621    /// An arbitrary string to be displayed on your customer's credit card or bank statement.
622    ///
623    /// While most banks display this information consistently, some may display it incorrectly or not at all.  This may be up to 22 characters.
624    /// The statement description may not include `<`, `>`, `\`, `"`, `'` characters, and will appear on your customer's statement in capital letters.
625    /// Non-ASCII characters are automatically stripped.
626    #[serde(skip_serializing_if = "Option::is_none")]
627    pub statement_descriptor: Option<String>,
628
629    /// A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
630    #[serde(skip_serializing_if = "Option::is_none")]
631    pub tax_code: Option<String>,
632
633    /// A label that represents units of this product.
634    ///
635    /// When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal.
636    #[serde(skip_serializing_if = "Option::is_none")]
637    pub unit_label: Option<String>,
638}
639
640#[derive(Clone, Debug, Default, Deserialize, Serialize)]
641pub struct CreatePriceRecurring {
642    /// Specifies a usage aggregation strategy for prices of `usage_type=metered`.
643    ///
644    /// Defaults to `sum`.
645    #[serde(skip_serializing_if = "Option::is_none")]
646    pub aggregate_usage: Option<CreatePriceRecurringAggregateUsage>,
647
648    /// Specifies billing frequency.
649    ///
650    /// Either `day`, `week`, `month` or `year`.
651    pub interval: CreatePriceRecurringInterval,
652
653    /// The number of intervals between subscription billings.
654    ///
655    /// For example, `interval=month` and `interval_count=3` bills every 3 months.
656    /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
657    #[serde(skip_serializing_if = "Option::is_none")]
658    pub interval_count: Option<u64>,
659
660    /// Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).
661    #[serde(skip_serializing_if = "Option::is_none")]
662    pub trial_period_days: Option<u32>,
663
664    /// Configures how the quantity per period should be determined.
665    ///
666    /// Can be either `metered` or `licensed`.
667    /// `licensed` automatically bills the `quantity` set when adding it to a subscription.
668    /// `metered` aggregates the total usage based on usage records.
669    /// Defaults to `licensed`.
670    #[serde(skip_serializing_if = "Option::is_none")]
671    pub usage_type: Option<CreatePriceRecurringUsageType>,
672}
673
674#[derive(Clone, Debug, Default, Deserialize, Serialize)]
675pub struct CreatePriceTiers {
676    /// The flat billing amount for an entire tier, regardless of the number of units in the tier.
677    #[serde(skip_serializing_if = "Option::is_none")]
678    pub flat_amount: Option<i64>,
679
680    /// Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency.
681    ///
682    /// Only one of `flat_amount` and `flat_amount_decimal` can be set.
683    #[serde(skip_serializing_if = "Option::is_none")]
684    pub flat_amount_decimal: Option<String>,
685
686    /// The per unit billing amount for each individual unit for which this tier applies.
687    #[serde(skip_serializing_if = "Option::is_none")]
688    pub unit_amount: Option<i64>,
689
690    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
691    ///
692    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
693    #[serde(skip_serializing_if = "Option::is_none")]
694    pub unit_amount_decimal: Option<String>,
695
696    /// Specifies the upper bound of this tier.
697    ///
698    /// The lower bound of a tier is the upper bound of the previous tier adding one.
699    /// Use `inf` to define a fallback tier.
700    pub up_to: Option<UpTo>,
701}
702
703#[derive(Clone, Debug, Default, Deserialize, Serialize)]
704pub struct CreatePriceTransformQuantity {
705    /// Divide usage by this number.
706    pub divide_by: i64,
707
708    /// After division, either round the result `up` or `down`.
709    pub round: CreatePriceTransformQuantityRound,
710}
711
712#[derive(Clone, Debug, Default, Deserialize, Serialize)]
713pub struct ListPricesRecurring {
714    /// Filter by billing frequency.
715    ///
716    /// Either `day`, `week`, `month` or `year`.
717    #[serde(skip_serializing_if = "Option::is_none")]
718    pub interval: Option<ListPricesRecurringInterval>,
719
720    /// Filter by the usage type for this price.
721    ///
722    /// Can be either `metered` or `licensed`.
723    #[serde(skip_serializing_if = "Option::is_none")]
724    pub usage_type: Option<ListPricesRecurringUsageType>,
725}
726
727#[derive(Clone, Debug, Default, Deserialize, Serialize)]
728pub struct UpdatePriceCurrencyOptions {
729    /// When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
730    #[serde(skip_serializing_if = "Option::is_none")]
731    pub custom_unit_amount: Option<UpdatePriceCurrencyOptionsCustomUnitAmount>,
732
733    /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
734    ///
735    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
736    /// One of `inclusive`, `exclusive`, or `unspecified`.
737    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
738    #[serde(skip_serializing_if = "Option::is_none")]
739    pub tax_behavior: Option<UpdatePriceCurrencyOptionsTaxBehavior>,
740
741    /// Each element represents a pricing tier.
742    ///
743    /// This parameter requires `billing_scheme` to be set to `tiered`.
744    /// See also the documentation for `billing_scheme`.
745    #[serde(skip_serializing_if = "Option::is_none")]
746    pub tiers: Option<Vec<UpdatePriceCurrencyOptionsTiers>>,
747
748    /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
749    #[serde(skip_serializing_if = "Option::is_none")]
750    pub unit_amount: Option<i64>,
751
752    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
753    ///
754    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
755    #[serde(skip_serializing_if = "Option::is_none")]
756    pub unit_amount_decimal: Option<String>,
757}
758
759#[derive(Clone, Debug, Default, Deserialize, Serialize)]
760pub struct CreatePriceCurrencyOptionsCustomUnitAmount {
761    /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`.
762    pub enabled: bool,
763
764    /// The maximum unit amount the customer can specify for this item.
765    #[serde(skip_serializing_if = "Option::is_none")]
766    pub maximum: Option<i64>,
767
768    /// The minimum unit amount the customer can specify for this item.
769    ///
770    /// Must be at least the minimum charge amount.
771    #[serde(skip_serializing_if = "Option::is_none")]
772    pub minimum: Option<i64>,
773
774    /// The starting unit amount which can be updated by the customer.
775    #[serde(skip_serializing_if = "Option::is_none")]
776    pub preset: Option<i64>,
777}
778
779#[derive(Clone, Debug, Default, Deserialize, Serialize)]
780pub struct CreatePriceCurrencyOptionsTiers {
781    /// The flat billing amount for an entire tier, regardless of the number of units in the tier.
782    #[serde(skip_serializing_if = "Option::is_none")]
783    pub flat_amount: Option<i64>,
784
785    /// Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency.
786    ///
787    /// Only one of `flat_amount` and `flat_amount_decimal` can be set.
788    #[serde(skip_serializing_if = "Option::is_none")]
789    pub flat_amount_decimal: Option<String>,
790
791    /// The per unit billing amount for each individual unit for which this tier applies.
792    #[serde(skip_serializing_if = "Option::is_none")]
793    pub unit_amount: Option<i64>,
794
795    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
796    ///
797    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
798    #[serde(skip_serializing_if = "Option::is_none")]
799    pub unit_amount_decimal: Option<String>,
800
801    /// Specifies the upper bound of this tier.
802    ///
803    /// The lower bound of a tier is the upper bound of the previous tier adding one.
804    /// Use `inf` to define a fallback tier.
805    pub up_to: Option<UpTo>,
806}
807
808#[derive(Clone, Debug, Default, Deserialize, Serialize)]
809pub struct UpdatePriceCurrencyOptionsCustomUnitAmount {
810    /// Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`.
811    pub enabled: bool,
812
813    /// The maximum unit amount the customer can specify for this item.
814    #[serde(skip_serializing_if = "Option::is_none")]
815    pub maximum: Option<i64>,
816
817    /// The minimum unit amount the customer can specify for this item.
818    ///
819    /// Must be at least the minimum charge amount.
820    #[serde(skip_serializing_if = "Option::is_none")]
821    pub minimum: Option<i64>,
822
823    /// The starting unit amount which can be updated by the customer.
824    #[serde(skip_serializing_if = "Option::is_none")]
825    pub preset: Option<i64>,
826}
827
828#[derive(Clone, Debug, Default, Deserialize, Serialize)]
829pub struct UpdatePriceCurrencyOptionsTiers {
830    /// The flat billing amount for an entire tier, regardless of the number of units in the tier.
831    #[serde(skip_serializing_if = "Option::is_none")]
832    pub flat_amount: Option<i64>,
833
834    /// Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency.
835    ///
836    /// Only one of `flat_amount` and `flat_amount_decimal` can be set.
837    #[serde(skip_serializing_if = "Option::is_none")]
838    pub flat_amount_decimal: Option<String>,
839
840    /// The per unit billing amount for each individual unit for which this tier applies.
841    #[serde(skip_serializing_if = "Option::is_none")]
842    pub unit_amount: Option<i64>,
843
844    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
845    ///
846    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
847    #[serde(skip_serializing_if = "Option::is_none")]
848    pub unit_amount_decimal: Option<String>,
849
850    /// Specifies the upper bound of this tier.
851    ///
852    /// The lower bound of a tier is the upper bound of the previous tier adding one.
853    /// Use `inf` to define a fallback tier.
854    pub up_to: Option<UpTo>,
855}
856
857/// An enum representing the possible values of an `CreatePriceCurrencyOptions`'s `tax_behavior` field.
858#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
859#[serde(rename_all = "snake_case")]
860pub enum CreatePriceCurrencyOptionsTaxBehavior {
861    Exclusive,
862    Inclusive,
863    Unspecified,
864}
865
866impl CreatePriceCurrencyOptionsTaxBehavior {
867    pub fn as_str(self) -> &'static str {
868        match self {
869            CreatePriceCurrencyOptionsTaxBehavior::Exclusive => "exclusive",
870            CreatePriceCurrencyOptionsTaxBehavior::Inclusive => "inclusive",
871            CreatePriceCurrencyOptionsTaxBehavior::Unspecified => "unspecified",
872        }
873    }
874}
875
876impl AsRef<str> for CreatePriceCurrencyOptionsTaxBehavior {
877    fn as_ref(&self) -> &str {
878        self.as_str()
879    }
880}
881
882impl std::fmt::Display for CreatePriceCurrencyOptionsTaxBehavior {
883    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
884        self.as_str().fmt(f)
885    }
886}
887impl std::default::Default for CreatePriceCurrencyOptionsTaxBehavior {
888    fn default() -> Self {
889        Self::Exclusive
890    }
891}
892
893/// An enum representing the possible values of an `CreatePriceRecurring`'s `aggregate_usage` field.
894#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
895#[serde(rename_all = "snake_case")]
896pub enum CreatePriceRecurringAggregateUsage {
897    LastDuringPeriod,
898    LastEver,
899    Max,
900    Sum,
901}
902
903impl CreatePriceRecurringAggregateUsage {
904    pub fn as_str(self) -> &'static str {
905        match self {
906            CreatePriceRecurringAggregateUsage::LastDuringPeriod => "last_during_period",
907            CreatePriceRecurringAggregateUsage::LastEver => "last_ever",
908            CreatePriceRecurringAggregateUsage::Max => "max",
909            CreatePriceRecurringAggregateUsage::Sum => "sum",
910        }
911    }
912}
913
914impl AsRef<str> for CreatePriceRecurringAggregateUsage {
915    fn as_ref(&self) -> &str {
916        self.as_str()
917    }
918}
919
920impl std::fmt::Display for CreatePriceRecurringAggregateUsage {
921    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
922        self.as_str().fmt(f)
923    }
924}
925impl std::default::Default for CreatePriceRecurringAggregateUsage {
926    fn default() -> Self {
927        Self::LastDuringPeriod
928    }
929}
930
931/// An enum representing the possible values of an `CreatePriceRecurring`'s `interval` field.
932#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
933#[serde(rename_all = "snake_case")]
934pub enum CreatePriceRecurringInterval {
935    Day,
936    Month,
937    Week,
938    Year,
939}
940
941impl CreatePriceRecurringInterval {
942    pub fn as_str(self) -> &'static str {
943        match self {
944            CreatePriceRecurringInterval::Day => "day",
945            CreatePriceRecurringInterval::Month => "month",
946            CreatePriceRecurringInterval::Week => "week",
947            CreatePriceRecurringInterval::Year => "year",
948        }
949    }
950}
951
952impl AsRef<str> for CreatePriceRecurringInterval {
953    fn as_ref(&self) -> &str {
954        self.as_str()
955    }
956}
957
958impl std::fmt::Display for CreatePriceRecurringInterval {
959    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
960        self.as_str().fmt(f)
961    }
962}
963impl std::default::Default for CreatePriceRecurringInterval {
964    fn default() -> Self {
965        Self::Day
966    }
967}
968
969/// An enum representing the possible values of an `CreatePriceRecurring`'s `usage_type` field.
970#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
971#[serde(rename_all = "snake_case")]
972pub enum CreatePriceRecurringUsageType {
973    Licensed,
974    Metered,
975}
976
977impl CreatePriceRecurringUsageType {
978    pub fn as_str(self) -> &'static str {
979        match self {
980            CreatePriceRecurringUsageType::Licensed => "licensed",
981            CreatePriceRecurringUsageType::Metered => "metered",
982        }
983    }
984}
985
986impl AsRef<str> for CreatePriceRecurringUsageType {
987    fn as_ref(&self) -> &str {
988        self.as_str()
989    }
990}
991
992impl std::fmt::Display for CreatePriceRecurringUsageType {
993    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
994        self.as_str().fmt(f)
995    }
996}
997impl std::default::Default for CreatePriceRecurringUsageType {
998    fn default() -> Self {
999        Self::Licensed
1000    }
1001}
1002
1003/// An enum representing the possible values of an `CreatePriceTransformQuantity`'s `round` field.
1004#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1005#[serde(rename_all = "snake_case")]
1006pub enum CreatePriceTransformQuantityRound {
1007    Down,
1008    Up,
1009}
1010
1011impl CreatePriceTransformQuantityRound {
1012    pub fn as_str(self) -> &'static str {
1013        match self {
1014            CreatePriceTransformQuantityRound::Down => "down",
1015            CreatePriceTransformQuantityRound::Up => "up",
1016        }
1017    }
1018}
1019
1020impl AsRef<str> for CreatePriceTransformQuantityRound {
1021    fn as_ref(&self) -> &str {
1022        self.as_str()
1023    }
1024}
1025
1026impl std::fmt::Display for CreatePriceTransformQuantityRound {
1027    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1028        self.as_str().fmt(f)
1029    }
1030}
1031impl std::default::Default for CreatePriceTransformQuantityRound {
1032    fn default() -> Self {
1033        Self::Down
1034    }
1035}
1036
1037/// An enum representing the possible values of an `CurrencyOption`'s `tax_behavior` field.
1038#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1039#[serde(rename_all = "snake_case")]
1040pub enum CurrencyOptionTaxBehavior {
1041    Exclusive,
1042    Inclusive,
1043    Unspecified,
1044}
1045
1046impl CurrencyOptionTaxBehavior {
1047    pub fn as_str(self) -> &'static str {
1048        match self {
1049            CurrencyOptionTaxBehavior::Exclusive => "exclusive",
1050            CurrencyOptionTaxBehavior::Inclusive => "inclusive",
1051            CurrencyOptionTaxBehavior::Unspecified => "unspecified",
1052        }
1053    }
1054}
1055
1056impl AsRef<str> for CurrencyOptionTaxBehavior {
1057    fn as_ref(&self) -> &str {
1058        self.as_str()
1059    }
1060}
1061
1062impl std::fmt::Display for CurrencyOptionTaxBehavior {
1063    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1064        self.as_str().fmt(f)
1065    }
1066}
1067impl std::default::Default for CurrencyOptionTaxBehavior {
1068    fn default() -> Self {
1069        Self::Exclusive
1070    }
1071}
1072
1073/// An enum representing the possible values of an `ListPricesRecurring`'s `interval` field.
1074#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1075#[serde(rename_all = "snake_case")]
1076pub enum ListPricesRecurringInterval {
1077    Day,
1078    Month,
1079    Week,
1080    Year,
1081}
1082
1083impl ListPricesRecurringInterval {
1084    pub fn as_str(self) -> &'static str {
1085        match self {
1086            ListPricesRecurringInterval::Day => "day",
1087            ListPricesRecurringInterval::Month => "month",
1088            ListPricesRecurringInterval::Week => "week",
1089            ListPricesRecurringInterval::Year => "year",
1090        }
1091    }
1092}
1093
1094impl AsRef<str> for ListPricesRecurringInterval {
1095    fn as_ref(&self) -> &str {
1096        self.as_str()
1097    }
1098}
1099
1100impl std::fmt::Display for ListPricesRecurringInterval {
1101    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1102        self.as_str().fmt(f)
1103    }
1104}
1105impl std::default::Default for ListPricesRecurringInterval {
1106    fn default() -> Self {
1107        Self::Day
1108    }
1109}
1110
1111/// An enum representing the possible values of an `ListPricesRecurring`'s `usage_type` field.
1112#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1113#[serde(rename_all = "snake_case")]
1114pub enum ListPricesRecurringUsageType {
1115    Licensed,
1116    Metered,
1117}
1118
1119impl ListPricesRecurringUsageType {
1120    pub fn as_str(self) -> &'static str {
1121        match self {
1122            ListPricesRecurringUsageType::Licensed => "licensed",
1123            ListPricesRecurringUsageType::Metered => "metered",
1124        }
1125    }
1126}
1127
1128impl AsRef<str> for ListPricesRecurringUsageType {
1129    fn as_ref(&self) -> &str {
1130        self.as_str()
1131    }
1132}
1133
1134impl std::fmt::Display for ListPricesRecurringUsageType {
1135    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1136        self.as_str().fmt(f)
1137    }
1138}
1139impl std::default::Default for ListPricesRecurringUsageType {
1140    fn default() -> Self {
1141        Self::Licensed
1142    }
1143}
1144
1145/// An enum representing the possible values of an `Price`'s `billing_scheme` field.
1146#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1147#[serde(rename_all = "snake_case")]
1148pub enum PriceBillingScheme {
1149    PerUnit,
1150    Tiered,
1151}
1152
1153impl PriceBillingScheme {
1154    pub fn as_str(self) -> &'static str {
1155        match self {
1156            PriceBillingScheme::PerUnit => "per_unit",
1157            PriceBillingScheme::Tiered => "tiered",
1158        }
1159    }
1160}
1161
1162impl AsRef<str> for PriceBillingScheme {
1163    fn as_ref(&self) -> &str {
1164        self.as_str()
1165    }
1166}
1167
1168impl std::fmt::Display for PriceBillingScheme {
1169    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1170        self.as_str().fmt(f)
1171    }
1172}
1173impl std::default::Default for PriceBillingScheme {
1174    fn default() -> Self {
1175        Self::PerUnit
1176    }
1177}
1178
1179/// An enum representing the possible values of an `Price`'s `tax_behavior` field.
1180#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1181#[serde(rename_all = "snake_case")]
1182pub enum PriceTaxBehavior {
1183    Exclusive,
1184    Inclusive,
1185    Unspecified,
1186}
1187
1188impl PriceTaxBehavior {
1189    pub fn as_str(self) -> &'static str {
1190        match self {
1191            PriceTaxBehavior::Exclusive => "exclusive",
1192            PriceTaxBehavior::Inclusive => "inclusive",
1193            PriceTaxBehavior::Unspecified => "unspecified",
1194        }
1195    }
1196}
1197
1198impl AsRef<str> for PriceTaxBehavior {
1199    fn as_ref(&self) -> &str {
1200        self.as_str()
1201    }
1202}
1203
1204impl std::fmt::Display for PriceTaxBehavior {
1205    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1206        self.as_str().fmt(f)
1207    }
1208}
1209impl std::default::Default for PriceTaxBehavior {
1210    fn default() -> Self {
1211        Self::Exclusive
1212    }
1213}
1214
1215/// An enum representing the possible values of an `Price`'s `tiers_mode` field.
1216#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1217#[serde(rename_all = "snake_case")]
1218pub enum PriceTiersMode {
1219    Graduated,
1220    Volume,
1221}
1222
1223impl PriceTiersMode {
1224    pub fn as_str(self) -> &'static str {
1225        match self {
1226            PriceTiersMode::Graduated => "graduated",
1227            PriceTiersMode::Volume => "volume",
1228        }
1229    }
1230}
1231
1232impl AsRef<str> for PriceTiersMode {
1233    fn as_ref(&self) -> &str {
1234        self.as_str()
1235    }
1236}
1237
1238impl std::fmt::Display for PriceTiersMode {
1239    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1240        self.as_str().fmt(f)
1241    }
1242}
1243impl std::default::Default for PriceTiersMode {
1244    fn default() -> Self {
1245        Self::Graduated
1246    }
1247}
1248
1249/// An enum representing the possible values of an `Price`'s `type` field.
1250#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1251#[serde(rename_all = "snake_case")]
1252pub enum PriceType {
1253    OneTime,
1254    Recurring,
1255}
1256
1257impl PriceType {
1258    pub fn as_str(self) -> &'static str {
1259        match self {
1260            PriceType::OneTime => "one_time",
1261            PriceType::Recurring => "recurring",
1262        }
1263    }
1264}
1265
1266impl AsRef<str> for PriceType {
1267    fn as_ref(&self) -> &str {
1268        self.as_str()
1269    }
1270}
1271
1272impl std::fmt::Display for PriceType {
1273    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1274        self.as_str().fmt(f)
1275    }
1276}
1277impl std::default::Default for PriceType {
1278    fn default() -> Self {
1279        Self::OneTime
1280    }
1281}
1282
1283/// An enum representing the possible values of an `Recurring`'s `aggregate_usage` field.
1284#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1285#[serde(rename_all = "snake_case")]
1286pub enum RecurringAggregateUsage {
1287    LastDuringPeriod,
1288    LastEver,
1289    Max,
1290    Sum,
1291}
1292
1293impl RecurringAggregateUsage {
1294    pub fn as_str(self) -> &'static str {
1295        match self {
1296            RecurringAggregateUsage::LastDuringPeriod => "last_during_period",
1297            RecurringAggregateUsage::LastEver => "last_ever",
1298            RecurringAggregateUsage::Max => "max",
1299            RecurringAggregateUsage::Sum => "sum",
1300        }
1301    }
1302}
1303
1304impl AsRef<str> for RecurringAggregateUsage {
1305    fn as_ref(&self) -> &str {
1306        self.as_str()
1307    }
1308}
1309
1310impl std::fmt::Display for RecurringAggregateUsage {
1311    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1312        self.as_str().fmt(f)
1313    }
1314}
1315impl std::default::Default for RecurringAggregateUsage {
1316    fn default() -> Self {
1317        Self::LastDuringPeriod
1318    }
1319}
1320
1321/// An enum representing the possible values of an `Recurring`'s `interval` field.
1322#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1323#[serde(rename_all = "snake_case")]
1324pub enum RecurringInterval {
1325    Day,
1326    Month,
1327    Week,
1328    Year,
1329}
1330
1331impl RecurringInterval {
1332    pub fn as_str(self) -> &'static str {
1333        match self {
1334            RecurringInterval::Day => "day",
1335            RecurringInterval::Month => "month",
1336            RecurringInterval::Week => "week",
1337            RecurringInterval::Year => "year",
1338        }
1339    }
1340}
1341
1342impl AsRef<str> for RecurringInterval {
1343    fn as_ref(&self) -> &str {
1344        self.as_str()
1345    }
1346}
1347
1348impl std::fmt::Display for RecurringInterval {
1349    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1350        self.as_str().fmt(f)
1351    }
1352}
1353impl std::default::Default for RecurringInterval {
1354    fn default() -> Self {
1355        Self::Day
1356    }
1357}
1358
1359/// An enum representing the possible values of an `Recurring`'s `usage_type` field.
1360#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1361#[serde(rename_all = "snake_case")]
1362pub enum RecurringUsageType {
1363    Licensed,
1364    Metered,
1365}
1366
1367impl RecurringUsageType {
1368    pub fn as_str(self) -> &'static str {
1369        match self {
1370            RecurringUsageType::Licensed => "licensed",
1371            RecurringUsageType::Metered => "metered",
1372        }
1373    }
1374}
1375
1376impl AsRef<str> for RecurringUsageType {
1377    fn as_ref(&self) -> &str {
1378        self.as_str()
1379    }
1380}
1381
1382impl std::fmt::Display for RecurringUsageType {
1383    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1384        self.as_str().fmt(f)
1385    }
1386}
1387impl std::default::Default for RecurringUsageType {
1388    fn default() -> Self {
1389        Self::Licensed
1390    }
1391}
1392
1393/// An enum representing the possible values of an `TransformQuantity`'s `round` field.
1394#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1395#[serde(rename_all = "snake_case")]
1396pub enum TransformQuantityRound {
1397    Down,
1398    Up,
1399}
1400
1401impl TransformQuantityRound {
1402    pub fn as_str(self) -> &'static str {
1403        match self {
1404            TransformQuantityRound::Down => "down",
1405            TransformQuantityRound::Up => "up",
1406        }
1407    }
1408}
1409
1410impl AsRef<str> for TransformQuantityRound {
1411    fn as_ref(&self) -> &str {
1412        self.as_str()
1413    }
1414}
1415
1416impl std::fmt::Display for TransformQuantityRound {
1417    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1418        self.as_str().fmt(f)
1419    }
1420}
1421impl std::default::Default for TransformQuantityRound {
1422    fn default() -> Self {
1423        Self::Down
1424    }
1425}
1426
1427/// An enum representing the possible values of an `UpdatePriceCurrencyOptions`'s `tax_behavior` field.
1428#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1429#[serde(rename_all = "snake_case")]
1430pub enum UpdatePriceCurrencyOptionsTaxBehavior {
1431    Exclusive,
1432    Inclusive,
1433    Unspecified,
1434}
1435
1436impl UpdatePriceCurrencyOptionsTaxBehavior {
1437    pub fn as_str(self) -> &'static str {
1438        match self {
1439            UpdatePriceCurrencyOptionsTaxBehavior::Exclusive => "exclusive",
1440            UpdatePriceCurrencyOptionsTaxBehavior::Inclusive => "inclusive",
1441            UpdatePriceCurrencyOptionsTaxBehavior::Unspecified => "unspecified",
1442        }
1443    }
1444}
1445
1446impl AsRef<str> for UpdatePriceCurrencyOptionsTaxBehavior {
1447    fn as_ref(&self) -> &str {
1448        self.as_str()
1449    }
1450}
1451
1452impl std::fmt::Display for UpdatePriceCurrencyOptionsTaxBehavior {
1453    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1454        self.as_str().fmt(f)
1455    }
1456}
1457impl std::default::Default for UpdatePriceCurrencyOptionsTaxBehavior {
1458    fn default() -> Self {
1459        Self::Exclusive
1460    }
1461}