stripe/resources/generated/
billing_portal_session.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::client::{Client, Response};
6use crate::ids::{BillingPortalSessionId, CustomerId};
7use crate::params::{Expand, Expandable, Object, Timestamp};
8use crate::resources::BillingPortalConfiguration;
9use serde::{Deserialize, Serialize};
10
11/// The resource representing a Stripe "PortalSession".
12#[derive(Clone, Debug, Default, Deserialize, Serialize)]
13pub struct BillingPortalSession {
14    /// Unique identifier for the object.
15    pub id: BillingPortalSessionId,
16
17    /// The configuration used by this session, describing the features available.
18    pub configuration: Expandable<BillingPortalConfiguration>,
19
20    /// Time at which the object was created.
21    ///
22    /// Measured in seconds since the Unix epoch.
23    pub created: Timestamp,
24
25    /// The ID of the customer for this session.
26    pub customer: String,
27
28    /// Information about a specific flow for the customer to go through.
29    ///
30    /// See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
31    pub flow: Option<PortalFlowsFlow>,
32
33    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
34    pub livemode: bool,
35
36    /// The IETF language tag of the locale Customer Portal is displayed in.
37    ///
38    /// If blank or auto, the customer’s `preferred_locales` or browser’s locale is used.
39    pub locale: Option<BillingPortalSessionLocale>,
40
41    /// The account for which the session was created on behalf of.
42    ///
43    /// When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal.
44    /// For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#on-behalf-of).
45    /// Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
46    pub on_behalf_of: Option<String>,
47
48    /// The URL to redirect customers to when they click on the portal's link to return to your website.
49    pub return_url: Option<String>,
50
51    /// The short-lived URL of the session that gives customers access to the customer portal.
52    pub url: String,
53}
54
55impl BillingPortalSession {
56    /// Creates a session of the customer portal.
57    pub fn create(
58        client: &Client,
59        params: CreateBillingPortalSession<'_>,
60    ) -> Response<BillingPortalSession> {
61        #[allow(clippy::needless_borrows_for_generic_args)]
62        client.post_form("/billing_portal/sessions", &params)
63    }
64}
65
66impl Object for BillingPortalSession {
67    type Id = BillingPortalSessionId;
68    fn id(&self) -> Self::Id {
69        self.id.clone()
70    }
71    fn object(&self) -> &'static str {
72        "billing_portal.session"
73    }
74}
75
76#[derive(Clone, Debug, Default, Deserialize, Serialize)]
77pub struct PortalFlowsFlow {
78    pub after_completion: PortalFlowsFlowAfterCompletion,
79
80    /// Configuration when `flow.type=subscription_cancel`.
81    pub subscription_cancel: Option<PortalFlowsFlowSubscriptionCancel>,
82
83    /// Configuration when `flow.type=subscription_update`.
84    pub subscription_update: Option<PortalFlowsFlowSubscriptionUpdate>,
85
86    /// Configuration when `flow.type=subscription_update_confirm`.
87    pub subscription_update_confirm: Option<PortalFlowsFlowSubscriptionUpdateConfirm>,
88
89    /// Type of flow that the customer will go through.
90    #[serde(rename = "type")]
91    pub type_: PortalFlowsFlowType,
92}
93
94#[derive(Clone, Debug, Default, Deserialize, Serialize)]
95pub struct PortalFlowsFlowAfterCompletion {
96    /// Configuration when `after_completion.type=hosted_confirmation`.
97    pub hosted_confirmation: Option<PortalFlowsAfterCompletionHostedConfirmation>,
98
99    /// Configuration when `after_completion.type=redirect`.
100    pub redirect: Option<PortalFlowsAfterCompletionRedirect>,
101
102    /// The specified type of behavior after the flow is completed.
103    #[serde(rename = "type")]
104    pub type_: PortalFlowsFlowAfterCompletionType,
105}
106
107#[derive(Clone, Debug, Default, Deserialize, Serialize)]
108pub struct PortalFlowsAfterCompletionHostedConfirmation {
109    /// A custom message to display to the customer after the flow is completed.
110    pub custom_message: Option<String>,
111}
112
113#[derive(Clone, Debug, Default, Deserialize, Serialize)]
114pub struct PortalFlowsAfterCompletionRedirect {
115    /// The URL the customer will be redirected to after the flow is completed.
116    pub return_url: String,
117}
118
119#[derive(Clone, Debug, Default, Deserialize, Serialize)]
120pub struct PortalFlowsFlowSubscriptionCancel {
121    /// Specify a retention strategy to be used in the cancellation flow.
122    pub retention: Option<PortalFlowsRetention>,
123
124    /// The ID of the subscription to be canceled.
125    pub subscription: String,
126}
127
128#[derive(Clone, Debug, Default, Deserialize, Serialize)]
129pub struct PortalFlowsFlowSubscriptionUpdate {
130    /// The ID of the subscription to be updated.
131    pub subscription: String,
132}
133
134#[derive(Clone, Debug, Default, Deserialize, Serialize)]
135pub struct PortalFlowsFlowSubscriptionUpdateConfirm {
136    /// The coupon or promotion code to apply to this subscription update.
137    ///
138    /// Currently, only up to one may be specified.
139    pub discounts: Option<Vec<PortalFlowsSubscriptionUpdateConfirmDiscount>>,
140
141    /// The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow.
142    ///
143    /// Currently, only up to one may be specified and subscriptions with multiple items are not updatable.
144    pub items: Vec<PortalFlowsSubscriptionUpdateConfirmItem>,
145
146    /// The ID of the subscription to be updated.
147    pub subscription: String,
148}
149
150#[derive(Clone, Debug, Default, Deserialize, Serialize)]
151pub struct PortalFlowsRetention {
152    /// Configuration when `retention.type=coupon_offer`.
153    pub coupon_offer: Option<PortalFlowsCouponOffer>,
154
155    /// Type of retention strategy that will be used.
156    #[serde(rename = "type")]
157    pub type_: PortalFlowsRetentionType,
158}
159
160#[derive(Clone, Debug, Default, Deserialize, Serialize)]
161pub struct PortalFlowsCouponOffer {
162    /// The ID of the coupon to be offered.
163    pub coupon: String,
164}
165
166#[derive(Clone, Debug, Default, Deserialize, Serialize)]
167pub struct PortalFlowsSubscriptionUpdateConfirmDiscount {
168    /// The ID of the coupon to apply to this subscription update.
169    pub coupon: Option<String>,
170
171    /// The ID of a promotion code to apply to this subscription update.
172    pub promotion_code: Option<String>,
173}
174
175#[derive(Clone, Debug, Default, Deserialize, Serialize)]
176pub struct PortalFlowsSubscriptionUpdateConfirmItem {
177    /// The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated.
178    pub id: Option<String>,
179
180    /// The price the customer should subscribe to through this flow.
181    ///
182    /// The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products).
183    pub price: Option<String>,
184
185    /// [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow.
186    #[serde(skip_serializing_if = "Option::is_none")]
187    pub quantity: Option<u64>,
188}
189
190/// The parameters for `BillingPortalSession::create`.
191#[derive(Clone, Debug, Serialize)]
192pub struct CreateBillingPortalSession<'a> {
193    /// The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features.
194    ///
195    /// If not specified, the session uses the default configuration.
196    #[serde(skip_serializing_if = "Option::is_none")]
197    pub configuration: Option<&'a str>,
198
199    /// The ID of an existing customer.
200    pub customer: CustomerId,
201
202    /// Specifies which fields in the response should be expanded.
203    #[serde(skip_serializing_if = "Expand::is_empty")]
204    pub expand: &'a [&'a str],
205
206    /// Information about a specific flow for the customer to go through.
207    ///
208    /// See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
209    #[serde(skip_serializing_if = "Option::is_none")]
210    pub flow_data: Option<CreateBillingPortalSessionFlowData>,
211
212    /// The IETF language tag of the locale customer portal is displayed in.
213    ///
214    /// If blank or auto, the customer’s `preferred_locales` or browser’s locale is used.
215    #[serde(skip_serializing_if = "Option::is_none")]
216    pub locale: Option<BillingPortalSessionLocale>,
217
218    /// The `on_behalf_of` account to use for this session.
219    ///
220    /// When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal.
221    /// For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#on-behalf-of).
222    /// Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
223    #[serde(skip_serializing_if = "Option::is_none")]
224    pub on_behalf_of: Option<&'a str>,
225
226    /// The default URL to redirect customers to when they click on the portal's link to return to your website.
227    #[serde(skip_serializing_if = "Option::is_none")]
228    pub return_url: Option<&'a str>,
229}
230
231impl<'a> CreateBillingPortalSession<'a> {
232    pub fn new(customer: CustomerId) -> Self {
233        CreateBillingPortalSession {
234            configuration: Default::default(),
235            customer,
236            expand: Default::default(),
237            flow_data: Default::default(),
238            locale: Default::default(),
239            on_behalf_of: Default::default(),
240            return_url: Default::default(),
241        }
242    }
243}
244
245#[derive(Clone, Debug, Default, Deserialize, Serialize)]
246pub struct CreateBillingPortalSessionFlowData {
247    /// Behavior after the flow is completed.
248    #[serde(skip_serializing_if = "Option::is_none")]
249    pub after_completion: Option<CreateBillingPortalSessionFlowDataAfterCompletion>,
250
251    /// Configuration when `flow_data.type=subscription_cancel`.
252    #[serde(skip_serializing_if = "Option::is_none")]
253    pub subscription_cancel: Option<CreateBillingPortalSessionFlowDataSubscriptionCancel>,
254
255    /// Configuration when `flow_data.type=subscription_update`.
256    #[serde(skip_serializing_if = "Option::is_none")]
257    pub subscription_update: Option<CreateBillingPortalSessionFlowDataSubscriptionUpdate>,
258
259    /// Configuration when `flow_data.type=subscription_update_confirm`.
260    #[serde(skip_serializing_if = "Option::is_none")]
261    pub subscription_update_confirm:
262        Option<CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirm>,
263
264    /// Type of flow that the customer will go through.
265    #[serde(rename = "type")]
266    pub type_: CreateBillingPortalSessionFlowDataType,
267}
268
269#[derive(Clone, Debug, Default, Deserialize, Serialize)]
270pub struct CreateBillingPortalSessionFlowDataAfterCompletion {
271    /// Configuration when `after_completion.type=hosted_confirmation`.
272    #[serde(skip_serializing_if = "Option::is_none")]
273    pub hosted_confirmation:
274        Option<CreateBillingPortalSessionFlowDataAfterCompletionHostedConfirmation>,
275
276    /// Configuration when `after_completion.type=redirect`.
277    #[serde(skip_serializing_if = "Option::is_none")]
278    pub redirect: Option<CreateBillingPortalSessionFlowDataAfterCompletionRedirect>,
279
280    /// The specified behavior after the flow is completed.
281    #[serde(rename = "type")]
282    pub type_: CreateBillingPortalSessionFlowDataAfterCompletionType,
283}
284
285#[derive(Clone, Debug, Default, Deserialize, Serialize)]
286pub struct CreateBillingPortalSessionFlowDataSubscriptionCancel {
287    /// Specify a retention strategy to be used in the cancellation flow.
288    #[serde(skip_serializing_if = "Option::is_none")]
289    pub retention: Option<CreateBillingPortalSessionFlowDataSubscriptionCancelRetention>,
290
291    /// The ID of the subscription to be canceled.
292    pub subscription: String,
293}
294
295#[derive(Clone, Debug, Default, Deserialize, Serialize)]
296pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdate {
297    /// The ID of the subscription to be updated.
298    pub subscription: String,
299}
300
301#[derive(Clone, Debug, Default, Deserialize, Serialize)]
302pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirm {
303    /// The coupon or promotion code to apply to this subscription update.
304    ///
305    /// Currently, only up to one may be specified.
306    #[serde(skip_serializing_if = "Option::is_none")]
307    pub discounts:
308        Option<Vec<CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts>>,
309
310    /// The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow.
311    ///
312    /// Currently, only up to one may be specified and subscriptions with multiple items are not updatable.
313    pub items: Vec<CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems>,
314
315    /// The ID of the subscription to be updated.
316    pub subscription: String,
317}
318
319#[derive(Clone, Debug, Default, Deserialize, Serialize)]
320pub struct CreateBillingPortalSessionFlowDataAfterCompletionHostedConfirmation {
321    /// A custom message to display to the customer after the flow is completed.
322    #[serde(skip_serializing_if = "Option::is_none")]
323    pub custom_message: Option<String>,
324}
325
326#[derive(Clone, Debug, Default, Deserialize, Serialize)]
327pub struct CreateBillingPortalSessionFlowDataAfterCompletionRedirect {
328    /// The URL the customer will be redirected to after the flow is completed.
329    pub return_url: String,
330}
331
332#[derive(Clone, Debug, Default, Deserialize, Serialize)]
333pub struct CreateBillingPortalSessionFlowDataSubscriptionCancelRetention {
334    /// Configuration when `retention.type=coupon_offer`.
335    pub coupon_offer: CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionCouponOffer,
336
337    /// Type of retention strategy to use with the customer.
338    #[serde(rename = "type")]
339    pub type_: CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType,
340}
341
342#[derive(Clone, Debug, Default, Deserialize, Serialize)]
343pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmDiscounts {
344    /// The ID of the coupon to apply to this subscription update.
345    #[serde(skip_serializing_if = "Option::is_none")]
346    pub coupon: Option<String>,
347
348    /// The ID of a promotion code to apply to this subscription update.
349    #[serde(skip_serializing_if = "Option::is_none")]
350    pub promotion_code: Option<String>,
351}
352
353#[derive(Clone, Debug, Default, Deserialize, Serialize)]
354pub struct CreateBillingPortalSessionFlowDataSubscriptionUpdateConfirmItems {
355    /// The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated.
356    pub id: String,
357
358    /// The price the customer should subscribe to through this flow.
359    ///
360    /// The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products).
361    #[serde(skip_serializing_if = "Option::is_none")]
362    pub price: Option<String>,
363
364    /// [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow.
365    #[serde(skip_serializing_if = "Option::is_none")]
366    pub quantity: Option<u64>,
367}
368
369#[derive(Clone, Debug, Default, Deserialize, Serialize)]
370pub struct CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionCouponOffer {
371    /// The ID of the coupon to be offered.
372    pub coupon: String,
373}
374
375/// An enum representing the possible values of an `BillingPortalSession`'s `locale` field.
376#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
377#[serde(rename_all = "snake_case")]
378pub enum BillingPortalSessionLocale {
379    Auto,
380    Bg,
381    Cs,
382    Da,
383    De,
384    El,
385    En,
386    #[serde(rename = "en-AU")]
387    EnAu,
388    #[serde(rename = "en-CA")]
389    EnCa,
390    #[serde(rename = "en-GB")]
391    EnGb,
392    #[serde(rename = "en-IE")]
393    EnIe,
394    #[serde(rename = "en-IN")]
395    EnIn,
396    #[serde(rename = "en-NZ")]
397    EnNz,
398    #[serde(rename = "en-SG")]
399    EnSg,
400    Es,
401    #[serde(rename = "es-419")]
402    Es419,
403    Et,
404    Fi,
405    Fil,
406    Fr,
407    #[serde(rename = "fr-CA")]
408    FrCa,
409    Hr,
410    Hu,
411    Id,
412    It,
413    Ja,
414    Ko,
415    Lt,
416    Lv,
417    Ms,
418    Mt,
419    Nb,
420    Nl,
421    Pl,
422    Pt,
423    #[serde(rename = "pt-BR")]
424    PtBr,
425    Ro,
426    Ru,
427    Sk,
428    Sl,
429    Sv,
430    Th,
431    Tr,
432    Vi,
433    Zh,
434    #[serde(rename = "zh-HK")]
435    ZhHk,
436    #[serde(rename = "zh-TW")]
437    ZhTw,
438}
439
440impl BillingPortalSessionLocale {
441    pub fn as_str(self) -> &'static str {
442        match self {
443            BillingPortalSessionLocale::Auto => "auto",
444            BillingPortalSessionLocale::Bg => "bg",
445            BillingPortalSessionLocale::Cs => "cs",
446            BillingPortalSessionLocale::Da => "da",
447            BillingPortalSessionLocale::De => "de",
448            BillingPortalSessionLocale::El => "el",
449            BillingPortalSessionLocale::En => "en",
450            BillingPortalSessionLocale::EnAu => "en-AU",
451            BillingPortalSessionLocale::EnCa => "en-CA",
452            BillingPortalSessionLocale::EnGb => "en-GB",
453            BillingPortalSessionLocale::EnIe => "en-IE",
454            BillingPortalSessionLocale::EnIn => "en-IN",
455            BillingPortalSessionLocale::EnNz => "en-NZ",
456            BillingPortalSessionLocale::EnSg => "en-SG",
457            BillingPortalSessionLocale::Es => "es",
458            BillingPortalSessionLocale::Es419 => "es-419",
459            BillingPortalSessionLocale::Et => "et",
460            BillingPortalSessionLocale::Fi => "fi",
461            BillingPortalSessionLocale::Fil => "fil",
462            BillingPortalSessionLocale::Fr => "fr",
463            BillingPortalSessionLocale::FrCa => "fr-CA",
464            BillingPortalSessionLocale::Hr => "hr",
465            BillingPortalSessionLocale::Hu => "hu",
466            BillingPortalSessionLocale::Id => "id",
467            BillingPortalSessionLocale::It => "it",
468            BillingPortalSessionLocale::Ja => "ja",
469            BillingPortalSessionLocale::Ko => "ko",
470            BillingPortalSessionLocale::Lt => "lt",
471            BillingPortalSessionLocale::Lv => "lv",
472            BillingPortalSessionLocale::Ms => "ms",
473            BillingPortalSessionLocale::Mt => "mt",
474            BillingPortalSessionLocale::Nb => "nb",
475            BillingPortalSessionLocale::Nl => "nl",
476            BillingPortalSessionLocale::Pl => "pl",
477            BillingPortalSessionLocale::Pt => "pt",
478            BillingPortalSessionLocale::PtBr => "pt-BR",
479            BillingPortalSessionLocale::Ro => "ro",
480            BillingPortalSessionLocale::Ru => "ru",
481            BillingPortalSessionLocale::Sk => "sk",
482            BillingPortalSessionLocale::Sl => "sl",
483            BillingPortalSessionLocale::Sv => "sv",
484            BillingPortalSessionLocale::Th => "th",
485            BillingPortalSessionLocale::Tr => "tr",
486            BillingPortalSessionLocale::Vi => "vi",
487            BillingPortalSessionLocale::Zh => "zh",
488            BillingPortalSessionLocale::ZhHk => "zh-HK",
489            BillingPortalSessionLocale::ZhTw => "zh-TW",
490        }
491    }
492}
493
494impl AsRef<str> for BillingPortalSessionLocale {
495    fn as_ref(&self) -> &str {
496        self.as_str()
497    }
498}
499
500impl std::fmt::Display for BillingPortalSessionLocale {
501    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
502        self.as_str().fmt(f)
503    }
504}
505impl std::default::Default for BillingPortalSessionLocale {
506    fn default() -> Self {
507        Self::Auto
508    }
509}
510
511/// An enum representing the possible values of an `CreateBillingPortalSessionFlowDataAfterCompletion`'s `type` field.
512#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
513#[serde(rename_all = "snake_case")]
514pub enum CreateBillingPortalSessionFlowDataAfterCompletionType {
515    HostedConfirmation,
516    PortalHomepage,
517    Redirect,
518}
519
520impl CreateBillingPortalSessionFlowDataAfterCompletionType {
521    pub fn as_str(self) -> &'static str {
522        match self {
523            CreateBillingPortalSessionFlowDataAfterCompletionType::HostedConfirmation => {
524                "hosted_confirmation"
525            }
526            CreateBillingPortalSessionFlowDataAfterCompletionType::PortalHomepage => {
527                "portal_homepage"
528            }
529            CreateBillingPortalSessionFlowDataAfterCompletionType::Redirect => "redirect",
530        }
531    }
532}
533
534impl AsRef<str> for CreateBillingPortalSessionFlowDataAfterCompletionType {
535    fn as_ref(&self) -> &str {
536        self.as_str()
537    }
538}
539
540impl std::fmt::Display for CreateBillingPortalSessionFlowDataAfterCompletionType {
541    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
542        self.as_str().fmt(f)
543    }
544}
545impl std::default::Default for CreateBillingPortalSessionFlowDataAfterCompletionType {
546    fn default() -> Self {
547        Self::HostedConfirmation
548    }
549}
550
551/// An enum representing the possible values of an `CreateBillingPortalSessionFlowDataSubscriptionCancelRetention`'s `type` field.
552#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
553#[serde(rename_all = "snake_case")]
554pub enum CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType {
555    CouponOffer,
556}
557
558impl CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType {
559    pub fn as_str(self) -> &'static str {
560        match self {
561            CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType::CouponOffer => {
562                "coupon_offer"
563            }
564        }
565    }
566}
567
568impl AsRef<str> for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType {
569    fn as_ref(&self) -> &str {
570        self.as_str()
571    }
572}
573
574impl std::fmt::Display for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType {
575    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
576        self.as_str().fmt(f)
577    }
578}
579impl std::default::Default for CreateBillingPortalSessionFlowDataSubscriptionCancelRetentionType {
580    fn default() -> Self {
581        Self::CouponOffer
582    }
583}
584
585/// An enum representing the possible values of an `CreateBillingPortalSessionFlowData`'s `type` field.
586#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
587#[serde(rename_all = "snake_case")]
588pub enum CreateBillingPortalSessionFlowDataType {
589    PaymentMethodUpdate,
590    SubscriptionCancel,
591    SubscriptionUpdate,
592    SubscriptionUpdateConfirm,
593}
594
595impl CreateBillingPortalSessionFlowDataType {
596    pub fn as_str(self) -> &'static str {
597        match self {
598            CreateBillingPortalSessionFlowDataType::PaymentMethodUpdate => "payment_method_update",
599            CreateBillingPortalSessionFlowDataType::SubscriptionCancel => "subscription_cancel",
600            CreateBillingPortalSessionFlowDataType::SubscriptionUpdate => "subscription_update",
601            CreateBillingPortalSessionFlowDataType::SubscriptionUpdateConfirm => {
602                "subscription_update_confirm"
603            }
604        }
605    }
606}
607
608impl AsRef<str> for CreateBillingPortalSessionFlowDataType {
609    fn as_ref(&self) -> &str {
610        self.as_str()
611    }
612}
613
614impl std::fmt::Display for CreateBillingPortalSessionFlowDataType {
615    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
616        self.as_str().fmt(f)
617    }
618}
619impl std::default::Default for CreateBillingPortalSessionFlowDataType {
620    fn default() -> Self {
621        Self::PaymentMethodUpdate
622    }
623}
624
625/// An enum representing the possible values of an `PortalFlowsFlowAfterCompletion`'s `type` field.
626#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
627#[serde(rename_all = "snake_case")]
628pub enum PortalFlowsFlowAfterCompletionType {
629    HostedConfirmation,
630    PortalHomepage,
631    Redirect,
632}
633
634impl PortalFlowsFlowAfterCompletionType {
635    pub fn as_str(self) -> &'static str {
636        match self {
637            PortalFlowsFlowAfterCompletionType::HostedConfirmation => "hosted_confirmation",
638            PortalFlowsFlowAfterCompletionType::PortalHomepage => "portal_homepage",
639            PortalFlowsFlowAfterCompletionType::Redirect => "redirect",
640        }
641    }
642}
643
644impl AsRef<str> for PortalFlowsFlowAfterCompletionType {
645    fn as_ref(&self) -> &str {
646        self.as_str()
647    }
648}
649
650impl std::fmt::Display for PortalFlowsFlowAfterCompletionType {
651    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
652        self.as_str().fmt(f)
653    }
654}
655impl std::default::Default for PortalFlowsFlowAfterCompletionType {
656    fn default() -> Self {
657        Self::HostedConfirmation
658    }
659}
660
661/// An enum representing the possible values of an `PortalFlowsFlow`'s `type` field.
662#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
663#[serde(rename_all = "snake_case")]
664pub enum PortalFlowsFlowType {
665    PaymentMethodUpdate,
666    SubscriptionCancel,
667    SubscriptionUpdate,
668    SubscriptionUpdateConfirm,
669}
670
671impl PortalFlowsFlowType {
672    pub fn as_str(self) -> &'static str {
673        match self {
674            PortalFlowsFlowType::PaymentMethodUpdate => "payment_method_update",
675            PortalFlowsFlowType::SubscriptionCancel => "subscription_cancel",
676            PortalFlowsFlowType::SubscriptionUpdate => "subscription_update",
677            PortalFlowsFlowType::SubscriptionUpdateConfirm => "subscription_update_confirm",
678        }
679    }
680}
681
682impl AsRef<str> for PortalFlowsFlowType {
683    fn as_ref(&self) -> &str {
684        self.as_str()
685    }
686}
687
688impl std::fmt::Display for PortalFlowsFlowType {
689    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
690        self.as_str().fmt(f)
691    }
692}
693impl std::default::Default for PortalFlowsFlowType {
694    fn default() -> Self {
695        Self::PaymentMethodUpdate
696    }
697}
698
699/// An enum representing the possible values of an `PortalFlowsRetention`'s `type` field.
700#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
701#[serde(rename_all = "snake_case")]
702pub enum PortalFlowsRetentionType {
703    CouponOffer,
704}
705
706impl PortalFlowsRetentionType {
707    pub fn as_str(self) -> &'static str {
708        match self {
709            PortalFlowsRetentionType::CouponOffer => "coupon_offer",
710        }
711    }
712}
713
714impl AsRef<str> for PortalFlowsRetentionType {
715    fn as_ref(&self) -> &str {
716        self.as_str()
717    }
718}
719
720impl std::fmt::Display for PortalFlowsRetentionType {
721    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
722        self.as_str().fmt(f)
723    }
724}
725impl std::default::Default for PortalFlowsRetentionType {
726    fn default() -> Self {
727        Self::CouponOffer
728    }
729}