Skip to main content

stripe_payment/payment_link/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Eq, PartialEq)]
6#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
7#[derive(serde::Serialize)]
8struct ListPaymentLinkBuilder {
9    #[serde(skip_serializing_if = "Option::is_none")]
10    active: Option<bool>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    ending_before: Option<String>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    expand: Option<Vec<String>>,
15    #[serde(skip_serializing_if = "Option::is_none")]
16    limit: Option<i64>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    starting_after: Option<String>,
19}
20#[cfg(feature = "redact-generated-debug")]
21impl std::fmt::Debug for ListPaymentLinkBuilder {
22    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
23        f.debug_struct("ListPaymentLinkBuilder").finish_non_exhaustive()
24    }
25}
26impl ListPaymentLinkBuilder {
27    fn new() -> Self {
28        Self { active: None, ending_before: None, expand: None, limit: None, starting_after: None }
29    }
30}
31/// Returns a list of your payment links.
32#[derive(Clone)]
33#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
34#[derive(serde::Serialize)]
35pub struct ListPaymentLink {
36    inner: ListPaymentLinkBuilder,
37}
38#[cfg(feature = "redact-generated-debug")]
39impl std::fmt::Debug for ListPaymentLink {
40    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
41        f.debug_struct("ListPaymentLink").finish_non_exhaustive()
42    }
43}
44impl ListPaymentLink {
45    /// Construct a new `ListPaymentLink`.
46    pub fn new() -> Self {
47        Self { inner: ListPaymentLinkBuilder::new() }
48    }
49    /// Only return payment links that are active or inactive (e.g., pass `false` to list all inactive payment links).
50    pub fn active(mut self, active: impl Into<bool>) -> Self {
51        self.inner.active = Some(active.into());
52        self
53    }
54    /// A cursor for use in pagination.
55    /// `ending_before` is an object ID that defines your place in the list.
56    /// 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.
57    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
58        self.inner.ending_before = Some(ending_before.into());
59        self
60    }
61    /// Specifies which fields in the response should be expanded.
62    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
63        self.inner.expand = Some(expand.into());
64        self
65    }
66    /// A limit on the number of objects to be returned.
67    /// Limit can range between 1 and 100, and the default is 10.
68    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
69        self.inner.limit = Some(limit.into());
70        self
71    }
72    /// A cursor for use in pagination.
73    /// `starting_after` is an object ID that defines your place in the list.
74    /// 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.
75    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
76        self.inner.starting_after = Some(starting_after.into());
77        self
78    }
79}
80impl Default for ListPaymentLink {
81    fn default() -> Self {
82        Self::new()
83    }
84}
85impl ListPaymentLink {
86    /// Send the request and return the deserialized response.
87    pub async fn send<C: StripeClient>(
88        &self,
89        client: &C,
90    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
91        self.customize().send(client).await
92    }
93
94    /// Send the request and return the deserialized response, blocking until completion.
95    pub fn send_blocking<C: StripeBlockingClient>(
96        &self,
97        client: &C,
98    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
99        self.customize().send_blocking(client)
100    }
101
102    pub fn paginate(
103        &self,
104    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::PaymentLink>> {
105        stripe_client_core::ListPaginator::new_list("/payment_links", &self.inner)
106    }
107}
108
109impl StripeRequest for ListPaymentLink {
110    type Output = stripe_types::List<stripe_shared::PaymentLink>;
111
112    fn build(&self) -> RequestBuilder {
113        RequestBuilder::new(StripeMethod::Get, "/payment_links").query(&self.inner)
114    }
115}
116#[derive(Clone, Eq, PartialEq)]
117#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
118#[derive(serde::Serialize)]
119struct RetrievePaymentLinkBuilder {
120    #[serde(skip_serializing_if = "Option::is_none")]
121    expand: Option<Vec<String>>,
122}
123#[cfg(feature = "redact-generated-debug")]
124impl std::fmt::Debug for RetrievePaymentLinkBuilder {
125    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
126        f.debug_struct("RetrievePaymentLinkBuilder").finish_non_exhaustive()
127    }
128}
129impl RetrievePaymentLinkBuilder {
130    fn new() -> Self {
131        Self { expand: None }
132    }
133}
134/// Retrieve a payment link.
135#[derive(Clone)]
136#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
137#[derive(serde::Serialize)]
138pub struct RetrievePaymentLink {
139    inner: RetrievePaymentLinkBuilder,
140    payment_link: stripe_shared::PaymentLinkId,
141}
142#[cfg(feature = "redact-generated-debug")]
143impl std::fmt::Debug for RetrievePaymentLink {
144    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
145        f.debug_struct("RetrievePaymentLink").finish_non_exhaustive()
146    }
147}
148impl RetrievePaymentLink {
149    /// Construct a new `RetrievePaymentLink`.
150    pub fn new(payment_link: impl Into<stripe_shared::PaymentLinkId>) -> Self {
151        Self { payment_link: payment_link.into(), inner: RetrievePaymentLinkBuilder::new() }
152    }
153    /// Specifies which fields in the response should be expanded.
154    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
155        self.inner.expand = Some(expand.into());
156        self
157    }
158}
159impl RetrievePaymentLink {
160    /// Send the request and return the deserialized response.
161    pub async fn send<C: StripeClient>(
162        &self,
163        client: &C,
164    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
165        self.customize().send(client).await
166    }
167
168    /// Send the request and return the deserialized response, blocking until completion.
169    pub fn send_blocking<C: StripeBlockingClient>(
170        &self,
171        client: &C,
172    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
173        self.customize().send_blocking(client)
174    }
175}
176
177impl StripeRequest for RetrievePaymentLink {
178    type Output = stripe_shared::PaymentLink;
179
180    fn build(&self) -> RequestBuilder {
181        let payment_link = &self.payment_link;
182        RequestBuilder::new(StripeMethod::Get, format!("/payment_links/{payment_link}"))
183            .query(&self.inner)
184    }
185}
186#[derive(Clone, Eq, PartialEq)]
187#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
188#[derive(serde::Serialize)]
189struct ListLineItemsPaymentLinkBuilder {
190    #[serde(skip_serializing_if = "Option::is_none")]
191    ending_before: Option<String>,
192    #[serde(skip_serializing_if = "Option::is_none")]
193    expand: Option<Vec<String>>,
194    #[serde(skip_serializing_if = "Option::is_none")]
195    limit: Option<i64>,
196    #[serde(skip_serializing_if = "Option::is_none")]
197    starting_after: Option<String>,
198}
199#[cfg(feature = "redact-generated-debug")]
200impl std::fmt::Debug for ListLineItemsPaymentLinkBuilder {
201    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
202        f.debug_struct("ListLineItemsPaymentLinkBuilder").finish_non_exhaustive()
203    }
204}
205impl ListLineItemsPaymentLinkBuilder {
206    fn new() -> Self {
207        Self { ending_before: None, expand: None, limit: None, starting_after: None }
208    }
209}
210/// When retrieving a payment link, there is an includable **line_items** property containing the first handful of those items.
211/// There is also a URL where you can retrieve the full (paginated) list of line items.
212#[derive(Clone)]
213#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
214#[derive(serde::Serialize)]
215pub struct ListLineItemsPaymentLink {
216    inner: ListLineItemsPaymentLinkBuilder,
217    payment_link: stripe_shared::PaymentLinkId,
218}
219#[cfg(feature = "redact-generated-debug")]
220impl std::fmt::Debug for ListLineItemsPaymentLink {
221    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
222        f.debug_struct("ListLineItemsPaymentLink").finish_non_exhaustive()
223    }
224}
225impl ListLineItemsPaymentLink {
226    /// Construct a new `ListLineItemsPaymentLink`.
227    pub fn new(payment_link: impl Into<stripe_shared::PaymentLinkId>) -> Self {
228        Self { payment_link: payment_link.into(), inner: ListLineItemsPaymentLinkBuilder::new() }
229    }
230    /// A cursor for use in pagination.
231    /// `ending_before` is an object ID that defines your place in the list.
232    /// 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.
233    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
234        self.inner.ending_before = Some(ending_before.into());
235        self
236    }
237    /// Specifies which fields in the response should be expanded.
238    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
239        self.inner.expand = Some(expand.into());
240        self
241    }
242    /// A limit on the number of objects to be returned.
243    /// Limit can range between 1 and 100, and the default is 10.
244    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
245        self.inner.limit = Some(limit.into());
246        self
247    }
248    /// A cursor for use in pagination.
249    /// `starting_after` is an object ID that defines your place in the list.
250    /// 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.
251    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
252        self.inner.starting_after = Some(starting_after.into());
253        self
254    }
255}
256impl ListLineItemsPaymentLink {
257    /// Send the request and return the deserialized response.
258    pub async fn send<C: StripeClient>(
259        &self,
260        client: &C,
261    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
262        self.customize().send(client).await
263    }
264
265    /// Send the request and return the deserialized response, blocking until completion.
266    pub fn send_blocking<C: StripeBlockingClient>(
267        &self,
268        client: &C,
269    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
270        self.customize().send_blocking(client)
271    }
272
273    pub fn paginate(
274        &self,
275    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::CheckoutSessionItem>>
276    {
277        let payment_link = &self.payment_link;
278
279        stripe_client_core::ListPaginator::new_list(
280            format!("/payment_links/{payment_link}/line_items"),
281            &self.inner,
282        )
283    }
284}
285
286impl StripeRequest for ListLineItemsPaymentLink {
287    type Output = stripe_types::List<stripe_shared::CheckoutSessionItem>;
288
289    fn build(&self) -> RequestBuilder {
290        let payment_link = &self.payment_link;
291        RequestBuilder::new(StripeMethod::Get, format!("/payment_links/{payment_link}/line_items"))
292            .query(&self.inner)
293    }
294}
295#[derive(Clone)]
296#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
297#[derive(serde::Serialize)]
298struct CreatePaymentLinkBuilder {
299    #[serde(skip_serializing_if = "Option::is_none")]
300    after_completion: Option<CreatePaymentLinkAfterCompletion>,
301    #[serde(skip_serializing_if = "Option::is_none")]
302    allow_promotion_codes: Option<bool>,
303    #[serde(skip_serializing_if = "Option::is_none")]
304    application_fee_amount: Option<i64>,
305    #[serde(skip_serializing_if = "Option::is_none")]
306    application_fee_percent: Option<f64>,
307    #[serde(skip_serializing_if = "Option::is_none")]
308    automatic_tax: Option<CreatePaymentLinkAutomaticTax>,
309    #[serde(skip_serializing_if = "Option::is_none")]
310    billing_address_collection: Option<stripe_shared::PaymentLinkBillingAddressCollection>,
311    #[serde(skip_serializing_if = "Option::is_none")]
312    consent_collection: Option<CreatePaymentLinkConsentCollection>,
313    #[serde(skip_serializing_if = "Option::is_none")]
314    currency: Option<stripe_types::Currency>,
315    #[serde(skip_serializing_if = "Option::is_none")]
316    custom_fields: Option<Vec<CreatePaymentLinkCustomFields>>,
317    #[serde(skip_serializing_if = "Option::is_none")]
318    custom_text: Option<CustomTextParam>,
319    #[serde(skip_serializing_if = "Option::is_none")]
320    customer_creation: Option<CreatePaymentLinkCustomerCreation>,
321    #[serde(skip_serializing_if = "Option::is_none")]
322    expand: Option<Vec<String>>,
323    #[serde(skip_serializing_if = "Option::is_none")]
324    inactive_message: Option<String>,
325    #[serde(skip_serializing_if = "Option::is_none")]
326    invoice_creation: Option<CreatePaymentLinkInvoiceCreation>,
327    line_items: Vec<CreatePaymentLinkLineItems>,
328    #[serde(skip_serializing_if = "Option::is_none")]
329    metadata: Option<std::collections::HashMap<String, String>>,
330    #[serde(skip_serializing_if = "Option::is_none")]
331    name_collection: Option<NameCollectionParams>,
332    #[serde(skip_serializing_if = "Option::is_none")]
333    on_behalf_of: Option<String>,
334    #[serde(skip_serializing_if = "Option::is_none")]
335    optional_items: Option<Vec<OptionalItemParams>>,
336    #[serde(skip_serializing_if = "Option::is_none")]
337    payment_intent_data: Option<CreatePaymentLinkPaymentIntentData>,
338    #[serde(skip_serializing_if = "Option::is_none")]
339    payment_method_collection: Option<CreatePaymentLinkPaymentMethodCollection>,
340    #[serde(skip_serializing_if = "Option::is_none")]
341    payment_method_types: Option<Vec<stripe_shared::PaymentLinkPaymentMethodTypes>>,
342    #[serde(skip_serializing_if = "Option::is_none")]
343    phone_number_collection: Option<PhoneNumberCollectionParams>,
344    #[serde(skip_serializing_if = "Option::is_none")]
345    restrictions: Option<RestrictionsParams>,
346    #[serde(skip_serializing_if = "Option::is_none")]
347    shipping_address_collection: Option<CreatePaymentLinkShippingAddressCollection>,
348    #[serde(skip_serializing_if = "Option::is_none")]
349    shipping_options: Option<Vec<CreatePaymentLinkShippingOptions>>,
350    #[serde(skip_serializing_if = "Option::is_none")]
351    submit_type: Option<stripe_shared::PaymentLinkSubmitType>,
352    #[serde(skip_serializing_if = "Option::is_none")]
353    subscription_data: Option<CreatePaymentLinkSubscriptionData>,
354    #[serde(skip_serializing_if = "Option::is_none")]
355    tax_id_collection: Option<CreatePaymentLinkTaxIdCollection>,
356    #[serde(skip_serializing_if = "Option::is_none")]
357    transfer_data: Option<CreatePaymentLinkTransferData>,
358}
359#[cfg(feature = "redact-generated-debug")]
360impl std::fmt::Debug for CreatePaymentLinkBuilder {
361    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
362        f.debug_struct("CreatePaymentLinkBuilder").finish_non_exhaustive()
363    }
364}
365impl CreatePaymentLinkBuilder {
366    fn new(line_items: impl Into<Vec<CreatePaymentLinkLineItems>>) -> Self {
367        Self {
368            after_completion: None,
369            allow_promotion_codes: None,
370            application_fee_amount: None,
371            application_fee_percent: None,
372            automatic_tax: None,
373            billing_address_collection: None,
374            consent_collection: None,
375            currency: None,
376            custom_fields: None,
377            custom_text: None,
378            customer_creation: None,
379            expand: None,
380            inactive_message: None,
381            invoice_creation: None,
382            line_items: line_items.into(),
383            metadata: None,
384            name_collection: None,
385            on_behalf_of: None,
386            optional_items: None,
387            payment_intent_data: None,
388            payment_method_collection: None,
389            payment_method_types: None,
390            phone_number_collection: None,
391            restrictions: None,
392            shipping_address_collection: None,
393            shipping_options: None,
394            submit_type: None,
395            subscription_data: None,
396            tax_id_collection: None,
397            transfer_data: None,
398        }
399    }
400}
401/// Behavior after the purchase is complete.
402#[derive(Clone, Eq, PartialEq)]
403#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
404#[derive(serde::Serialize)]
405pub struct CreatePaymentLinkAfterCompletion {
406    /// Configuration when `type=hosted_confirmation`.
407    #[serde(skip_serializing_if = "Option::is_none")]
408    pub hosted_confirmation: Option<AfterCompletionConfirmationPageParams>,
409    /// Configuration when `type=redirect`.
410    #[serde(skip_serializing_if = "Option::is_none")]
411    pub redirect: Option<AfterCompletionRedirectParams>,
412    /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`.
413    #[serde(rename = "type")]
414    pub type_: CreatePaymentLinkAfterCompletionType,
415}
416#[cfg(feature = "redact-generated-debug")]
417impl std::fmt::Debug for CreatePaymentLinkAfterCompletion {
418    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
419        f.debug_struct("CreatePaymentLinkAfterCompletion").finish_non_exhaustive()
420    }
421}
422impl CreatePaymentLinkAfterCompletion {
423    pub fn new(type_: impl Into<CreatePaymentLinkAfterCompletionType>) -> Self {
424        Self { hosted_confirmation: None, redirect: None, type_: type_.into() }
425    }
426}
427/// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`.
428#[derive(Clone, Eq, PartialEq)]
429#[non_exhaustive]
430pub enum CreatePaymentLinkAfterCompletionType {
431    HostedConfirmation,
432    Redirect,
433    /// An unrecognized value from Stripe. Should not be used as a request parameter.
434    Unknown(String),
435}
436impl CreatePaymentLinkAfterCompletionType {
437    pub fn as_str(&self) -> &str {
438        use CreatePaymentLinkAfterCompletionType::*;
439        match self {
440            HostedConfirmation => "hosted_confirmation",
441            Redirect => "redirect",
442            Unknown(v) => v,
443        }
444    }
445}
446
447impl std::str::FromStr for CreatePaymentLinkAfterCompletionType {
448    type Err = std::convert::Infallible;
449    fn from_str(s: &str) -> Result<Self, Self::Err> {
450        use CreatePaymentLinkAfterCompletionType::*;
451        match s {
452            "hosted_confirmation" => Ok(HostedConfirmation),
453            "redirect" => Ok(Redirect),
454            v => {
455                tracing::warn!(
456                    "Unknown value '{}' for enum '{}'",
457                    v,
458                    "CreatePaymentLinkAfterCompletionType"
459                );
460                Ok(Unknown(v.to_owned()))
461            }
462        }
463    }
464}
465impl std::fmt::Display for CreatePaymentLinkAfterCompletionType {
466    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
467        f.write_str(self.as_str())
468    }
469}
470
471#[cfg(not(feature = "redact-generated-debug"))]
472impl std::fmt::Debug for CreatePaymentLinkAfterCompletionType {
473    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
474        f.write_str(self.as_str())
475    }
476}
477#[cfg(feature = "redact-generated-debug")]
478impl std::fmt::Debug for CreatePaymentLinkAfterCompletionType {
479    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
480        f.debug_struct(stringify!(CreatePaymentLinkAfterCompletionType)).finish_non_exhaustive()
481    }
482}
483impl serde::Serialize for CreatePaymentLinkAfterCompletionType {
484    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
485    where
486        S: serde::Serializer,
487    {
488        serializer.serialize_str(self.as_str())
489    }
490}
491#[cfg(feature = "deserialize")]
492impl<'de> serde::Deserialize<'de> for CreatePaymentLinkAfterCompletionType {
493    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
494        use std::str::FromStr;
495        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
496        Ok(Self::from_str(&s).expect("infallible"))
497    }
498}
499/// Configuration for automatic tax collection.
500#[derive(Clone, Eq, PartialEq)]
501#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
502#[derive(serde::Serialize)]
503pub struct CreatePaymentLinkAutomaticTax {
504    /// Set to `true` to [calculate tax automatically](https://docs.stripe.com/tax) using the customer's location.
505    ///
506    /// Enabling this parameter causes the payment link to collect any billing address information necessary for tax calculation.
507    pub enabled: bool,
508    /// The account that's liable for tax.
509    /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
510    /// The tax transaction is returned in the report of the connected account.
511    #[serde(skip_serializing_if = "Option::is_none")]
512    pub liability: Option<CreatePaymentLinkAutomaticTaxLiability>,
513}
514#[cfg(feature = "redact-generated-debug")]
515impl std::fmt::Debug for CreatePaymentLinkAutomaticTax {
516    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
517        f.debug_struct("CreatePaymentLinkAutomaticTax").finish_non_exhaustive()
518    }
519}
520impl CreatePaymentLinkAutomaticTax {
521    pub fn new(enabled: impl Into<bool>) -> Self {
522        Self { enabled: enabled.into(), liability: None }
523    }
524}
525/// The account that's liable for tax.
526/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
527/// The tax transaction is returned in the report of the connected account.
528#[derive(Clone, Eq, PartialEq)]
529#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
530#[derive(serde::Serialize)]
531pub struct CreatePaymentLinkAutomaticTaxLiability {
532    /// The connected account being referenced when `type` is `account`.
533    #[serde(skip_serializing_if = "Option::is_none")]
534    pub account: Option<String>,
535    /// Type of the account referenced in the request.
536    #[serde(rename = "type")]
537    pub type_: CreatePaymentLinkAutomaticTaxLiabilityType,
538}
539#[cfg(feature = "redact-generated-debug")]
540impl std::fmt::Debug for CreatePaymentLinkAutomaticTaxLiability {
541    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
542        f.debug_struct("CreatePaymentLinkAutomaticTaxLiability").finish_non_exhaustive()
543    }
544}
545impl CreatePaymentLinkAutomaticTaxLiability {
546    pub fn new(type_: impl Into<CreatePaymentLinkAutomaticTaxLiabilityType>) -> Self {
547        Self { account: None, type_: type_.into() }
548    }
549}
550/// Type of the account referenced in the request.
551#[derive(Clone, Eq, PartialEq)]
552#[non_exhaustive]
553pub enum CreatePaymentLinkAutomaticTaxLiabilityType {
554    Account,
555    Self_,
556    /// An unrecognized value from Stripe. Should not be used as a request parameter.
557    Unknown(String),
558}
559impl CreatePaymentLinkAutomaticTaxLiabilityType {
560    pub fn as_str(&self) -> &str {
561        use CreatePaymentLinkAutomaticTaxLiabilityType::*;
562        match self {
563            Account => "account",
564            Self_ => "self",
565            Unknown(v) => v,
566        }
567    }
568}
569
570impl std::str::FromStr for CreatePaymentLinkAutomaticTaxLiabilityType {
571    type Err = std::convert::Infallible;
572    fn from_str(s: &str) -> Result<Self, Self::Err> {
573        use CreatePaymentLinkAutomaticTaxLiabilityType::*;
574        match s {
575            "account" => Ok(Account),
576            "self" => Ok(Self_),
577            v => {
578                tracing::warn!(
579                    "Unknown value '{}' for enum '{}'",
580                    v,
581                    "CreatePaymentLinkAutomaticTaxLiabilityType"
582                );
583                Ok(Unknown(v.to_owned()))
584            }
585        }
586    }
587}
588impl std::fmt::Display for CreatePaymentLinkAutomaticTaxLiabilityType {
589    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
590        f.write_str(self.as_str())
591    }
592}
593
594#[cfg(not(feature = "redact-generated-debug"))]
595impl std::fmt::Debug for CreatePaymentLinkAutomaticTaxLiabilityType {
596    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
597        f.write_str(self.as_str())
598    }
599}
600#[cfg(feature = "redact-generated-debug")]
601impl std::fmt::Debug for CreatePaymentLinkAutomaticTaxLiabilityType {
602    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
603        f.debug_struct(stringify!(CreatePaymentLinkAutomaticTaxLiabilityType))
604            .finish_non_exhaustive()
605    }
606}
607impl serde::Serialize for CreatePaymentLinkAutomaticTaxLiabilityType {
608    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
609    where
610        S: serde::Serializer,
611    {
612        serializer.serialize_str(self.as_str())
613    }
614}
615#[cfg(feature = "deserialize")]
616impl<'de> serde::Deserialize<'de> for CreatePaymentLinkAutomaticTaxLiabilityType {
617    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
618        use std::str::FromStr;
619        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
620        Ok(Self::from_str(&s).expect("infallible"))
621    }
622}
623/// Configure fields to gather active consent from customers.
624#[derive(Clone, Eq, PartialEq)]
625#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
626#[derive(serde::Serialize)]
627pub struct CreatePaymentLinkConsentCollection {
628    /// Determines the display of payment method reuse agreement text in the UI.
629    /// If set to `hidden`, it will hide legal text related to the reuse of a payment method.
630    #[serde(skip_serializing_if = "Option::is_none")]
631    pub payment_method_reuse_agreement:
632        Option<CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement>,
633    /// If set to `auto`, enables the collection of customer consent for promotional communications.
634    /// The Checkout.
635    /// Session will determine whether to display an option to opt into promotional communication
636    /// from the merchant depending on the customer's locale. Only available to US merchants.
637    #[serde(skip_serializing_if = "Option::is_none")]
638    pub promotions: Option<CreatePaymentLinkConsentCollectionPromotions>,
639    /// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay.
640    /// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public).
641    #[serde(skip_serializing_if = "Option::is_none")]
642    pub terms_of_service: Option<CreatePaymentLinkConsentCollectionTermsOfService>,
643}
644#[cfg(feature = "redact-generated-debug")]
645impl std::fmt::Debug for CreatePaymentLinkConsentCollection {
646    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
647        f.debug_struct("CreatePaymentLinkConsentCollection").finish_non_exhaustive()
648    }
649}
650impl CreatePaymentLinkConsentCollection {
651    pub fn new() -> Self {
652        Self { payment_method_reuse_agreement: None, promotions: None, terms_of_service: None }
653    }
654}
655impl Default for CreatePaymentLinkConsentCollection {
656    fn default() -> Self {
657        Self::new()
658    }
659}
660/// Determines the display of payment method reuse agreement text in the UI.
661/// If set to `hidden`, it will hide legal text related to the reuse of a payment method.
662#[derive(Clone, Eq, PartialEq)]
663#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
664#[derive(serde::Serialize)]
665pub struct CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement {
666    /// Determines the position and visibility of the payment method reuse agreement in the UI.
667    /// When set to `auto`, Stripe's.
668    /// defaults will be used.
669    /// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI.
670    pub position: CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition,
671}
672#[cfg(feature = "redact-generated-debug")]
673impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement {
674    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
675        f.debug_struct("CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement")
676            .finish_non_exhaustive()
677    }
678}
679impl CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreement {
680    pub fn new(
681        position: impl Into<CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition>,
682    ) -> Self {
683        Self { position: position.into() }
684    }
685}
686/// Determines the position and visibility of the payment method reuse agreement in the UI.
687/// When set to `auto`, Stripe's.
688/// defaults will be used.
689/// When set to `hidden`, the payment method reuse agreement text will always be hidden in the UI.
690#[derive(Clone, Eq, PartialEq)]
691#[non_exhaustive]
692pub enum CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
693    Auto,
694    Hidden,
695    /// An unrecognized value from Stripe. Should not be used as a request parameter.
696    Unknown(String),
697}
698impl CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
699    pub fn as_str(&self) -> &str {
700        use CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition::*;
701        match self {
702            Auto => "auto",
703            Hidden => "hidden",
704            Unknown(v) => v,
705        }
706    }
707}
708
709impl std::str::FromStr for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
710    type Err = std::convert::Infallible;
711    fn from_str(s: &str) -> Result<Self, Self::Err> {
712        use CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition::*;
713        match s {
714            "auto" => Ok(Auto),
715            "hidden" => Ok(Hidden),
716            v => {
717                tracing::warn!(
718                    "Unknown value '{}' for enum '{}'",
719                    v,
720                    "CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition"
721                );
722                Ok(Unknown(v.to_owned()))
723            }
724        }
725    }
726}
727impl std::fmt::Display for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
728    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
729        f.write_str(self.as_str())
730    }
731}
732
733#[cfg(not(feature = "redact-generated-debug"))]
734impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
735    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
736        f.write_str(self.as_str())
737    }
738}
739#[cfg(feature = "redact-generated-debug")]
740impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
741    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
742        f.debug_struct(stringify!(
743            CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition
744        ))
745        .finish_non_exhaustive()
746    }
747}
748impl serde::Serialize for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition {
749    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
750    where
751        S: serde::Serializer,
752    {
753        serializer.serialize_str(self.as_str())
754    }
755}
756#[cfg(feature = "deserialize")]
757impl<'de> serde::Deserialize<'de>
758    for CreatePaymentLinkConsentCollectionPaymentMethodReuseAgreementPosition
759{
760    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
761        use std::str::FromStr;
762        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
763        Ok(Self::from_str(&s).expect("infallible"))
764    }
765}
766/// If set to `auto`, enables the collection of customer consent for promotional communications.
767/// The Checkout.
768/// Session will determine whether to display an option to opt into promotional communication
769/// from the merchant depending on the customer's locale. Only available to US merchants.
770#[derive(Clone, Eq, PartialEq)]
771#[non_exhaustive]
772pub enum CreatePaymentLinkConsentCollectionPromotions {
773    Auto,
774    None,
775    /// An unrecognized value from Stripe. Should not be used as a request parameter.
776    Unknown(String),
777}
778impl CreatePaymentLinkConsentCollectionPromotions {
779    pub fn as_str(&self) -> &str {
780        use CreatePaymentLinkConsentCollectionPromotions::*;
781        match self {
782            Auto => "auto",
783            None => "none",
784            Unknown(v) => v,
785        }
786    }
787}
788
789impl std::str::FromStr for CreatePaymentLinkConsentCollectionPromotions {
790    type Err = std::convert::Infallible;
791    fn from_str(s: &str) -> Result<Self, Self::Err> {
792        use CreatePaymentLinkConsentCollectionPromotions::*;
793        match s {
794            "auto" => Ok(Auto),
795            "none" => Ok(None),
796            v => {
797                tracing::warn!(
798                    "Unknown value '{}' for enum '{}'",
799                    v,
800                    "CreatePaymentLinkConsentCollectionPromotions"
801                );
802                Ok(Unknown(v.to_owned()))
803            }
804        }
805    }
806}
807impl std::fmt::Display for CreatePaymentLinkConsentCollectionPromotions {
808    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
809        f.write_str(self.as_str())
810    }
811}
812
813#[cfg(not(feature = "redact-generated-debug"))]
814impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPromotions {
815    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
816        f.write_str(self.as_str())
817    }
818}
819#[cfg(feature = "redact-generated-debug")]
820impl std::fmt::Debug for CreatePaymentLinkConsentCollectionPromotions {
821    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
822        f.debug_struct(stringify!(CreatePaymentLinkConsentCollectionPromotions))
823            .finish_non_exhaustive()
824    }
825}
826impl serde::Serialize for CreatePaymentLinkConsentCollectionPromotions {
827    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
828    where
829        S: serde::Serializer,
830    {
831        serializer.serialize_str(self.as_str())
832    }
833}
834#[cfg(feature = "deserialize")]
835impl<'de> serde::Deserialize<'de> for CreatePaymentLinkConsentCollectionPromotions {
836    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
837        use std::str::FromStr;
838        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
839        Ok(Self::from_str(&s).expect("infallible"))
840    }
841}
842/// If set to `required`, it requires customers to check a terms of service checkbox before being able to pay.
843/// There must be a valid terms of service URL set in your [Dashboard settings](https://dashboard.stripe.com/settings/public).
844#[derive(Clone, Eq, PartialEq)]
845#[non_exhaustive]
846pub enum CreatePaymentLinkConsentCollectionTermsOfService {
847    None,
848    Required,
849    /// An unrecognized value from Stripe. Should not be used as a request parameter.
850    Unknown(String),
851}
852impl CreatePaymentLinkConsentCollectionTermsOfService {
853    pub fn as_str(&self) -> &str {
854        use CreatePaymentLinkConsentCollectionTermsOfService::*;
855        match self {
856            None => "none",
857            Required => "required",
858            Unknown(v) => v,
859        }
860    }
861}
862
863impl std::str::FromStr for CreatePaymentLinkConsentCollectionTermsOfService {
864    type Err = std::convert::Infallible;
865    fn from_str(s: &str) -> Result<Self, Self::Err> {
866        use CreatePaymentLinkConsentCollectionTermsOfService::*;
867        match s {
868            "none" => Ok(None),
869            "required" => Ok(Required),
870            v => {
871                tracing::warn!(
872                    "Unknown value '{}' for enum '{}'",
873                    v,
874                    "CreatePaymentLinkConsentCollectionTermsOfService"
875                );
876                Ok(Unknown(v.to_owned()))
877            }
878        }
879    }
880}
881impl std::fmt::Display for CreatePaymentLinkConsentCollectionTermsOfService {
882    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
883        f.write_str(self.as_str())
884    }
885}
886
887#[cfg(not(feature = "redact-generated-debug"))]
888impl std::fmt::Debug for CreatePaymentLinkConsentCollectionTermsOfService {
889    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
890        f.write_str(self.as_str())
891    }
892}
893#[cfg(feature = "redact-generated-debug")]
894impl std::fmt::Debug for CreatePaymentLinkConsentCollectionTermsOfService {
895    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
896        f.debug_struct(stringify!(CreatePaymentLinkConsentCollectionTermsOfService))
897            .finish_non_exhaustive()
898    }
899}
900impl serde::Serialize for CreatePaymentLinkConsentCollectionTermsOfService {
901    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
902    where
903        S: serde::Serializer,
904    {
905        serializer.serialize_str(self.as_str())
906    }
907}
908#[cfg(feature = "deserialize")]
909impl<'de> serde::Deserialize<'de> for CreatePaymentLinkConsentCollectionTermsOfService {
910    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
911        use std::str::FromStr;
912        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
913        Ok(Self::from_str(&s).expect("infallible"))
914    }
915}
916/// Collect additional information from your customer using custom fields.
917/// Up to 3 fields are supported.
918/// You can't set this parameter if `ui_mode` is `custom`.
919#[derive(Clone, Eq, PartialEq)]
920#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
921#[derive(serde::Serialize)]
922pub struct CreatePaymentLinkCustomFields {
923    /// Configuration for `type=dropdown` fields.
924    #[serde(skip_serializing_if = "Option::is_none")]
925    pub dropdown: Option<CustomFieldDropdownParam>,
926    /// String of your choice that your integration can use to reconcile this field.
927    /// Must be unique to this field, alphanumeric, and up to 200 characters.
928    pub key: String,
929    /// The label for the field, displayed to the customer.
930    pub label: CreatePaymentLinkCustomFieldsLabel,
931    /// Configuration for `type=numeric` fields.
932    #[serde(skip_serializing_if = "Option::is_none")]
933    pub numeric: Option<CreatePaymentLinkCustomFieldsNumeric>,
934    /// Whether the customer is required to complete the field before completing the Checkout Session.
935    /// Defaults to `false`.
936    #[serde(skip_serializing_if = "Option::is_none")]
937    pub optional: Option<bool>,
938    /// Configuration for `type=text` fields.
939    #[serde(skip_serializing_if = "Option::is_none")]
940    pub text: Option<CreatePaymentLinkCustomFieldsText>,
941    /// The type of the field.
942    #[serde(rename = "type")]
943    pub type_: CreatePaymentLinkCustomFieldsType,
944}
945#[cfg(feature = "redact-generated-debug")]
946impl std::fmt::Debug for CreatePaymentLinkCustomFields {
947    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
948        f.debug_struct("CreatePaymentLinkCustomFields").finish_non_exhaustive()
949    }
950}
951impl CreatePaymentLinkCustomFields {
952    pub fn new(
953        key: impl Into<String>,
954        label: impl Into<CreatePaymentLinkCustomFieldsLabel>,
955        type_: impl Into<CreatePaymentLinkCustomFieldsType>,
956    ) -> Self {
957        Self {
958            dropdown: None,
959            key: key.into(),
960            label: label.into(),
961            numeric: None,
962            optional: None,
963            text: None,
964            type_: type_.into(),
965        }
966    }
967}
968/// The label for the field, displayed to the customer.
969#[derive(Clone, Eq, PartialEq)]
970#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
971#[derive(serde::Serialize)]
972pub struct CreatePaymentLinkCustomFieldsLabel {
973    /// Custom text for the label, displayed to the customer. Up to 50 characters.
974    pub custom: String,
975    /// The type of the label.
976    #[serde(rename = "type")]
977    pub type_: CreatePaymentLinkCustomFieldsLabelType,
978}
979#[cfg(feature = "redact-generated-debug")]
980impl std::fmt::Debug for CreatePaymentLinkCustomFieldsLabel {
981    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
982        f.debug_struct("CreatePaymentLinkCustomFieldsLabel").finish_non_exhaustive()
983    }
984}
985impl CreatePaymentLinkCustomFieldsLabel {
986    pub fn new(
987        custom: impl Into<String>,
988        type_: impl Into<CreatePaymentLinkCustomFieldsLabelType>,
989    ) -> Self {
990        Self { custom: custom.into(), type_: type_.into() }
991    }
992}
993/// The type of the label.
994#[derive(Clone, Eq, PartialEq)]
995#[non_exhaustive]
996pub enum CreatePaymentLinkCustomFieldsLabelType {
997    Custom,
998    /// An unrecognized value from Stripe. Should not be used as a request parameter.
999    Unknown(String),
1000}
1001impl CreatePaymentLinkCustomFieldsLabelType {
1002    pub fn as_str(&self) -> &str {
1003        use CreatePaymentLinkCustomFieldsLabelType::*;
1004        match self {
1005            Custom => "custom",
1006            Unknown(v) => v,
1007        }
1008    }
1009}
1010
1011impl std::str::FromStr for CreatePaymentLinkCustomFieldsLabelType {
1012    type Err = std::convert::Infallible;
1013    fn from_str(s: &str) -> Result<Self, Self::Err> {
1014        use CreatePaymentLinkCustomFieldsLabelType::*;
1015        match s {
1016            "custom" => Ok(Custom),
1017            v => {
1018                tracing::warn!(
1019                    "Unknown value '{}' for enum '{}'",
1020                    v,
1021                    "CreatePaymentLinkCustomFieldsLabelType"
1022                );
1023                Ok(Unknown(v.to_owned()))
1024            }
1025        }
1026    }
1027}
1028impl std::fmt::Display for CreatePaymentLinkCustomFieldsLabelType {
1029    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1030        f.write_str(self.as_str())
1031    }
1032}
1033
1034#[cfg(not(feature = "redact-generated-debug"))]
1035impl std::fmt::Debug for CreatePaymentLinkCustomFieldsLabelType {
1036    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1037        f.write_str(self.as_str())
1038    }
1039}
1040#[cfg(feature = "redact-generated-debug")]
1041impl std::fmt::Debug for CreatePaymentLinkCustomFieldsLabelType {
1042    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1043        f.debug_struct(stringify!(CreatePaymentLinkCustomFieldsLabelType)).finish_non_exhaustive()
1044    }
1045}
1046impl serde::Serialize for CreatePaymentLinkCustomFieldsLabelType {
1047    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1048    where
1049        S: serde::Serializer,
1050    {
1051        serializer.serialize_str(self.as_str())
1052    }
1053}
1054#[cfg(feature = "deserialize")]
1055impl<'de> serde::Deserialize<'de> for CreatePaymentLinkCustomFieldsLabelType {
1056    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1057        use std::str::FromStr;
1058        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1059        Ok(Self::from_str(&s).expect("infallible"))
1060    }
1061}
1062/// Configuration for `type=numeric` fields.
1063#[derive(Clone, Eq, PartialEq)]
1064#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1065#[derive(serde::Serialize)]
1066pub struct CreatePaymentLinkCustomFieldsNumeric {
1067    /// The value that pre-fills the field on the payment page.
1068    #[serde(skip_serializing_if = "Option::is_none")]
1069    pub default_value: Option<String>,
1070    /// The maximum character length constraint for the customer's input.
1071    #[serde(skip_serializing_if = "Option::is_none")]
1072    pub maximum_length: Option<i64>,
1073    /// The minimum character length requirement for the customer's input.
1074    #[serde(skip_serializing_if = "Option::is_none")]
1075    pub minimum_length: Option<i64>,
1076}
1077#[cfg(feature = "redact-generated-debug")]
1078impl std::fmt::Debug for CreatePaymentLinkCustomFieldsNumeric {
1079    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1080        f.debug_struct("CreatePaymentLinkCustomFieldsNumeric").finish_non_exhaustive()
1081    }
1082}
1083impl CreatePaymentLinkCustomFieldsNumeric {
1084    pub fn new() -> Self {
1085        Self { default_value: None, maximum_length: None, minimum_length: None }
1086    }
1087}
1088impl Default for CreatePaymentLinkCustomFieldsNumeric {
1089    fn default() -> Self {
1090        Self::new()
1091    }
1092}
1093/// Configuration for `type=text` fields.
1094#[derive(Clone, Eq, PartialEq)]
1095#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1096#[derive(serde::Serialize)]
1097pub struct CreatePaymentLinkCustomFieldsText {
1098    /// The value that pre-fills the field on the payment page.
1099    #[serde(skip_serializing_if = "Option::is_none")]
1100    pub default_value: Option<String>,
1101    /// The maximum character length constraint for the customer's input.
1102    #[serde(skip_serializing_if = "Option::is_none")]
1103    pub maximum_length: Option<i64>,
1104    /// The minimum character length requirement for the customer's input.
1105    #[serde(skip_serializing_if = "Option::is_none")]
1106    pub minimum_length: Option<i64>,
1107}
1108#[cfg(feature = "redact-generated-debug")]
1109impl std::fmt::Debug for CreatePaymentLinkCustomFieldsText {
1110    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1111        f.debug_struct("CreatePaymentLinkCustomFieldsText").finish_non_exhaustive()
1112    }
1113}
1114impl CreatePaymentLinkCustomFieldsText {
1115    pub fn new() -> Self {
1116        Self { default_value: None, maximum_length: None, minimum_length: None }
1117    }
1118}
1119impl Default for CreatePaymentLinkCustomFieldsText {
1120    fn default() -> Self {
1121        Self::new()
1122    }
1123}
1124/// The type of the field.
1125#[derive(Clone, Eq, PartialEq)]
1126#[non_exhaustive]
1127pub enum CreatePaymentLinkCustomFieldsType {
1128    Dropdown,
1129    Numeric,
1130    Text,
1131    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1132    Unknown(String),
1133}
1134impl CreatePaymentLinkCustomFieldsType {
1135    pub fn as_str(&self) -> &str {
1136        use CreatePaymentLinkCustomFieldsType::*;
1137        match self {
1138            Dropdown => "dropdown",
1139            Numeric => "numeric",
1140            Text => "text",
1141            Unknown(v) => v,
1142        }
1143    }
1144}
1145
1146impl std::str::FromStr for CreatePaymentLinkCustomFieldsType {
1147    type Err = std::convert::Infallible;
1148    fn from_str(s: &str) -> Result<Self, Self::Err> {
1149        use CreatePaymentLinkCustomFieldsType::*;
1150        match s {
1151            "dropdown" => Ok(Dropdown),
1152            "numeric" => Ok(Numeric),
1153            "text" => Ok(Text),
1154            v => {
1155                tracing::warn!(
1156                    "Unknown value '{}' for enum '{}'",
1157                    v,
1158                    "CreatePaymentLinkCustomFieldsType"
1159                );
1160                Ok(Unknown(v.to_owned()))
1161            }
1162        }
1163    }
1164}
1165impl std::fmt::Display for CreatePaymentLinkCustomFieldsType {
1166    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1167        f.write_str(self.as_str())
1168    }
1169}
1170
1171#[cfg(not(feature = "redact-generated-debug"))]
1172impl std::fmt::Debug for CreatePaymentLinkCustomFieldsType {
1173    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1174        f.write_str(self.as_str())
1175    }
1176}
1177#[cfg(feature = "redact-generated-debug")]
1178impl std::fmt::Debug for CreatePaymentLinkCustomFieldsType {
1179    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1180        f.debug_struct(stringify!(CreatePaymentLinkCustomFieldsType)).finish_non_exhaustive()
1181    }
1182}
1183impl serde::Serialize for CreatePaymentLinkCustomFieldsType {
1184    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1185    where
1186        S: serde::Serializer,
1187    {
1188        serializer.serialize_str(self.as_str())
1189    }
1190}
1191#[cfg(feature = "deserialize")]
1192impl<'de> serde::Deserialize<'de> for CreatePaymentLinkCustomFieldsType {
1193    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1194        use std::str::FromStr;
1195        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1196        Ok(Self::from_str(&s).expect("infallible"))
1197    }
1198}
1199/// Configures whether [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link create a [Customer](https://docs.stripe.com/api/customers).
1200#[derive(Clone, Eq, PartialEq)]
1201#[non_exhaustive]
1202pub enum CreatePaymentLinkCustomerCreation {
1203    Always,
1204    IfRequired,
1205    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1206    Unknown(String),
1207}
1208impl CreatePaymentLinkCustomerCreation {
1209    pub fn as_str(&self) -> &str {
1210        use CreatePaymentLinkCustomerCreation::*;
1211        match self {
1212            Always => "always",
1213            IfRequired => "if_required",
1214            Unknown(v) => v,
1215        }
1216    }
1217}
1218
1219impl std::str::FromStr for CreatePaymentLinkCustomerCreation {
1220    type Err = std::convert::Infallible;
1221    fn from_str(s: &str) -> Result<Self, Self::Err> {
1222        use CreatePaymentLinkCustomerCreation::*;
1223        match s {
1224            "always" => Ok(Always),
1225            "if_required" => Ok(IfRequired),
1226            v => {
1227                tracing::warn!(
1228                    "Unknown value '{}' for enum '{}'",
1229                    v,
1230                    "CreatePaymentLinkCustomerCreation"
1231                );
1232                Ok(Unknown(v.to_owned()))
1233            }
1234        }
1235    }
1236}
1237impl std::fmt::Display for CreatePaymentLinkCustomerCreation {
1238    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1239        f.write_str(self.as_str())
1240    }
1241}
1242
1243#[cfg(not(feature = "redact-generated-debug"))]
1244impl std::fmt::Debug for CreatePaymentLinkCustomerCreation {
1245    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1246        f.write_str(self.as_str())
1247    }
1248}
1249#[cfg(feature = "redact-generated-debug")]
1250impl std::fmt::Debug for CreatePaymentLinkCustomerCreation {
1251    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1252        f.debug_struct(stringify!(CreatePaymentLinkCustomerCreation)).finish_non_exhaustive()
1253    }
1254}
1255impl serde::Serialize for CreatePaymentLinkCustomerCreation {
1256    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1257    where
1258        S: serde::Serializer,
1259    {
1260        serializer.serialize_str(self.as_str())
1261    }
1262}
1263#[cfg(feature = "deserialize")]
1264impl<'de> serde::Deserialize<'de> for CreatePaymentLinkCustomerCreation {
1265    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1266        use std::str::FromStr;
1267        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1268        Ok(Self::from_str(&s).expect("infallible"))
1269    }
1270}
1271/// Generate a post-purchase Invoice for one-time payments.
1272#[derive(Clone)]
1273#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1274#[derive(serde::Serialize)]
1275pub struct CreatePaymentLinkInvoiceCreation {
1276    /// Whether the feature is enabled
1277    pub enabled: bool,
1278    /// Invoice PDF configuration.
1279    #[serde(skip_serializing_if = "Option::is_none")]
1280    pub invoice_data: Option<CreatePaymentLinkInvoiceCreationInvoiceData>,
1281}
1282#[cfg(feature = "redact-generated-debug")]
1283impl std::fmt::Debug for CreatePaymentLinkInvoiceCreation {
1284    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1285        f.debug_struct("CreatePaymentLinkInvoiceCreation").finish_non_exhaustive()
1286    }
1287}
1288impl CreatePaymentLinkInvoiceCreation {
1289    pub fn new(enabled: impl Into<bool>) -> Self {
1290        Self { enabled: enabled.into(), invoice_data: None }
1291    }
1292}
1293/// Invoice PDF configuration.
1294#[derive(Clone)]
1295#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1296#[derive(serde::Serialize)]
1297pub struct CreatePaymentLinkInvoiceCreationInvoiceData {
1298    /// The account tax IDs associated with the invoice.
1299    #[serde(skip_serializing_if = "Option::is_none")]
1300    pub account_tax_ids: Option<Vec<String>>,
1301    /// Default custom fields to be displayed on invoices for this customer.
1302    #[serde(skip_serializing_if = "Option::is_none")]
1303    pub custom_fields: Option<Vec<CustomFieldParams>>,
1304    /// An arbitrary string attached to the object. Often useful for displaying to users.
1305    #[serde(skip_serializing_if = "Option::is_none")]
1306    pub description: Option<String>,
1307    /// Default footer to be displayed on invoices for this customer.
1308    #[serde(skip_serializing_if = "Option::is_none")]
1309    pub footer: Option<String>,
1310    /// The connected account that issues the invoice.
1311    /// The invoice is presented with the branding and support information of the specified account.
1312    #[serde(skip_serializing_if = "Option::is_none")]
1313    pub issuer: Option<CreatePaymentLinkInvoiceCreationInvoiceDataIssuer>,
1314    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
1315    /// This can be useful for storing additional information about the object in a structured format.
1316    /// Individual keys can be unset by posting an empty value to them.
1317    /// All keys can be unset by posting an empty value to `metadata`.
1318    #[serde(skip_serializing_if = "Option::is_none")]
1319    pub metadata: Option<std::collections::HashMap<String, String>>,
1320    /// Default options for invoice PDF rendering for this customer.
1321    #[serde(skip_serializing_if = "Option::is_none")]
1322    pub rendering_options: Option<CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions>,
1323}
1324#[cfg(feature = "redact-generated-debug")]
1325impl std::fmt::Debug for CreatePaymentLinkInvoiceCreationInvoiceData {
1326    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1327        f.debug_struct("CreatePaymentLinkInvoiceCreationInvoiceData").finish_non_exhaustive()
1328    }
1329}
1330impl CreatePaymentLinkInvoiceCreationInvoiceData {
1331    pub fn new() -> Self {
1332        Self {
1333            account_tax_ids: None,
1334            custom_fields: None,
1335            description: None,
1336            footer: None,
1337            issuer: None,
1338            metadata: None,
1339            rendering_options: None,
1340        }
1341    }
1342}
1343impl Default for CreatePaymentLinkInvoiceCreationInvoiceData {
1344    fn default() -> Self {
1345        Self::new()
1346    }
1347}
1348/// The connected account that issues the invoice.
1349/// The invoice is presented with the branding and support information of the specified account.
1350#[derive(Clone, Eq, PartialEq)]
1351#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1352#[derive(serde::Serialize)]
1353pub struct CreatePaymentLinkInvoiceCreationInvoiceDataIssuer {
1354    /// The connected account being referenced when `type` is `account`.
1355    #[serde(skip_serializing_if = "Option::is_none")]
1356    pub account: Option<String>,
1357    /// Type of the account referenced in the request.
1358    #[serde(rename = "type")]
1359    pub type_: CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType,
1360}
1361#[cfg(feature = "redact-generated-debug")]
1362impl std::fmt::Debug for CreatePaymentLinkInvoiceCreationInvoiceDataIssuer {
1363    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1364        f.debug_struct("CreatePaymentLinkInvoiceCreationInvoiceDataIssuer").finish_non_exhaustive()
1365    }
1366}
1367impl CreatePaymentLinkInvoiceCreationInvoiceDataIssuer {
1368    pub fn new(type_: impl Into<CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType>) -> Self {
1369        Self { account: None, type_: type_.into() }
1370    }
1371}
1372/// Type of the account referenced in the request.
1373#[derive(Clone, Eq, PartialEq)]
1374#[non_exhaustive]
1375pub enum CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1376    Account,
1377    Self_,
1378    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1379    Unknown(String),
1380}
1381impl CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1382    pub fn as_str(&self) -> &str {
1383        use CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*;
1384        match self {
1385            Account => "account",
1386            Self_ => "self",
1387            Unknown(v) => v,
1388        }
1389    }
1390}
1391
1392impl std::str::FromStr for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1393    type Err = std::convert::Infallible;
1394    fn from_str(s: &str) -> Result<Self, Self::Err> {
1395        use CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*;
1396        match s {
1397            "account" => Ok(Account),
1398            "self" => Ok(Self_),
1399            v => {
1400                tracing::warn!(
1401                    "Unknown value '{}' for enum '{}'",
1402                    v,
1403                    "CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType"
1404                );
1405                Ok(Unknown(v.to_owned()))
1406            }
1407        }
1408    }
1409}
1410impl std::fmt::Display for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1411    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1412        f.write_str(self.as_str())
1413    }
1414}
1415
1416#[cfg(not(feature = "redact-generated-debug"))]
1417impl std::fmt::Debug for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1418    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1419        f.write_str(self.as_str())
1420    }
1421}
1422#[cfg(feature = "redact-generated-debug")]
1423impl std::fmt::Debug for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1424    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1425        f.debug_struct(stringify!(CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType))
1426            .finish_non_exhaustive()
1427    }
1428}
1429impl serde::Serialize for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1430    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1431    where
1432        S: serde::Serializer,
1433    {
1434        serializer.serialize_str(self.as_str())
1435    }
1436}
1437#[cfg(feature = "deserialize")]
1438impl<'de> serde::Deserialize<'de> for CreatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
1439    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1440        use std::str::FromStr;
1441        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1442        Ok(Self::from_str(&s).expect("infallible"))
1443    }
1444}
1445/// Default options for invoice PDF rendering for this customer.
1446#[derive(Clone, Eq, PartialEq)]
1447#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1448#[derive(serde::Serialize)]
1449pub struct CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
1450    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
1451    /// One of `exclude_tax` or `include_inclusive_tax`.
1452    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
1453    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
1454    #[serde(skip_serializing_if = "Option::is_none")]
1455    pub amount_tax_display:
1456        Option<CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay>,
1457    /// ID of the invoice rendering template to use for this invoice.
1458    #[serde(skip_serializing_if = "Option::is_none")]
1459    pub template: Option<String>,
1460}
1461#[cfg(feature = "redact-generated-debug")]
1462impl std::fmt::Debug for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
1463    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1464        f.debug_struct("CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions")
1465            .finish_non_exhaustive()
1466    }
1467}
1468impl CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
1469    pub fn new() -> Self {
1470        Self { amount_tax_display: None, template: None }
1471    }
1472}
1473impl Default for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
1474    fn default() -> Self {
1475        Self::new()
1476    }
1477}
1478/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
1479/// One of `exclude_tax` or `include_inclusive_tax`.
1480/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
1481/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
1482#[derive(Clone, Eq, PartialEq)]
1483#[non_exhaustive]
1484pub enum CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay {
1485    ExcludeTax,
1486    IncludeInclusiveTax,
1487    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1488    Unknown(String),
1489}
1490impl CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay {
1491    pub fn as_str(&self) -> &str {
1492        use CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*;
1493        match self {
1494            ExcludeTax => "exclude_tax",
1495            IncludeInclusiveTax => "include_inclusive_tax",
1496            Unknown(v) => v,
1497        }
1498    }
1499}
1500
1501impl std::str::FromStr
1502    for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1503{
1504    type Err = std::convert::Infallible;
1505    fn from_str(s: &str) -> Result<Self, Self::Err> {
1506        use CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*;
1507        match s {
1508            "exclude_tax" => Ok(ExcludeTax),
1509            "include_inclusive_tax" => Ok(IncludeInclusiveTax),
1510            v => {
1511                tracing::warn!(
1512                    "Unknown value '{}' for enum '{}'",
1513                    v,
1514                    "CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay"
1515                );
1516                Ok(Unknown(v.to_owned()))
1517            }
1518        }
1519    }
1520}
1521impl std::fmt::Display
1522    for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1523{
1524    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1525        f.write_str(self.as_str())
1526    }
1527}
1528
1529#[cfg(not(feature = "redact-generated-debug"))]
1530impl std::fmt::Debug
1531    for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1532{
1533    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1534        f.write_str(self.as_str())
1535    }
1536}
1537#[cfg(feature = "redact-generated-debug")]
1538impl std::fmt::Debug
1539    for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1540{
1541    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1542        f.debug_struct(stringify!(
1543            CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1544        ))
1545        .finish_non_exhaustive()
1546    }
1547}
1548impl serde::Serialize
1549    for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1550{
1551    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1552    where
1553        S: serde::Serializer,
1554    {
1555        serializer.serialize_str(self.as_str())
1556    }
1557}
1558#[cfg(feature = "deserialize")]
1559impl<'de> serde::Deserialize<'de>
1560    for CreatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
1561{
1562    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1563        use std::str::FromStr;
1564        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1565        Ok(Self::from_str(&s).expect("infallible"))
1566    }
1567}
1568/// The line items representing what is being sold.
1569/// Each line item represents an item being sold.
1570/// Up to 20 line items are supported.
1571#[derive(Clone)]
1572#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1573#[derive(serde::Serialize)]
1574pub struct CreatePaymentLinkLineItems {
1575    /// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout.
1576    #[serde(skip_serializing_if = "Option::is_none")]
1577    pub adjustable_quantity: Option<AdjustableQuantityParams>,
1578    /// The ID of the [Price](https://docs.stripe.com/api/prices) or [Plan](https://docs.stripe.com/api/plans) object.
1579    /// One of `price` or `price_data` is required.
1580    #[serde(skip_serializing_if = "Option::is_none")]
1581    pub price: Option<String>,
1582    /// Data used to generate a new [Price](https://docs.stripe.com/api/prices) object inline.
1583    /// One of `price` or `price_data` is required.
1584    #[serde(skip_serializing_if = "Option::is_none")]
1585    pub price_data: Option<CreatePaymentLinkLineItemsPriceData>,
1586    /// The quantity of the line item being purchased.
1587    pub quantity: u64,
1588}
1589#[cfg(feature = "redact-generated-debug")]
1590impl std::fmt::Debug for CreatePaymentLinkLineItems {
1591    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1592        f.debug_struct("CreatePaymentLinkLineItems").finish_non_exhaustive()
1593    }
1594}
1595impl CreatePaymentLinkLineItems {
1596    pub fn new(quantity: impl Into<u64>) -> Self {
1597        Self { adjustable_quantity: None, price: None, price_data: None, quantity: quantity.into() }
1598    }
1599}
1600/// Data used to generate a new [Price](https://docs.stripe.com/api/prices) object inline.
1601/// One of `price` or `price_data` is required.
1602#[derive(Clone)]
1603#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1604#[derive(serde::Serialize)]
1605pub struct CreatePaymentLinkLineItemsPriceData {
1606    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
1607    /// Must be a [supported currency](https://stripe.com/docs/currencies).
1608    pub currency: stripe_types::Currency,
1609    /// The ID of the [Product](https://docs.stripe.com/api/products) that this [Price](https://docs.stripe.com/api/prices) will belong to.
1610    /// One of `product` or `product_data` is required.
1611    #[serde(skip_serializing_if = "Option::is_none")]
1612    pub product: Option<String>,
1613    /// Data used to generate a new [Product](https://docs.stripe.com/api/products) object inline.
1614    /// One of `product` or `product_data` is required.
1615    #[serde(skip_serializing_if = "Option::is_none")]
1616    pub product_data: Option<CreatePaymentLinkLineItemsPriceDataProductData>,
1617    /// The recurring components of a price such as `interval` and `interval_count`.
1618    #[serde(skip_serializing_if = "Option::is_none")]
1619    pub recurring: Option<CreatePaymentLinkLineItemsPriceDataRecurring>,
1620    /// Only required if a [default tax behavior](https://docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
1621    /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
1622    /// One of `inclusive`, `exclusive`, or `unspecified`.
1623    /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1624    #[serde(skip_serializing_if = "Option::is_none")]
1625    pub tax_behavior: Option<CreatePaymentLinkLineItemsPriceDataTaxBehavior>,
1626    /// A non-negative integer in cents (or local equivalent) representing how much to charge.
1627    /// One of `unit_amount` or `unit_amount_decimal` is required.
1628    #[serde(skip_serializing_if = "Option::is_none")]
1629    pub unit_amount: Option<i64>,
1630    /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
1631    /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
1632    #[serde(skip_serializing_if = "Option::is_none")]
1633    pub unit_amount_decimal: Option<String>,
1634}
1635#[cfg(feature = "redact-generated-debug")]
1636impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceData {
1637    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1638        f.debug_struct("CreatePaymentLinkLineItemsPriceData").finish_non_exhaustive()
1639    }
1640}
1641impl CreatePaymentLinkLineItemsPriceData {
1642    pub fn new(currency: impl Into<stripe_types::Currency>) -> Self {
1643        Self {
1644            currency: currency.into(),
1645            product: None,
1646            product_data: None,
1647            recurring: None,
1648            tax_behavior: None,
1649            unit_amount: None,
1650            unit_amount_decimal: None,
1651        }
1652    }
1653}
1654/// Data used to generate a new [Product](https://docs.stripe.com/api/products) object inline.
1655/// One of `product` or `product_data` is required.
1656#[derive(Clone)]
1657#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1658#[derive(serde::Serialize)]
1659pub struct CreatePaymentLinkLineItemsPriceDataProductData {
1660    /// The product's description, meant to be displayable to the customer.
1661    /// Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
1662    #[serde(skip_serializing_if = "Option::is_none")]
1663    pub description: Option<String>,
1664    /// A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
1665    #[serde(skip_serializing_if = "Option::is_none")]
1666    pub images: Option<Vec<String>>,
1667    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
1668    /// This can be useful for storing additional information about the object in a structured format.
1669    /// Individual keys can be unset by posting an empty value to them.
1670    /// All keys can be unset by posting an empty value to `metadata`.
1671    #[serde(skip_serializing_if = "Option::is_none")]
1672    pub metadata: Option<std::collections::HashMap<String, String>>,
1673    /// The product's name, meant to be displayable to the customer.
1674    pub name: String,
1675    /// A [tax code](https://docs.stripe.com/tax/tax-categories) ID.
1676    #[serde(skip_serializing_if = "Option::is_none")]
1677    pub tax_code: Option<String>,
1678    /// A label that represents units of this product.
1679    /// When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal.
1680    #[serde(skip_serializing_if = "Option::is_none")]
1681    pub unit_label: Option<String>,
1682}
1683#[cfg(feature = "redact-generated-debug")]
1684impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceDataProductData {
1685    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1686        f.debug_struct("CreatePaymentLinkLineItemsPriceDataProductData").finish_non_exhaustive()
1687    }
1688}
1689impl CreatePaymentLinkLineItemsPriceDataProductData {
1690    pub fn new(name: impl Into<String>) -> Self {
1691        Self {
1692            description: None,
1693            images: None,
1694            metadata: None,
1695            name: name.into(),
1696            tax_code: None,
1697            unit_label: None,
1698        }
1699    }
1700}
1701/// The recurring components of a price such as `interval` and `interval_count`.
1702#[derive(Clone, Eq, PartialEq)]
1703#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1704#[derive(serde::Serialize)]
1705pub struct CreatePaymentLinkLineItemsPriceDataRecurring {
1706    /// Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1707    pub interval: CreatePaymentLinkLineItemsPriceDataRecurringInterval,
1708    /// The number of intervals between subscription billings.
1709    /// For example, `interval=month` and `interval_count=3` bills every 3 months.
1710    /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1711    #[serde(skip_serializing_if = "Option::is_none")]
1712    pub interval_count: Option<u64>,
1713}
1714#[cfg(feature = "redact-generated-debug")]
1715impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceDataRecurring {
1716    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1717        f.debug_struct("CreatePaymentLinkLineItemsPriceDataRecurring").finish_non_exhaustive()
1718    }
1719}
1720impl CreatePaymentLinkLineItemsPriceDataRecurring {
1721    pub fn new(interval: impl Into<CreatePaymentLinkLineItemsPriceDataRecurringInterval>) -> Self {
1722        Self { interval: interval.into(), interval_count: None }
1723    }
1724}
1725/// Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1726#[derive(Clone, Eq, PartialEq)]
1727#[non_exhaustive]
1728pub enum CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1729    Day,
1730    Month,
1731    Week,
1732    Year,
1733    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1734    Unknown(String),
1735}
1736impl CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1737    pub fn as_str(&self) -> &str {
1738        use CreatePaymentLinkLineItemsPriceDataRecurringInterval::*;
1739        match self {
1740            Day => "day",
1741            Month => "month",
1742            Week => "week",
1743            Year => "year",
1744            Unknown(v) => v,
1745        }
1746    }
1747}
1748
1749impl std::str::FromStr for CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1750    type Err = std::convert::Infallible;
1751    fn from_str(s: &str) -> Result<Self, Self::Err> {
1752        use CreatePaymentLinkLineItemsPriceDataRecurringInterval::*;
1753        match s {
1754            "day" => Ok(Day),
1755            "month" => Ok(Month),
1756            "week" => Ok(Week),
1757            "year" => Ok(Year),
1758            v => {
1759                tracing::warn!(
1760                    "Unknown value '{}' for enum '{}'",
1761                    v,
1762                    "CreatePaymentLinkLineItemsPriceDataRecurringInterval"
1763                );
1764                Ok(Unknown(v.to_owned()))
1765            }
1766        }
1767    }
1768}
1769impl std::fmt::Display for CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1770    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1771        f.write_str(self.as_str())
1772    }
1773}
1774
1775#[cfg(not(feature = "redact-generated-debug"))]
1776impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1777    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1778        f.write_str(self.as_str())
1779    }
1780}
1781#[cfg(feature = "redact-generated-debug")]
1782impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1783    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1784        f.debug_struct(stringify!(CreatePaymentLinkLineItemsPriceDataRecurringInterval))
1785            .finish_non_exhaustive()
1786    }
1787}
1788impl serde::Serialize for CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1789    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1790    where
1791        S: serde::Serializer,
1792    {
1793        serializer.serialize_str(self.as_str())
1794    }
1795}
1796#[cfg(feature = "deserialize")]
1797impl<'de> serde::Deserialize<'de> for CreatePaymentLinkLineItemsPriceDataRecurringInterval {
1798    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1799        use std::str::FromStr;
1800        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1801        Ok(Self::from_str(&s).expect("infallible"))
1802    }
1803}
1804/// Only required if a [default tax behavior](https://docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
1805/// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
1806/// One of `inclusive`, `exclusive`, or `unspecified`.
1807/// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1808#[derive(Clone, Eq, PartialEq)]
1809#[non_exhaustive]
1810pub enum CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1811    Exclusive,
1812    Inclusive,
1813    Unspecified,
1814    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1815    Unknown(String),
1816}
1817impl CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1818    pub fn as_str(&self) -> &str {
1819        use CreatePaymentLinkLineItemsPriceDataTaxBehavior::*;
1820        match self {
1821            Exclusive => "exclusive",
1822            Inclusive => "inclusive",
1823            Unspecified => "unspecified",
1824            Unknown(v) => v,
1825        }
1826    }
1827}
1828
1829impl std::str::FromStr for CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1830    type Err = std::convert::Infallible;
1831    fn from_str(s: &str) -> Result<Self, Self::Err> {
1832        use CreatePaymentLinkLineItemsPriceDataTaxBehavior::*;
1833        match s {
1834            "exclusive" => Ok(Exclusive),
1835            "inclusive" => Ok(Inclusive),
1836            "unspecified" => Ok(Unspecified),
1837            v => {
1838                tracing::warn!(
1839                    "Unknown value '{}' for enum '{}'",
1840                    v,
1841                    "CreatePaymentLinkLineItemsPriceDataTaxBehavior"
1842                );
1843                Ok(Unknown(v.to_owned()))
1844            }
1845        }
1846    }
1847}
1848impl std::fmt::Display for CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1849    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1850        f.write_str(self.as_str())
1851    }
1852}
1853
1854#[cfg(not(feature = "redact-generated-debug"))]
1855impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1856    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1857        f.write_str(self.as_str())
1858    }
1859}
1860#[cfg(feature = "redact-generated-debug")]
1861impl std::fmt::Debug for CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1862    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1863        f.debug_struct(stringify!(CreatePaymentLinkLineItemsPriceDataTaxBehavior))
1864            .finish_non_exhaustive()
1865    }
1866}
1867impl serde::Serialize for CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1868    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1869    where
1870        S: serde::Serializer,
1871    {
1872        serializer.serialize_str(self.as_str())
1873    }
1874}
1875#[cfg(feature = "deserialize")]
1876impl<'de> serde::Deserialize<'de> for CreatePaymentLinkLineItemsPriceDataTaxBehavior {
1877    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1878        use std::str::FromStr;
1879        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1880        Ok(Self::from_str(&s).expect("infallible"))
1881    }
1882}
1883/// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
1884#[derive(Clone)]
1885#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1886#[derive(serde::Serialize)]
1887pub struct CreatePaymentLinkPaymentIntentData {
1888    /// Controls when the funds will be captured from the customer's account.
1889    #[serde(skip_serializing_if = "Option::is_none")]
1890    pub capture_method: Option<CreatePaymentLinkPaymentIntentDataCaptureMethod>,
1891    /// An arbitrary string attached to the object. Often useful for displaying to users.
1892    #[serde(skip_serializing_if = "Option::is_none")]
1893    pub description: Option<String>,
1894    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that will declaratively set metadata on [Payment Intents](https://docs.stripe.com/api/payment_intents) generated from this payment link.
1895    /// Unlike object-level metadata, this field is declarative.
1896    /// Updates will clear prior values.
1897    #[serde(skip_serializing_if = "Option::is_none")]
1898    pub metadata: Option<std::collections::HashMap<String, String>>,
1899    /// Indicates that you intend to [make future payments](https://docs.stripe.com/payments/payment-intents#future-usage) with the payment method collected by this Checkout Session.
1900    ///
1901    /// When setting this to `on_session`, Checkout will show a notice to the customer that their payment details will be saved.
1902    ///
1903    /// When setting this to `off_session`, Checkout will show a notice to the customer that their payment details will be saved and used for future payments.
1904    ///
1905    /// If a Customer has been provided or Checkout creates a new Customer,Checkout will attach the payment method to the Customer.
1906    ///
1907    /// If Checkout does not create a Customer, the payment method is not attached to a Customer.
1908    /// To reuse the payment method, you can retrieve it from the Checkout Session's PaymentIntent.
1909    ///
1910    /// When processing card payments, Checkout also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.
1911    #[serde(skip_serializing_if = "Option::is_none")]
1912    pub setup_future_usage: Option<CreatePaymentLinkPaymentIntentDataSetupFutureUsage>,
1913    /// Text that appears on the customer's statement as the statement descriptor for a non-card charge.
1914    /// This value overrides the account's default statement descriptor.
1915    /// For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors).
1916    ///
1917    /// Setting this value for a card charge returns an error.
1918    /// For card charges, set the [statement_descriptor_suffix](https://docs.stripe.com/get-started/account/statement-descriptors#dynamic) instead.
1919    #[serde(skip_serializing_if = "Option::is_none")]
1920    pub statement_descriptor: Option<String>,
1921    /// Provides information about a card charge.
1922    /// Concatenated to the account's [statement descriptor prefix](https://docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer's statement.
1923    #[serde(skip_serializing_if = "Option::is_none")]
1924    pub statement_descriptor_suffix: Option<String>,
1925    /// A string that identifies the resulting payment as part of a group.
1926    /// See the PaymentIntents [use case for connected accounts](https://docs.stripe.com/connect/separate-charges-and-transfers) for details.
1927    #[serde(skip_serializing_if = "Option::is_none")]
1928    pub transfer_group: Option<String>,
1929}
1930#[cfg(feature = "redact-generated-debug")]
1931impl std::fmt::Debug for CreatePaymentLinkPaymentIntentData {
1932    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1933        f.debug_struct("CreatePaymentLinkPaymentIntentData").finish_non_exhaustive()
1934    }
1935}
1936impl CreatePaymentLinkPaymentIntentData {
1937    pub fn new() -> Self {
1938        Self {
1939            capture_method: None,
1940            description: None,
1941            metadata: None,
1942            setup_future_usage: None,
1943            statement_descriptor: None,
1944            statement_descriptor_suffix: None,
1945            transfer_group: None,
1946        }
1947    }
1948}
1949impl Default for CreatePaymentLinkPaymentIntentData {
1950    fn default() -> Self {
1951        Self::new()
1952    }
1953}
1954/// Controls when the funds will be captured from the customer's account.
1955#[derive(Clone, Eq, PartialEq)]
1956#[non_exhaustive]
1957pub enum CreatePaymentLinkPaymentIntentDataCaptureMethod {
1958    Automatic,
1959    AutomaticAsync,
1960    Manual,
1961    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1962    Unknown(String),
1963}
1964impl CreatePaymentLinkPaymentIntentDataCaptureMethod {
1965    pub fn as_str(&self) -> &str {
1966        use CreatePaymentLinkPaymentIntentDataCaptureMethod::*;
1967        match self {
1968            Automatic => "automatic",
1969            AutomaticAsync => "automatic_async",
1970            Manual => "manual",
1971            Unknown(v) => v,
1972        }
1973    }
1974}
1975
1976impl std::str::FromStr for CreatePaymentLinkPaymentIntentDataCaptureMethod {
1977    type Err = std::convert::Infallible;
1978    fn from_str(s: &str) -> Result<Self, Self::Err> {
1979        use CreatePaymentLinkPaymentIntentDataCaptureMethod::*;
1980        match s {
1981            "automatic" => Ok(Automatic),
1982            "automatic_async" => Ok(AutomaticAsync),
1983            "manual" => Ok(Manual),
1984            v => {
1985                tracing::warn!(
1986                    "Unknown value '{}' for enum '{}'",
1987                    v,
1988                    "CreatePaymentLinkPaymentIntentDataCaptureMethod"
1989                );
1990                Ok(Unknown(v.to_owned()))
1991            }
1992        }
1993    }
1994}
1995impl std::fmt::Display for CreatePaymentLinkPaymentIntentDataCaptureMethod {
1996    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1997        f.write_str(self.as_str())
1998    }
1999}
2000
2001#[cfg(not(feature = "redact-generated-debug"))]
2002impl std::fmt::Debug for CreatePaymentLinkPaymentIntentDataCaptureMethod {
2003    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2004        f.write_str(self.as_str())
2005    }
2006}
2007#[cfg(feature = "redact-generated-debug")]
2008impl std::fmt::Debug for CreatePaymentLinkPaymentIntentDataCaptureMethod {
2009    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2010        f.debug_struct(stringify!(CreatePaymentLinkPaymentIntentDataCaptureMethod))
2011            .finish_non_exhaustive()
2012    }
2013}
2014impl serde::Serialize for CreatePaymentLinkPaymentIntentDataCaptureMethod {
2015    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2016    where
2017        S: serde::Serializer,
2018    {
2019        serializer.serialize_str(self.as_str())
2020    }
2021}
2022#[cfg(feature = "deserialize")]
2023impl<'de> serde::Deserialize<'de> for CreatePaymentLinkPaymentIntentDataCaptureMethod {
2024    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2025        use std::str::FromStr;
2026        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2027        Ok(Self::from_str(&s).expect("infallible"))
2028    }
2029}
2030/// Indicates that you intend to [make future payments](https://docs.stripe.com/payments/payment-intents#future-usage) with the payment method collected by this Checkout Session.
2031///
2032/// When setting this to `on_session`, Checkout will show a notice to the customer that their payment details will be saved.
2033///
2034/// When setting this to `off_session`, Checkout will show a notice to the customer that their payment details will be saved and used for future payments.
2035///
2036/// If a Customer has been provided or Checkout creates a new Customer,Checkout will attach the payment method to the Customer.
2037///
2038/// If Checkout does not create a Customer, the payment method is not attached to a Customer.
2039/// To reuse the payment method, you can retrieve it from the Checkout Session's PaymentIntent.
2040///
2041/// When processing card payments, Checkout also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as SCA.
2042#[derive(Clone, Eq, PartialEq)]
2043#[non_exhaustive]
2044pub enum CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2045    OffSession,
2046    OnSession,
2047    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2048    Unknown(String),
2049}
2050impl CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2051    pub fn as_str(&self) -> &str {
2052        use CreatePaymentLinkPaymentIntentDataSetupFutureUsage::*;
2053        match self {
2054            OffSession => "off_session",
2055            OnSession => "on_session",
2056            Unknown(v) => v,
2057        }
2058    }
2059}
2060
2061impl std::str::FromStr for CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2062    type Err = std::convert::Infallible;
2063    fn from_str(s: &str) -> Result<Self, Self::Err> {
2064        use CreatePaymentLinkPaymentIntentDataSetupFutureUsage::*;
2065        match s {
2066            "off_session" => Ok(OffSession),
2067            "on_session" => Ok(OnSession),
2068            v => {
2069                tracing::warn!(
2070                    "Unknown value '{}' for enum '{}'",
2071                    v,
2072                    "CreatePaymentLinkPaymentIntentDataSetupFutureUsage"
2073                );
2074                Ok(Unknown(v.to_owned()))
2075            }
2076        }
2077    }
2078}
2079impl std::fmt::Display for CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2080    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2081        f.write_str(self.as_str())
2082    }
2083}
2084
2085#[cfg(not(feature = "redact-generated-debug"))]
2086impl std::fmt::Debug for CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2087    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2088        f.write_str(self.as_str())
2089    }
2090}
2091#[cfg(feature = "redact-generated-debug")]
2092impl std::fmt::Debug for CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2093    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2094        f.debug_struct(stringify!(CreatePaymentLinkPaymentIntentDataSetupFutureUsage))
2095            .finish_non_exhaustive()
2096    }
2097}
2098impl serde::Serialize for CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2099    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2100    where
2101        S: serde::Serializer,
2102    {
2103        serializer.serialize_str(self.as_str())
2104    }
2105}
2106#[cfg(feature = "deserialize")]
2107impl<'de> serde::Deserialize<'de> for CreatePaymentLinkPaymentIntentDataSetupFutureUsage {
2108    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2109        use std::str::FromStr;
2110        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2111        Ok(Self::from_str(&s).expect("infallible"))
2112    }
2113}
2114/// Specify whether Checkout should collect a payment method.
2115/// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
2116///
2117/// Can only be set in `subscription` mode. Defaults to `always`.
2118///
2119/// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://docs.stripe.com/payments/checkout/free-trials).
2120#[derive(Clone, Eq, PartialEq)]
2121#[non_exhaustive]
2122pub enum CreatePaymentLinkPaymentMethodCollection {
2123    Always,
2124    IfRequired,
2125    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2126    Unknown(String),
2127}
2128impl CreatePaymentLinkPaymentMethodCollection {
2129    pub fn as_str(&self) -> &str {
2130        use CreatePaymentLinkPaymentMethodCollection::*;
2131        match self {
2132            Always => "always",
2133            IfRequired => "if_required",
2134            Unknown(v) => v,
2135        }
2136    }
2137}
2138
2139impl std::str::FromStr for CreatePaymentLinkPaymentMethodCollection {
2140    type Err = std::convert::Infallible;
2141    fn from_str(s: &str) -> Result<Self, Self::Err> {
2142        use CreatePaymentLinkPaymentMethodCollection::*;
2143        match s {
2144            "always" => Ok(Always),
2145            "if_required" => Ok(IfRequired),
2146            v => {
2147                tracing::warn!(
2148                    "Unknown value '{}' for enum '{}'",
2149                    v,
2150                    "CreatePaymentLinkPaymentMethodCollection"
2151                );
2152                Ok(Unknown(v.to_owned()))
2153            }
2154        }
2155    }
2156}
2157impl std::fmt::Display for CreatePaymentLinkPaymentMethodCollection {
2158    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2159        f.write_str(self.as_str())
2160    }
2161}
2162
2163#[cfg(not(feature = "redact-generated-debug"))]
2164impl std::fmt::Debug for CreatePaymentLinkPaymentMethodCollection {
2165    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2166        f.write_str(self.as_str())
2167    }
2168}
2169#[cfg(feature = "redact-generated-debug")]
2170impl std::fmt::Debug for CreatePaymentLinkPaymentMethodCollection {
2171    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2172        f.debug_struct(stringify!(CreatePaymentLinkPaymentMethodCollection)).finish_non_exhaustive()
2173    }
2174}
2175impl serde::Serialize for CreatePaymentLinkPaymentMethodCollection {
2176    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2177    where
2178        S: serde::Serializer,
2179    {
2180        serializer.serialize_str(self.as_str())
2181    }
2182}
2183#[cfg(feature = "deserialize")]
2184impl<'de> serde::Deserialize<'de> for CreatePaymentLinkPaymentMethodCollection {
2185    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2186        use std::str::FromStr;
2187        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2188        Ok(Self::from_str(&s).expect("infallible"))
2189    }
2190}
2191/// Configuration for collecting the customer's shipping address.
2192#[derive(Clone, Eq, PartialEq)]
2193#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2194#[derive(serde::Serialize)]
2195pub struct CreatePaymentLinkShippingAddressCollection {
2196    /// An array of two-letter ISO country codes representing which countries Checkout should provide as options for.
2197    /// shipping locations.
2198    pub allowed_countries: Vec<CreatePaymentLinkShippingAddressCollectionAllowedCountries>,
2199}
2200#[cfg(feature = "redact-generated-debug")]
2201impl std::fmt::Debug for CreatePaymentLinkShippingAddressCollection {
2202    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2203        f.debug_struct("CreatePaymentLinkShippingAddressCollection").finish_non_exhaustive()
2204    }
2205}
2206impl CreatePaymentLinkShippingAddressCollection {
2207    pub fn new(
2208        allowed_countries: impl Into<Vec<CreatePaymentLinkShippingAddressCollectionAllowedCountries>>,
2209    ) -> Self {
2210        Self { allowed_countries: allowed_countries.into() }
2211    }
2212}
2213/// An array of two-letter ISO country codes representing which countries Checkout should provide as options for.
2214/// shipping locations.
2215#[derive(Clone, Eq, PartialEq)]
2216#[non_exhaustive]
2217pub enum CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2218    Ac,
2219    Ad,
2220    Ae,
2221    Af,
2222    Ag,
2223    Ai,
2224    Al,
2225    Am,
2226    Ao,
2227    Aq,
2228    Ar,
2229    At,
2230    Au,
2231    Aw,
2232    Ax,
2233    Az,
2234    Ba,
2235    Bb,
2236    Bd,
2237    Be,
2238    Bf,
2239    Bg,
2240    Bh,
2241    Bi,
2242    Bj,
2243    Bl,
2244    Bm,
2245    Bn,
2246    Bo,
2247    Bq,
2248    Br,
2249    Bs,
2250    Bt,
2251    Bv,
2252    Bw,
2253    By,
2254    Bz,
2255    Ca,
2256    Cd,
2257    Cf,
2258    Cg,
2259    Ch,
2260    Ci,
2261    Ck,
2262    Cl,
2263    Cm,
2264    Cn,
2265    Co,
2266    Cr,
2267    Cv,
2268    Cw,
2269    Cy,
2270    Cz,
2271    De,
2272    Dj,
2273    Dk,
2274    Dm,
2275    Do,
2276    Dz,
2277    Ec,
2278    Ee,
2279    Eg,
2280    Eh,
2281    Er,
2282    Es,
2283    Et,
2284    Fi,
2285    Fj,
2286    Fk,
2287    Fo,
2288    Fr,
2289    Ga,
2290    Gb,
2291    Gd,
2292    Ge,
2293    Gf,
2294    Gg,
2295    Gh,
2296    Gi,
2297    Gl,
2298    Gm,
2299    Gn,
2300    Gp,
2301    Gq,
2302    Gr,
2303    Gs,
2304    Gt,
2305    Gu,
2306    Gw,
2307    Gy,
2308    Hk,
2309    Hn,
2310    Hr,
2311    Ht,
2312    Hu,
2313    Id,
2314    Ie,
2315    Il,
2316    Im,
2317    In,
2318    Io,
2319    Iq,
2320    Is,
2321    It,
2322    Je,
2323    Jm,
2324    Jo,
2325    Jp,
2326    Ke,
2327    Kg,
2328    Kh,
2329    Ki,
2330    Km,
2331    Kn,
2332    Kr,
2333    Kw,
2334    Ky,
2335    Kz,
2336    La,
2337    Lb,
2338    Lc,
2339    Li,
2340    Lk,
2341    Lr,
2342    Ls,
2343    Lt,
2344    Lu,
2345    Lv,
2346    Ly,
2347    Ma,
2348    Mc,
2349    Md,
2350    Me,
2351    Mf,
2352    Mg,
2353    Mk,
2354    Ml,
2355    Mm,
2356    Mn,
2357    Mo,
2358    Mq,
2359    Mr,
2360    Ms,
2361    Mt,
2362    Mu,
2363    Mv,
2364    Mw,
2365    Mx,
2366    My,
2367    Mz,
2368    Na,
2369    Nc,
2370    Ne,
2371    Ng,
2372    Ni,
2373    Nl,
2374    No,
2375    Np,
2376    Nr,
2377    Nu,
2378    Nz,
2379    Om,
2380    Pa,
2381    Pe,
2382    Pf,
2383    Pg,
2384    Ph,
2385    Pk,
2386    Pl,
2387    Pm,
2388    Pn,
2389    Pr,
2390    Ps,
2391    Pt,
2392    Py,
2393    Qa,
2394    Re,
2395    Ro,
2396    Rs,
2397    Ru,
2398    Rw,
2399    Sa,
2400    Sb,
2401    Sc,
2402    Sd,
2403    Se,
2404    Sg,
2405    Sh,
2406    Si,
2407    Sj,
2408    Sk,
2409    Sl,
2410    Sm,
2411    Sn,
2412    So,
2413    Sr,
2414    Ss,
2415    St,
2416    Sv,
2417    Sx,
2418    Sz,
2419    Ta,
2420    Tc,
2421    Td,
2422    Tf,
2423    Tg,
2424    Th,
2425    Tj,
2426    Tk,
2427    Tl,
2428    Tm,
2429    Tn,
2430    To,
2431    Tr,
2432    Tt,
2433    Tv,
2434    Tw,
2435    Tz,
2436    Ua,
2437    Ug,
2438    Us,
2439    Uy,
2440    Uz,
2441    Va,
2442    Vc,
2443    Ve,
2444    Vg,
2445    Vn,
2446    Vu,
2447    Wf,
2448    Ws,
2449    Xk,
2450    Ye,
2451    Yt,
2452    Za,
2453    Zm,
2454    Zw,
2455    Zz,
2456    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2457    Unknown(String),
2458}
2459impl CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2460    pub fn as_str(&self) -> &str {
2461        use CreatePaymentLinkShippingAddressCollectionAllowedCountries::*;
2462        match self {
2463            Ac => "AC",
2464            Ad => "AD",
2465            Ae => "AE",
2466            Af => "AF",
2467            Ag => "AG",
2468            Ai => "AI",
2469            Al => "AL",
2470            Am => "AM",
2471            Ao => "AO",
2472            Aq => "AQ",
2473            Ar => "AR",
2474            At => "AT",
2475            Au => "AU",
2476            Aw => "AW",
2477            Ax => "AX",
2478            Az => "AZ",
2479            Ba => "BA",
2480            Bb => "BB",
2481            Bd => "BD",
2482            Be => "BE",
2483            Bf => "BF",
2484            Bg => "BG",
2485            Bh => "BH",
2486            Bi => "BI",
2487            Bj => "BJ",
2488            Bl => "BL",
2489            Bm => "BM",
2490            Bn => "BN",
2491            Bo => "BO",
2492            Bq => "BQ",
2493            Br => "BR",
2494            Bs => "BS",
2495            Bt => "BT",
2496            Bv => "BV",
2497            Bw => "BW",
2498            By => "BY",
2499            Bz => "BZ",
2500            Ca => "CA",
2501            Cd => "CD",
2502            Cf => "CF",
2503            Cg => "CG",
2504            Ch => "CH",
2505            Ci => "CI",
2506            Ck => "CK",
2507            Cl => "CL",
2508            Cm => "CM",
2509            Cn => "CN",
2510            Co => "CO",
2511            Cr => "CR",
2512            Cv => "CV",
2513            Cw => "CW",
2514            Cy => "CY",
2515            Cz => "CZ",
2516            De => "DE",
2517            Dj => "DJ",
2518            Dk => "DK",
2519            Dm => "DM",
2520            Do => "DO",
2521            Dz => "DZ",
2522            Ec => "EC",
2523            Ee => "EE",
2524            Eg => "EG",
2525            Eh => "EH",
2526            Er => "ER",
2527            Es => "ES",
2528            Et => "ET",
2529            Fi => "FI",
2530            Fj => "FJ",
2531            Fk => "FK",
2532            Fo => "FO",
2533            Fr => "FR",
2534            Ga => "GA",
2535            Gb => "GB",
2536            Gd => "GD",
2537            Ge => "GE",
2538            Gf => "GF",
2539            Gg => "GG",
2540            Gh => "GH",
2541            Gi => "GI",
2542            Gl => "GL",
2543            Gm => "GM",
2544            Gn => "GN",
2545            Gp => "GP",
2546            Gq => "GQ",
2547            Gr => "GR",
2548            Gs => "GS",
2549            Gt => "GT",
2550            Gu => "GU",
2551            Gw => "GW",
2552            Gy => "GY",
2553            Hk => "HK",
2554            Hn => "HN",
2555            Hr => "HR",
2556            Ht => "HT",
2557            Hu => "HU",
2558            Id => "ID",
2559            Ie => "IE",
2560            Il => "IL",
2561            Im => "IM",
2562            In => "IN",
2563            Io => "IO",
2564            Iq => "IQ",
2565            Is => "IS",
2566            It => "IT",
2567            Je => "JE",
2568            Jm => "JM",
2569            Jo => "JO",
2570            Jp => "JP",
2571            Ke => "KE",
2572            Kg => "KG",
2573            Kh => "KH",
2574            Ki => "KI",
2575            Km => "KM",
2576            Kn => "KN",
2577            Kr => "KR",
2578            Kw => "KW",
2579            Ky => "KY",
2580            Kz => "KZ",
2581            La => "LA",
2582            Lb => "LB",
2583            Lc => "LC",
2584            Li => "LI",
2585            Lk => "LK",
2586            Lr => "LR",
2587            Ls => "LS",
2588            Lt => "LT",
2589            Lu => "LU",
2590            Lv => "LV",
2591            Ly => "LY",
2592            Ma => "MA",
2593            Mc => "MC",
2594            Md => "MD",
2595            Me => "ME",
2596            Mf => "MF",
2597            Mg => "MG",
2598            Mk => "MK",
2599            Ml => "ML",
2600            Mm => "MM",
2601            Mn => "MN",
2602            Mo => "MO",
2603            Mq => "MQ",
2604            Mr => "MR",
2605            Ms => "MS",
2606            Mt => "MT",
2607            Mu => "MU",
2608            Mv => "MV",
2609            Mw => "MW",
2610            Mx => "MX",
2611            My => "MY",
2612            Mz => "MZ",
2613            Na => "NA",
2614            Nc => "NC",
2615            Ne => "NE",
2616            Ng => "NG",
2617            Ni => "NI",
2618            Nl => "NL",
2619            No => "NO",
2620            Np => "NP",
2621            Nr => "NR",
2622            Nu => "NU",
2623            Nz => "NZ",
2624            Om => "OM",
2625            Pa => "PA",
2626            Pe => "PE",
2627            Pf => "PF",
2628            Pg => "PG",
2629            Ph => "PH",
2630            Pk => "PK",
2631            Pl => "PL",
2632            Pm => "PM",
2633            Pn => "PN",
2634            Pr => "PR",
2635            Ps => "PS",
2636            Pt => "PT",
2637            Py => "PY",
2638            Qa => "QA",
2639            Re => "RE",
2640            Ro => "RO",
2641            Rs => "RS",
2642            Ru => "RU",
2643            Rw => "RW",
2644            Sa => "SA",
2645            Sb => "SB",
2646            Sc => "SC",
2647            Sd => "SD",
2648            Se => "SE",
2649            Sg => "SG",
2650            Sh => "SH",
2651            Si => "SI",
2652            Sj => "SJ",
2653            Sk => "SK",
2654            Sl => "SL",
2655            Sm => "SM",
2656            Sn => "SN",
2657            So => "SO",
2658            Sr => "SR",
2659            Ss => "SS",
2660            St => "ST",
2661            Sv => "SV",
2662            Sx => "SX",
2663            Sz => "SZ",
2664            Ta => "TA",
2665            Tc => "TC",
2666            Td => "TD",
2667            Tf => "TF",
2668            Tg => "TG",
2669            Th => "TH",
2670            Tj => "TJ",
2671            Tk => "TK",
2672            Tl => "TL",
2673            Tm => "TM",
2674            Tn => "TN",
2675            To => "TO",
2676            Tr => "TR",
2677            Tt => "TT",
2678            Tv => "TV",
2679            Tw => "TW",
2680            Tz => "TZ",
2681            Ua => "UA",
2682            Ug => "UG",
2683            Us => "US",
2684            Uy => "UY",
2685            Uz => "UZ",
2686            Va => "VA",
2687            Vc => "VC",
2688            Ve => "VE",
2689            Vg => "VG",
2690            Vn => "VN",
2691            Vu => "VU",
2692            Wf => "WF",
2693            Ws => "WS",
2694            Xk => "XK",
2695            Ye => "YE",
2696            Yt => "YT",
2697            Za => "ZA",
2698            Zm => "ZM",
2699            Zw => "ZW",
2700            Zz => "ZZ",
2701            Unknown(v) => v,
2702        }
2703    }
2704}
2705
2706impl std::str::FromStr for CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2707    type Err = std::convert::Infallible;
2708    fn from_str(s: &str) -> Result<Self, Self::Err> {
2709        use CreatePaymentLinkShippingAddressCollectionAllowedCountries::*;
2710        match s {
2711            "AC" => Ok(Ac),
2712            "AD" => Ok(Ad),
2713            "AE" => Ok(Ae),
2714            "AF" => Ok(Af),
2715            "AG" => Ok(Ag),
2716            "AI" => Ok(Ai),
2717            "AL" => Ok(Al),
2718            "AM" => Ok(Am),
2719            "AO" => Ok(Ao),
2720            "AQ" => Ok(Aq),
2721            "AR" => Ok(Ar),
2722            "AT" => Ok(At),
2723            "AU" => Ok(Au),
2724            "AW" => Ok(Aw),
2725            "AX" => Ok(Ax),
2726            "AZ" => Ok(Az),
2727            "BA" => Ok(Ba),
2728            "BB" => Ok(Bb),
2729            "BD" => Ok(Bd),
2730            "BE" => Ok(Be),
2731            "BF" => Ok(Bf),
2732            "BG" => Ok(Bg),
2733            "BH" => Ok(Bh),
2734            "BI" => Ok(Bi),
2735            "BJ" => Ok(Bj),
2736            "BL" => Ok(Bl),
2737            "BM" => Ok(Bm),
2738            "BN" => Ok(Bn),
2739            "BO" => Ok(Bo),
2740            "BQ" => Ok(Bq),
2741            "BR" => Ok(Br),
2742            "BS" => Ok(Bs),
2743            "BT" => Ok(Bt),
2744            "BV" => Ok(Bv),
2745            "BW" => Ok(Bw),
2746            "BY" => Ok(By),
2747            "BZ" => Ok(Bz),
2748            "CA" => Ok(Ca),
2749            "CD" => Ok(Cd),
2750            "CF" => Ok(Cf),
2751            "CG" => Ok(Cg),
2752            "CH" => Ok(Ch),
2753            "CI" => Ok(Ci),
2754            "CK" => Ok(Ck),
2755            "CL" => Ok(Cl),
2756            "CM" => Ok(Cm),
2757            "CN" => Ok(Cn),
2758            "CO" => Ok(Co),
2759            "CR" => Ok(Cr),
2760            "CV" => Ok(Cv),
2761            "CW" => Ok(Cw),
2762            "CY" => Ok(Cy),
2763            "CZ" => Ok(Cz),
2764            "DE" => Ok(De),
2765            "DJ" => Ok(Dj),
2766            "DK" => Ok(Dk),
2767            "DM" => Ok(Dm),
2768            "DO" => Ok(Do),
2769            "DZ" => Ok(Dz),
2770            "EC" => Ok(Ec),
2771            "EE" => Ok(Ee),
2772            "EG" => Ok(Eg),
2773            "EH" => Ok(Eh),
2774            "ER" => Ok(Er),
2775            "ES" => Ok(Es),
2776            "ET" => Ok(Et),
2777            "FI" => Ok(Fi),
2778            "FJ" => Ok(Fj),
2779            "FK" => Ok(Fk),
2780            "FO" => Ok(Fo),
2781            "FR" => Ok(Fr),
2782            "GA" => Ok(Ga),
2783            "GB" => Ok(Gb),
2784            "GD" => Ok(Gd),
2785            "GE" => Ok(Ge),
2786            "GF" => Ok(Gf),
2787            "GG" => Ok(Gg),
2788            "GH" => Ok(Gh),
2789            "GI" => Ok(Gi),
2790            "GL" => Ok(Gl),
2791            "GM" => Ok(Gm),
2792            "GN" => Ok(Gn),
2793            "GP" => Ok(Gp),
2794            "GQ" => Ok(Gq),
2795            "GR" => Ok(Gr),
2796            "GS" => Ok(Gs),
2797            "GT" => Ok(Gt),
2798            "GU" => Ok(Gu),
2799            "GW" => Ok(Gw),
2800            "GY" => Ok(Gy),
2801            "HK" => Ok(Hk),
2802            "HN" => Ok(Hn),
2803            "HR" => Ok(Hr),
2804            "HT" => Ok(Ht),
2805            "HU" => Ok(Hu),
2806            "ID" => Ok(Id),
2807            "IE" => Ok(Ie),
2808            "IL" => Ok(Il),
2809            "IM" => Ok(Im),
2810            "IN" => Ok(In),
2811            "IO" => Ok(Io),
2812            "IQ" => Ok(Iq),
2813            "IS" => Ok(Is),
2814            "IT" => Ok(It),
2815            "JE" => Ok(Je),
2816            "JM" => Ok(Jm),
2817            "JO" => Ok(Jo),
2818            "JP" => Ok(Jp),
2819            "KE" => Ok(Ke),
2820            "KG" => Ok(Kg),
2821            "KH" => Ok(Kh),
2822            "KI" => Ok(Ki),
2823            "KM" => Ok(Km),
2824            "KN" => Ok(Kn),
2825            "KR" => Ok(Kr),
2826            "KW" => Ok(Kw),
2827            "KY" => Ok(Ky),
2828            "KZ" => Ok(Kz),
2829            "LA" => Ok(La),
2830            "LB" => Ok(Lb),
2831            "LC" => Ok(Lc),
2832            "LI" => Ok(Li),
2833            "LK" => Ok(Lk),
2834            "LR" => Ok(Lr),
2835            "LS" => Ok(Ls),
2836            "LT" => Ok(Lt),
2837            "LU" => Ok(Lu),
2838            "LV" => Ok(Lv),
2839            "LY" => Ok(Ly),
2840            "MA" => Ok(Ma),
2841            "MC" => Ok(Mc),
2842            "MD" => Ok(Md),
2843            "ME" => Ok(Me),
2844            "MF" => Ok(Mf),
2845            "MG" => Ok(Mg),
2846            "MK" => Ok(Mk),
2847            "ML" => Ok(Ml),
2848            "MM" => Ok(Mm),
2849            "MN" => Ok(Mn),
2850            "MO" => Ok(Mo),
2851            "MQ" => Ok(Mq),
2852            "MR" => Ok(Mr),
2853            "MS" => Ok(Ms),
2854            "MT" => Ok(Mt),
2855            "MU" => Ok(Mu),
2856            "MV" => Ok(Mv),
2857            "MW" => Ok(Mw),
2858            "MX" => Ok(Mx),
2859            "MY" => Ok(My),
2860            "MZ" => Ok(Mz),
2861            "NA" => Ok(Na),
2862            "NC" => Ok(Nc),
2863            "NE" => Ok(Ne),
2864            "NG" => Ok(Ng),
2865            "NI" => Ok(Ni),
2866            "NL" => Ok(Nl),
2867            "NO" => Ok(No),
2868            "NP" => Ok(Np),
2869            "NR" => Ok(Nr),
2870            "NU" => Ok(Nu),
2871            "NZ" => Ok(Nz),
2872            "OM" => Ok(Om),
2873            "PA" => Ok(Pa),
2874            "PE" => Ok(Pe),
2875            "PF" => Ok(Pf),
2876            "PG" => Ok(Pg),
2877            "PH" => Ok(Ph),
2878            "PK" => Ok(Pk),
2879            "PL" => Ok(Pl),
2880            "PM" => Ok(Pm),
2881            "PN" => Ok(Pn),
2882            "PR" => Ok(Pr),
2883            "PS" => Ok(Ps),
2884            "PT" => Ok(Pt),
2885            "PY" => Ok(Py),
2886            "QA" => Ok(Qa),
2887            "RE" => Ok(Re),
2888            "RO" => Ok(Ro),
2889            "RS" => Ok(Rs),
2890            "RU" => Ok(Ru),
2891            "RW" => Ok(Rw),
2892            "SA" => Ok(Sa),
2893            "SB" => Ok(Sb),
2894            "SC" => Ok(Sc),
2895            "SD" => Ok(Sd),
2896            "SE" => Ok(Se),
2897            "SG" => Ok(Sg),
2898            "SH" => Ok(Sh),
2899            "SI" => Ok(Si),
2900            "SJ" => Ok(Sj),
2901            "SK" => Ok(Sk),
2902            "SL" => Ok(Sl),
2903            "SM" => Ok(Sm),
2904            "SN" => Ok(Sn),
2905            "SO" => Ok(So),
2906            "SR" => Ok(Sr),
2907            "SS" => Ok(Ss),
2908            "ST" => Ok(St),
2909            "SV" => Ok(Sv),
2910            "SX" => Ok(Sx),
2911            "SZ" => Ok(Sz),
2912            "TA" => Ok(Ta),
2913            "TC" => Ok(Tc),
2914            "TD" => Ok(Td),
2915            "TF" => Ok(Tf),
2916            "TG" => Ok(Tg),
2917            "TH" => Ok(Th),
2918            "TJ" => Ok(Tj),
2919            "TK" => Ok(Tk),
2920            "TL" => Ok(Tl),
2921            "TM" => Ok(Tm),
2922            "TN" => Ok(Tn),
2923            "TO" => Ok(To),
2924            "TR" => Ok(Tr),
2925            "TT" => Ok(Tt),
2926            "TV" => Ok(Tv),
2927            "TW" => Ok(Tw),
2928            "TZ" => Ok(Tz),
2929            "UA" => Ok(Ua),
2930            "UG" => Ok(Ug),
2931            "US" => Ok(Us),
2932            "UY" => Ok(Uy),
2933            "UZ" => Ok(Uz),
2934            "VA" => Ok(Va),
2935            "VC" => Ok(Vc),
2936            "VE" => Ok(Ve),
2937            "VG" => Ok(Vg),
2938            "VN" => Ok(Vn),
2939            "VU" => Ok(Vu),
2940            "WF" => Ok(Wf),
2941            "WS" => Ok(Ws),
2942            "XK" => Ok(Xk),
2943            "YE" => Ok(Ye),
2944            "YT" => Ok(Yt),
2945            "ZA" => Ok(Za),
2946            "ZM" => Ok(Zm),
2947            "ZW" => Ok(Zw),
2948            "ZZ" => Ok(Zz),
2949            v => {
2950                tracing::warn!(
2951                    "Unknown value '{}' for enum '{}'",
2952                    v,
2953                    "CreatePaymentLinkShippingAddressCollectionAllowedCountries"
2954                );
2955                Ok(Unknown(v.to_owned()))
2956            }
2957        }
2958    }
2959}
2960impl std::fmt::Display for CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2961    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2962        f.write_str(self.as_str())
2963    }
2964}
2965
2966#[cfg(not(feature = "redact-generated-debug"))]
2967impl std::fmt::Debug for CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2968    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2969        f.write_str(self.as_str())
2970    }
2971}
2972#[cfg(feature = "redact-generated-debug")]
2973impl std::fmt::Debug for CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2974    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2975        f.debug_struct(stringify!(CreatePaymentLinkShippingAddressCollectionAllowedCountries))
2976            .finish_non_exhaustive()
2977    }
2978}
2979impl serde::Serialize for CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2980    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2981    where
2982        S: serde::Serializer,
2983    {
2984        serializer.serialize_str(self.as_str())
2985    }
2986}
2987#[cfg(feature = "deserialize")]
2988impl<'de> serde::Deserialize<'de> for CreatePaymentLinkShippingAddressCollectionAllowedCountries {
2989    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2990        use std::str::FromStr;
2991        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2992        Ok(Self::from_str(&s).expect("infallible"))
2993    }
2994}
2995/// The shipping rate options to apply to [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link.
2996#[derive(Clone, Eq, PartialEq)]
2997#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2998#[derive(serde::Serialize)]
2999pub struct CreatePaymentLinkShippingOptions {
3000    /// The ID of the Shipping Rate to use for this shipping option.
3001    #[serde(skip_serializing_if = "Option::is_none")]
3002    pub shipping_rate: Option<String>,
3003}
3004#[cfg(feature = "redact-generated-debug")]
3005impl std::fmt::Debug for CreatePaymentLinkShippingOptions {
3006    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3007        f.debug_struct("CreatePaymentLinkShippingOptions").finish_non_exhaustive()
3008    }
3009}
3010impl CreatePaymentLinkShippingOptions {
3011    pub fn new() -> Self {
3012        Self { shipping_rate: None }
3013    }
3014}
3015impl Default for CreatePaymentLinkShippingOptions {
3016    fn default() -> Self {
3017        Self::new()
3018    }
3019}
3020/// When creating a subscription, the specified configuration data will be used.
3021/// There must be at least one line item with a recurring price to use `subscription_data`.
3022#[derive(Clone)]
3023#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3024#[derive(serde::Serialize)]
3025pub struct CreatePaymentLinkSubscriptionData {
3026    /// The subscription's description, meant to be displayable to the customer.
3027    /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
3028    #[serde(skip_serializing_if = "Option::is_none")]
3029    pub description: Option<String>,
3030    /// All invoices will be billed using the specified settings.
3031    #[serde(skip_serializing_if = "Option::is_none")]
3032    pub invoice_settings: Option<CreatePaymentLinkSubscriptionDataInvoiceSettings>,
3033    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that will declaratively set metadata on [Subscriptions](https://docs.stripe.com/api/subscriptions) generated from this payment link.
3034    /// Unlike object-level metadata, this field is declarative.
3035    /// Updates will clear prior values.
3036    #[serde(skip_serializing_if = "Option::is_none")]
3037    pub metadata: Option<std::collections::HashMap<String, String>>,
3038    /// Integer representing the number of trial period days before the customer is charged for the first time.
3039    /// Has to be at least 1.
3040    #[serde(skip_serializing_if = "Option::is_none")]
3041    pub trial_period_days: Option<u32>,
3042    /// Settings related to subscription trials.
3043    #[serde(skip_serializing_if = "Option::is_none")]
3044    pub trial_settings: Option<CreatePaymentLinkSubscriptionDataTrialSettings>,
3045}
3046#[cfg(feature = "redact-generated-debug")]
3047impl std::fmt::Debug for CreatePaymentLinkSubscriptionData {
3048    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3049        f.debug_struct("CreatePaymentLinkSubscriptionData").finish_non_exhaustive()
3050    }
3051}
3052impl CreatePaymentLinkSubscriptionData {
3053    pub fn new() -> Self {
3054        Self {
3055            description: None,
3056            invoice_settings: None,
3057            metadata: None,
3058            trial_period_days: None,
3059            trial_settings: None,
3060        }
3061    }
3062}
3063impl Default for CreatePaymentLinkSubscriptionData {
3064    fn default() -> Self {
3065        Self::new()
3066    }
3067}
3068/// All invoices will be billed using the specified settings.
3069#[derive(Clone, Eq, PartialEq)]
3070#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3071#[derive(serde::Serialize)]
3072pub struct CreatePaymentLinkSubscriptionDataInvoiceSettings {
3073    /// The connected account that issues the invoice.
3074    /// The invoice is presented with the branding and support information of the specified account.
3075    #[serde(skip_serializing_if = "Option::is_none")]
3076    pub issuer: Option<CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer>,
3077}
3078#[cfg(feature = "redact-generated-debug")]
3079impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataInvoiceSettings {
3080    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3081        f.debug_struct("CreatePaymentLinkSubscriptionDataInvoiceSettings").finish_non_exhaustive()
3082    }
3083}
3084impl CreatePaymentLinkSubscriptionDataInvoiceSettings {
3085    pub fn new() -> Self {
3086        Self { issuer: None }
3087    }
3088}
3089impl Default for CreatePaymentLinkSubscriptionDataInvoiceSettings {
3090    fn default() -> Self {
3091        Self::new()
3092    }
3093}
3094/// The connected account that issues the invoice.
3095/// The invoice is presented with the branding and support information of the specified account.
3096#[derive(Clone, Eq, PartialEq)]
3097#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3098#[derive(serde::Serialize)]
3099pub struct CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer {
3100    /// The connected account being referenced when `type` is `account`.
3101    #[serde(skip_serializing_if = "Option::is_none")]
3102    pub account: Option<String>,
3103    /// Type of the account referenced in the request.
3104    #[serde(rename = "type")]
3105    pub type_: CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType,
3106}
3107#[cfg(feature = "redact-generated-debug")]
3108impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer {
3109    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3110        f.debug_struct("CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer")
3111            .finish_non_exhaustive()
3112    }
3113}
3114impl CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuer {
3115    pub fn new(
3116        type_: impl Into<CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType>,
3117    ) -> Self {
3118        Self { account: None, type_: type_.into() }
3119    }
3120}
3121/// Type of the account referenced in the request.
3122#[derive(Clone, Eq, PartialEq)]
3123#[non_exhaustive]
3124pub enum CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3125    Account,
3126    Self_,
3127    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3128    Unknown(String),
3129}
3130impl CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3131    pub fn as_str(&self) -> &str {
3132        use CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*;
3133        match self {
3134            Account => "account",
3135            Self_ => "self",
3136            Unknown(v) => v,
3137        }
3138    }
3139}
3140
3141impl std::str::FromStr for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3142    type Err = std::convert::Infallible;
3143    fn from_str(s: &str) -> Result<Self, Self::Err> {
3144        use CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*;
3145        match s {
3146            "account" => Ok(Account),
3147            "self" => Ok(Self_),
3148            v => {
3149                tracing::warn!(
3150                    "Unknown value '{}' for enum '{}'",
3151                    v,
3152                    "CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType"
3153                );
3154                Ok(Unknown(v.to_owned()))
3155            }
3156        }
3157    }
3158}
3159impl std::fmt::Display for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3160    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3161        f.write_str(self.as_str())
3162    }
3163}
3164
3165#[cfg(not(feature = "redact-generated-debug"))]
3166impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3167    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3168        f.write_str(self.as_str())
3169    }
3170}
3171#[cfg(feature = "redact-generated-debug")]
3172impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3173    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3174        f.debug_struct(stringify!(CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType))
3175            .finish_non_exhaustive()
3176    }
3177}
3178impl serde::Serialize for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3179    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3180    where
3181        S: serde::Serializer,
3182    {
3183        serializer.serialize_str(self.as_str())
3184    }
3185}
3186#[cfg(feature = "deserialize")]
3187impl<'de> serde::Deserialize<'de> for CreatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
3188    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3189        use std::str::FromStr;
3190        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3191        Ok(Self::from_str(&s).expect("infallible"))
3192    }
3193}
3194/// Settings related to subscription trials.
3195#[derive(Clone, Eq, PartialEq)]
3196#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3197#[derive(serde::Serialize)]
3198pub struct CreatePaymentLinkSubscriptionDataTrialSettings {
3199    /// Defines how the subscription should behave when the user's free trial ends.
3200    pub end_behavior: CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior,
3201}
3202#[cfg(feature = "redact-generated-debug")]
3203impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataTrialSettings {
3204    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3205        f.debug_struct("CreatePaymentLinkSubscriptionDataTrialSettings").finish_non_exhaustive()
3206    }
3207}
3208impl CreatePaymentLinkSubscriptionDataTrialSettings {
3209    pub fn new(
3210        end_behavior: impl Into<CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior>,
3211    ) -> Self {
3212        Self { end_behavior: end_behavior.into() }
3213    }
3214}
3215/// Defines how the subscription should behave when the user's free trial ends.
3216#[derive(Clone, Eq, PartialEq)]
3217#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3218#[derive(serde::Serialize)]
3219pub struct CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior {
3220    /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
3221    pub missing_payment_method:
3222        CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod,
3223}
3224#[cfg(feature = "redact-generated-debug")]
3225impl std::fmt::Debug for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior {
3226    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3227        f.debug_struct("CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior")
3228            .finish_non_exhaustive()
3229    }
3230}
3231impl CreatePaymentLinkSubscriptionDataTrialSettingsEndBehavior {
3232    pub fn new(
3233        missing_payment_method: impl Into<
3234            CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod,
3235        >,
3236    ) -> Self {
3237        Self { missing_payment_method: missing_payment_method.into() }
3238    }
3239}
3240/// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
3241#[derive(Clone, Eq, PartialEq)]
3242#[non_exhaustive]
3243pub enum CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod {
3244    Cancel,
3245    CreateInvoice,
3246    Pause,
3247    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3248    Unknown(String),
3249}
3250impl CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod {
3251    pub fn as_str(&self) -> &str {
3252        use CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*;
3253        match self {
3254            Cancel => "cancel",
3255            CreateInvoice => "create_invoice",
3256            Pause => "pause",
3257            Unknown(v) => v,
3258        }
3259    }
3260}
3261
3262impl std::str::FromStr
3263    for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3264{
3265    type Err = std::convert::Infallible;
3266    fn from_str(s: &str) -> Result<Self, Self::Err> {
3267        use CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*;
3268        match s {
3269            "cancel" => Ok(Cancel),
3270            "create_invoice" => Ok(CreateInvoice),
3271            "pause" => Ok(Pause),
3272            v => {
3273                tracing::warn!(
3274                    "Unknown value '{}' for enum '{}'",
3275                    v,
3276                    "CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod"
3277                );
3278                Ok(Unknown(v.to_owned()))
3279            }
3280        }
3281    }
3282}
3283impl std::fmt::Display
3284    for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3285{
3286    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3287        f.write_str(self.as_str())
3288    }
3289}
3290
3291#[cfg(not(feature = "redact-generated-debug"))]
3292impl std::fmt::Debug
3293    for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3294{
3295    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3296        f.write_str(self.as_str())
3297    }
3298}
3299#[cfg(feature = "redact-generated-debug")]
3300impl std::fmt::Debug
3301    for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3302{
3303    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3304        f.debug_struct(stringify!(
3305            CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3306        ))
3307        .finish_non_exhaustive()
3308    }
3309}
3310impl serde::Serialize
3311    for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3312{
3313    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3314    where
3315        S: serde::Serializer,
3316    {
3317        serializer.serialize_str(self.as_str())
3318    }
3319}
3320#[cfg(feature = "deserialize")]
3321impl<'de> serde::Deserialize<'de>
3322    for CreatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
3323{
3324    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3325        use std::str::FromStr;
3326        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3327        Ok(Self::from_str(&s).expect("infallible"))
3328    }
3329}
3330/// Controls tax ID collection during checkout.
3331#[derive(Clone, Eq, PartialEq)]
3332#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3333#[derive(serde::Serialize)]
3334pub struct CreatePaymentLinkTaxIdCollection {
3335    /// Enable tax ID collection during checkout. Defaults to `false`.
3336    pub enabled: bool,
3337    /// Describes whether a tax ID is required during checkout.
3338    /// Defaults to `never`.
3339    /// You can't set this parameter if `ui_mode` is `custom`.
3340    #[serde(skip_serializing_if = "Option::is_none")]
3341    pub required: Option<CreatePaymentLinkTaxIdCollectionRequired>,
3342}
3343#[cfg(feature = "redact-generated-debug")]
3344impl std::fmt::Debug for CreatePaymentLinkTaxIdCollection {
3345    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3346        f.debug_struct("CreatePaymentLinkTaxIdCollection").finish_non_exhaustive()
3347    }
3348}
3349impl CreatePaymentLinkTaxIdCollection {
3350    pub fn new(enabled: impl Into<bool>) -> Self {
3351        Self { enabled: enabled.into(), required: None }
3352    }
3353}
3354/// Describes whether a tax ID is required during checkout.
3355/// Defaults to `never`.
3356/// You can't set this parameter if `ui_mode` is `custom`.
3357#[derive(Clone, Eq, PartialEq)]
3358#[non_exhaustive]
3359pub enum CreatePaymentLinkTaxIdCollectionRequired {
3360    IfSupported,
3361    Never,
3362    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3363    Unknown(String),
3364}
3365impl CreatePaymentLinkTaxIdCollectionRequired {
3366    pub fn as_str(&self) -> &str {
3367        use CreatePaymentLinkTaxIdCollectionRequired::*;
3368        match self {
3369            IfSupported => "if_supported",
3370            Never => "never",
3371            Unknown(v) => v,
3372        }
3373    }
3374}
3375
3376impl std::str::FromStr for CreatePaymentLinkTaxIdCollectionRequired {
3377    type Err = std::convert::Infallible;
3378    fn from_str(s: &str) -> Result<Self, Self::Err> {
3379        use CreatePaymentLinkTaxIdCollectionRequired::*;
3380        match s {
3381            "if_supported" => Ok(IfSupported),
3382            "never" => Ok(Never),
3383            v => {
3384                tracing::warn!(
3385                    "Unknown value '{}' for enum '{}'",
3386                    v,
3387                    "CreatePaymentLinkTaxIdCollectionRequired"
3388                );
3389                Ok(Unknown(v.to_owned()))
3390            }
3391        }
3392    }
3393}
3394impl std::fmt::Display for CreatePaymentLinkTaxIdCollectionRequired {
3395    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3396        f.write_str(self.as_str())
3397    }
3398}
3399
3400#[cfg(not(feature = "redact-generated-debug"))]
3401impl std::fmt::Debug for CreatePaymentLinkTaxIdCollectionRequired {
3402    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3403        f.write_str(self.as_str())
3404    }
3405}
3406#[cfg(feature = "redact-generated-debug")]
3407impl std::fmt::Debug for CreatePaymentLinkTaxIdCollectionRequired {
3408    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3409        f.debug_struct(stringify!(CreatePaymentLinkTaxIdCollectionRequired)).finish_non_exhaustive()
3410    }
3411}
3412impl serde::Serialize for CreatePaymentLinkTaxIdCollectionRequired {
3413    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3414    where
3415        S: serde::Serializer,
3416    {
3417        serializer.serialize_str(self.as_str())
3418    }
3419}
3420#[cfg(feature = "deserialize")]
3421impl<'de> serde::Deserialize<'de> for CreatePaymentLinkTaxIdCollectionRequired {
3422    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3423        use std::str::FromStr;
3424        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3425        Ok(Self::from_str(&s).expect("infallible"))
3426    }
3427}
3428/// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
3429#[derive(Clone, Eq, PartialEq)]
3430#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3431#[derive(serde::Serialize)]
3432pub struct CreatePaymentLinkTransferData {
3433    /// The amount that will be transferred automatically when a charge succeeds.
3434    #[serde(skip_serializing_if = "Option::is_none")]
3435    pub amount: Option<i64>,
3436    /// If specified, successful charges will be attributed to the destination
3437    /// account for tax reporting, and the funds from charges will be transferred
3438    /// to the destination account. The ID of the resulting transfer will be
3439    /// returned on the successful charge's `transfer` field.
3440    pub destination: String,
3441}
3442#[cfg(feature = "redact-generated-debug")]
3443impl std::fmt::Debug for CreatePaymentLinkTransferData {
3444    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3445        f.debug_struct("CreatePaymentLinkTransferData").finish_non_exhaustive()
3446    }
3447}
3448impl CreatePaymentLinkTransferData {
3449    pub fn new(destination: impl Into<String>) -> Self {
3450        Self { amount: None, destination: destination.into() }
3451    }
3452}
3453/// Creates a payment link.
3454#[derive(Clone)]
3455#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3456#[derive(serde::Serialize)]
3457pub struct CreatePaymentLink {
3458    inner: CreatePaymentLinkBuilder,
3459}
3460#[cfg(feature = "redact-generated-debug")]
3461impl std::fmt::Debug for CreatePaymentLink {
3462    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3463        f.debug_struct("CreatePaymentLink").finish_non_exhaustive()
3464    }
3465}
3466impl CreatePaymentLink {
3467    /// Construct a new `CreatePaymentLink`.
3468    pub fn new(line_items: impl Into<Vec<CreatePaymentLinkLineItems>>) -> Self {
3469        Self { inner: CreatePaymentLinkBuilder::new(line_items.into()) }
3470    }
3471    /// Behavior after the purchase is complete.
3472    pub fn after_completion(
3473        mut self,
3474        after_completion: impl Into<CreatePaymentLinkAfterCompletion>,
3475    ) -> Self {
3476        self.inner.after_completion = Some(after_completion.into());
3477        self
3478    }
3479    /// Enables user redeemable promotion codes.
3480    pub fn allow_promotion_codes(mut self, allow_promotion_codes: impl Into<bool>) -> Self {
3481        self.inner.allow_promotion_codes = Some(allow_promotion_codes.into());
3482        self
3483    }
3484    /// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account.
3485    /// Can only be applied when there are no line items with recurring prices.
3486    pub fn application_fee_amount(mut self, application_fee_amount: impl Into<i64>) -> Self {
3487        self.inner.application_fee_amount = Some(application_fee_amount.into());
3488        self
3489    }
3490    /// A non-negative decimal between 0 and 100, with at most two decimal places.
3491    /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
3492    /// There must be at least 1 line item with a recurring price to use this field.
3493    pub fn application_fee_percent(mut self, application_fee_percent: impl Into<f64>) -> Self {
3494        self.inner.application_fee_percent = Some(application_fee_percent.into());
3495        self
3496    }
3497    /// Configuration for automatic tax collection.
3498    pub fn automatic_tax(
3499        mut self,
3500        automatic_tax: impl Into<CreatePaymentLinkAutomaticTax>,
3501    ) -> Self {
3502        self.inner.automatic_tax = Some(automatic_tax.into());
3503        self
3504    }
3505    /// Configuration for collecting the customer's billing address. Defaults to `auto`.
3506    pub fn billing_address_collection(
3507        mut self,
3508        billing_address_collection: impl Into<stripe_shared::PaymentLinkBillingAddressCollection>,
3509    ) -> Self {
3510        self.inner.billing_address_collection = Some(billing_address_collection.into());
3511        self
3512    }
3513    /// Configure fields to gather active consent from customers.
3514    pub fn consent_collection(
3515        mut self,
3516        consent_collection: impl Into<CreatePaymentLinkConsentCollection>,
3517    ) -> Self {
3518        self.inner.consent_collection = Some(consent_collection.into());
3519        self
3520    }
3521    /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
3522    /// Must be a [supported currency](https://stripe.com/docs/currencies) and supported by each line item's price.
3523    pub fn currency(mut self, currency: impl Into<stripe_types::Currency>) -> Self {
3524        self.inner.currency = Some(currency.into());
3525        self
3526    }
3527    /// Collect additional information from your customer using custom fields.
3528    /// Up to 3 fields are supported.
3529    /// You can't set this parameter if `ui_mode` is `custom`.
3530    pub fn custom_fields(
3531        mut self,
3532        custom_fields: impl Into<Vec<CreatePaymentLinkCustomFields>>,
3533    ) -> Self {
3534        self.inner.custom_fields = Some(custom_fields.into());
3535        self
3536    }
3537    /// Display additional text for your customers using custom text.
3538    /// You can't set this parameter if `ui_mode` is `custom`.
3539    pub fn custom_text(mut self, custom_text: impl Into<CustomTextParam>) -> Self {
3540        self.inner.custom_text = Some(custom_text.into());
3541        self
3542    }
3543    /// Configures whether [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link create a [Customer](https://docs.stripe.com/api/customers).
3544    pub fn customer_creation(
3545        mut self,
3546        customer_creation: impl Into<CreatePaymentLinkCustomerCreation>,
3547    ) -> Self {
3548        self.inner.customer_creation = Some(customer_creation.into());
3549        self
3550    }
3551    /// Specifies which fields in the response should be expanded.
3552    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
3553        self.inner.expand = Some(expand.into());
3554        self
3555    }
3556    /// The custom message to be displayed to a customer when a payment link is no longer active.
3557    pub fn inactive_message(mut self, inactive_message: impl Into<String>) -> Self {
3558        self.inner.inactive_message = Some(inactive_message.into());
3559        self
3560    }
3561    /// Generate a post-purchase Invoice for one-time payments.
3562    pub fn invoice_creation(
3563        mut self,
3564        invoice_creation: impl Into<CreatePaymentLinkInvoiceCreation>,
3565    ) -> Self {
3566        self.inner.invoice_creation = Some(invoice_creation.into());
3567        self
3568    }
3569    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
3570    /// This can be useful for storing additional information about the object in a structured format.
3571    /// Individual keys can be unset by posting an empty value to them.
3572    /// All keys can be unset by posting an empty value to `metadata`.
3573    /// Metadata associated with this Payment Link will automatically be copied to [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link.
3574    pub fn metadata(
3575        mut self,
3576        metadata: impl Into<std::collections::HashMap<String, String>>,
3577    ) -> Self {
3578        self.inner.metadata = Some(metadata.into());
3579        self
3580    }
3581    /// Controls settings applied for collecting the customer's name.
3582    pub fn name_collection(mut self, name_collection: impl Into<NameCollectionParams>) -> Self {
3583        self.inner.name_collection = Some(name_collection.into());
3584        self
3585    }
3586    /// The account on behalf of which to charge.
3587    pub fn on_behalf_of(mut self, on_behalf_of: impl Into<String>) -> Self {
3588        self.inner.on_behalf_of = Some(on_behalf_of.into());
3589        self
3590    }
3591    /// A list of optional items the customer can add to their order at checkout.
3592    /// Use this parameter to pass one-time or recurring [Prices](https://docs.stripe.com/api/prices).
3593    /// There is a maximum of 10 optional items allowed on a payment link, and the existing limits on the number of line items allowed on a payment link apply to the combined number of line items and optional items.
3594    /// There is a maximum of 20 combined line items and optional items.
3595    pub fn optional_items(mut self, optional_items: impl Into<Vec<OptionalItemParams>>) -> Self {
3596        self.inner.optional_items = Some(optional_items.into());
3597        self
3598    }
3599    /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
3600    pub fn payment_intent_data(
3601        mut self,
3602        payment_intent_data: impl Into<CreatePaymentLinkPaymentIntentData>,
3603    ) -> Self {
3604        self.inner.payment_intent_data = Some(payment_intent_data.into());
3605        self
3606    }
3607    /// Specify whether Checkout should collect a payment method.
3608    /// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
3609    ///
3610    /// Can only be set in `subscription` mode. Defaults to `always`.
3611    ///
3612    /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://docs.stripe.com/payments/checkout/free-trials).
3613    pub fn payment_method_collection(
3614        mut self,
3615        payment_method_collection: impl Into<CreatePaymentLinkPaymentMethodCollection>,
3616    ) -> Self {
3617        self.inner.payment_method_collection = Some(payment_method_collection.into());
3618        self
3619    }
3620    /// The list of payment method types that customers can use.
3621    /// If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://docs.stripe.com/payments/payment-methods/integration-options#payment-method-product-support)).
3622    pub fn payment_method_types(
3623        mut self,
3624        payment_method_types: impl Into<Vec<stripe_shared::PaymentLinkPaymentMethodTypes>>,
3625    ) -> Self {
3626        self.inner.payment_method_types = Some(payment_method_types.into());
3627        self
3628    }
3629    /// Controls phone number collection settings during checkout.
3630    ///
3631    /// We recommend that you review your privacy policy and check with your legal contacts.
3632    pub fn phone_number_collection(
3633        mut self,
3634        phone_number_collection: impl Into<PhoneNumberCollectionParams>,
3635    ) -> Self {
3636        self.inner.phone_number_collection = Some(phone_number_collection.into());
3637        self
3638    }
3639    /// Settings that restrict the usage of a payment link.
3640    pub fn restrictions(mut self, restrictions: impl Into<RestrictionsParams>) -> Self {
3641        self.inner.restrictions = Some(restrictions.into());
3642        self
3643    }
3644    /// Configuration for collecting the customer's shipping address.
3645    pub fn shipping_address_collection(
3646        mut self,
3647        shipping_address_collection: impl Into<CreatePaymentLinkShippingAddressCollection>,
3648    ) -> Self {
3649        self.inner.shipping_address_collection = Some(shipping_address_collection.into());
3650        self
3651    }
3652    /// The shipping rate options to apply to [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link.
3653    pub fn shipping_options(
3654        mut self,
3655        shipping_options: impl Into<Vec<CreatePaymentLinkShippingOptions>>,
3656    ) -> Self {
3657        self.inner.shipping_options = Some(shipping_options.into());
3658        self
3659    }
3660    /// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button.
3661    /// Changing this value will also affect the hostname in the [url](https://docs.stripe.com/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`).
3662    pub fn submit_type(
3663        mut self,
3664        submit_type: impl Into<stripe_shared::PaymentLinkSubmitType>,
3665    ) -> Self {
3666        self.inner.submit_type = Some(submit_type.into());
3667        self
3668    }
3669    /// When creating a subscription, the specified configuration data will be used.
3670    /// There must be at least one line item with a recurring price to use `subscription_data`.
3671    pub fn subscription_data(
3672        mut self,
3673        subscription_data: impl Into<CreatePaymentLinkSubscriptionData>,
3674    ) -> Self {
3675        self.inner.subscription_data = Some(subscription_data.into());
3676        self
3677    }
3678    /// Controls tax ID collection during checkout.
3679    pub fn tax_id_collection(
3680        mut self,
3681        tax_id_collection: impl Into<CreatePaymentLinkTaxIdCollection>,
3682    ) -> Self {
3683        self.inner.tax_id_collection = Some(tax_id_collection.into());
3684        self
3685    }
3686    /// The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
3687    pub fn transfer_data(
3688        mut self,
3689        transfer_data: impl Into<CreatePaymentLinkTransferData>,
3690    ) -> Self {
3691        self.inner.transfer_data = Some(transfer_data.into());
3692        self
3693    }
3694}
3695impl CreatePaymentLink {
3696    /// Send the request and return the deserialized response.
3697    pub async fn send<C: StripeClient>(
3698        &self,
3699        client: &C,
3700    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3701        self.customize().send(client).await
3702    }
3703
3704    /// Send the request and return the deserialized response, blocking until completion.
3705    pub fn send_blocking<C: StripeBlockingClient>(
3706        &self,
3707        client: &C,
3708    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3709        self.customize().send_blocking(client)
3710    }
3711}
3712
3713impl StripeRequest for CreatePaymentLink {
3714    type Output = stripe_shared::PaymentLink;
3715
3716    fn build(&self) -> RequestBuilder {
3717        RequestBuilder::new(StripeMethod::Post, "/payment_links").form(&self.inner)
3718    }
3719}
3720#[derive(Clone)]
3721#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3722#[derive(serde::Serialize)]
3723struct UpdatePaymentLinkBuilder {
3724    #[serde(skip_serializing_if = "Option::is_none")]
3725    active: Option<bool>,
3726    #[serde(skip_serializing_if = "Option::is_none")]
3727    after_completion: Option<UpdatePaymentLinkAfterCompletion>,
3728    #[serde(skip_serializing_if = "Option::is_none")]
3729    allow_promotion_codes: Option<bool>,
3730    #[serde(skip_serializing_if = "Option::is_none")]
3731    automatic_tax: Option<UpdatePaymentLinkAutomaticTax>,
3732    #[serde(skip_serializing_if = "Option::is_none")]
3733    billing_address_collection: Option<stripe_shared::PaymentLinkBillingAddressCollection>,
3734    #[serde(skip_serializing_if = "Option::is_none")]
3735    custom_fields: Option<Vec<UpdatePaymentLinkCustomFields>>,
3736    #[serde(skip_serializing_if = "Option::is_none")]
3737    custom_text: Option<CustomTextParam>,
3738    #[serde(skip_serializing_if = "Option::is_none")]
3739    customer_creation: Option<UpdatePaymentLinkCustomerCreation>,
3740    #[serde(skip_serializing_if = "Option::is_none")]
3741    expand: Option<Vec<String>>,
3742    #[serde(skip_serializing_if = "Option::is_none")]
3743    inactive_message: Option<String>,
3744    #[serde(skip_serializing_if = "Option::is_none")]
3745    invoice_creation: Option<UpdatePaymentLinkInvoiceCreation>,
3746    #[serde(skip_serializing_if = "Option::is_none")]
3747    line_items: Option<Vec<UpdatePaymentLinkLineItems>>,
3748    #[serde(skip_serializing_if = "Option::is_none")]
3749    metadata: Option<std::collections::HashMap<String, String>>,
3750    #[serde(skip_serializing_if = "Option::is_none")]
3751    name_collection: Option<NameCollectionParams>,
3752    #[serde(skip_serializing_if = "Option::is_none")]
3753    optional_items: Option<Vec<OptionalItemParams>>,
3754    #[serde(skip_serializing_if = "Option::is_none")]
3755    payment_intent_data: Option<UpdatePaymentLinkPaymentIntentData>,
3756    #[serde(skip_serializing_if = "Option::is_none")]
3757    payment_method_collection: Option<UpdatePaymentLinkPaymentMethodCollection>,
3758    #[serde(skip_serializing_if = "Option::is_none")]
3759    payment_method_types: Option<Vec<stripe_shared::PaymentLinkPaymentMethodTypes>>,
3760    #[serde(skip_serializing_if = "Option::is_none")]
3761    phone_number_collection: Option<PhoneNumberCollectionParams>,
3762    #[serde(skip_serializing_if = "Option::is_none")]
3763    restrictions: Option<RestrictionsParams>,
3764    #[serde(skip_serializing_if = "Option::is_none")]
3765    shipping_address_collection: Option<UpdatePaymentLinkShippingAddressCollection>,
3766    #[serde(skip_serializing_if = "Option::is_none")]
3767    submit_type: Option<stripe_shared::PaymentLinkSubmitType>,
3768    #[serde(skip_serializing_if = "Option::is_none")]
3769    subscription_data: Option<UpdatePaymentLinkSubscriptionData>,
3770    #[serde(skip_serializing_if = "Option::is_none")]
3771    tax_id_collection: Option<UpdatePaymentLinkTaxIdCollection>,
3772}
3773#[cfg(feature = "redact-generated-debug")]
3774impl std::fmt::Debug for UpdatePaymentLinkBuilder {
3775    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3776        f.debug_struct("UpdatePaymentLinkBuilder").finish_non_exhaustive()
3777    }
3778}
3779impl UpdatePaymentLinkBuilder {
3780    fn new() -> Self {
3781        Self {
3782            active: None,
3783            after_completion: None,
3784            allow_promotion_codes: None,
3785            automatic_tax: None,
3786            billing_address_collection: None,
3787            custom_fields: None,
3788            custom_text: None,
3789            customer_creation: None,
3790            expand: None,
3791            inactive_message: None,
3792            invoice_creation: None,
3793            line_items: None,
3794            metadata: None,
3795            name_collection: None,
3796            optional_items: None,
3797            payment_intent_data: None,
3798            payment_method_collection: None,
3799            payment_method_types: None,
3800            phone_number_collection: None,
3801            restrictions: None,
3802            shipping_address_collection: None,
3803            submit_type: None,
3804            subscription_data: None,
3805            tax_id_collection: None,
3806        }
3807    }
3808}
3809/// Behavior after the purchase is complete.
3810#[derive(Clone, Eq, PartialEq)]
3811#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3812#[derive(serde::Serialize)]
3813pub struct UpdatePaymentLinkAfterCompletion {
3814    /// Configuration when `type=hosted_confirmation`.
3815    #[serde(skip_serializing_if = "Option::is_none")]
3816    pub hosted_confirmation: Option<AfterCompletionConfirmationPageParams>,
3817    /// Configuration when `type=redirect`.
3818    #[serde(skip_serializing_if = "Option::is_none")]
3819    pub redirect: Option<AfterCompletionRedirectParams>,
3820    /// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`.
3821    #[serde(rename = "type")]
3822    pub type_: UpdatePaymentLinkAfterCompletionType,
3823}
3824#[cfg(feature = "redact-generated-debug")]
3825impl std::fmt::Debug for UpdatePaymentLinkAfterCompletion {
3826    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3827        f.debug_struct("UpdatePaymentLinkAfterCompletion").finish_non_exhaustive()
3828    }
3829}
3830impl UpdatePaymentLinkAfterCompletion {
3831    pub fn new(type_: impl Into<UpdatePaymentLinkAfterCompletionType>) -> Self {
3832        Self { hosted_confirmation: None, redirect: None, type_: type_.into() }
3833    }
3834}
3835/// The specified behavior after the purchase is complete. Either `redirect` or `hosted_confirmation`.
3836#[derive(Clone, Eq, PartialEq)]
3837#[non_exhaustive]
3838pub enum UpdatePaymentLinkAfterCompletionType {
3839    HostedConfirmation,
3840    Redirect,
3841    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3842    Unknown(String),
3843}
3844impl UpdatePaymentLinkAfterCompletionType {
3845    pub fn as_str(&self) -> &str {
3846        use UpdatePaymentLinkAfterCompletionType::*;
3847        match self {
3848            HostedConfirmation => "hosted_confirmation",
3849            Redirect => "redirect",
3850            Unknown(v) => v,
3851        }
3852    }
3853}
3854
3855impl std::str::FromStr for UpdatePaymentLinkAfterCompletionType {
3856    type Err = std::convert::Infallible;
3857    fn from_str(s: &str) -> Result<Self, Self::Err> {
3858        use UpdatePaymentLinkAfterCompletionType::*;
3859        match s {
3860            "hosted_confirmation" => Ok(HostedConfirmation),
3861            "redirect" => Ok(Redirect),
3862            v => {
3863                tracing::warn!(
3864                    "Unknown value '{}' for enum '{}'",
3865                    v,
3866                    "UpdatePaymentLinkAfterCompletionType"
3867                );
3868                Ok(Unknown(v.to_owned()))
3869            }
3870        }
3871    }
3872}
3873impl std::fmt::Display for UpdatePaymentLinkAfterCompletionType {
3874    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3875        f.write_str(self.as_str())
3876    }
3877}
3878
3879#[cfg(not(feature = "redact-generated-debug"))]
3880impl std::fmt::Debug for UpdatePaymentLinkAfterCompletionType {
3881    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3882        f.write_str(self.as_str())
3883    }
3884}
3885#[cfg(feature = "redact-generated-debug")]
3886impl std::fmt::Debug for UpdatePaymentLinkAfterCompletionType {
3887    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3888        f.debug_struct(stringify!(UpdatePaymentLinkAfterCompletionType)).finish_non_exhaustive()
3889    }
3890}
3891impl serde::Serialize for UpdatePaymentLinkAfterCompletionType {
3892    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3893    where
3894        S: serde::Serializer,
3895    {
3896        serializer.serialize_str(self.as_str())
3897    }
3898}
3899#[cfg(feature = "deserialize")]
3900impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkAfterCompletionType {
3901    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3902        use std::str::FromStr;
3903        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3904        Ok(Self::from_str(&s).expect("infallible"))
3905    }
3906}
3907/// Configuration for automatic tax collection.
3908#[derive(Clone, Eq, PartialEq)]
3909#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3910#[derive(serde::Serialize)]
3911pub struct UpdatePaymentLinkAutomaticTax {
3912    /// Set to `true` to [calculate tax automatically](https://docs.stripe.com/tax) using the customer's location.
3913    ///
3914    /// Enabling this parameter causes the payment link to collect any billing address information necessary for tax calculation.
3915    pub enabled: bool,
3916    /// The account that's liable for tax.
3917    /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
3918    /// The tax transaction is returned in the report of the connected account.
3919    #[serde(skip_serializing_if = "Option::is_none")]
3920    pub liability: Option<UpdatePaymentLinkAutomaticTaxLiability>,
3921}
3922#[cfg(feature = "redact-generated-debug")]
3923impl std::fmt::Debug for UpdatePaymentLinkAutomaticTax {
3924    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3925        f.debug_struct("UpdatePaymentLinkAutomaticTax").finish_non_exhaustive()
3926    }
3927}
3928impl UpdatePaymentLinkAutomaticTax {
3929    pub fn new(enabled: impl Into<bool>) -> Self {
3930        Self { enabled: enabled.into(), liability: None }
3931    }
3932}
3933/// The account that's liable for tax.
3934/// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
3935/// The tax transaction is returned in the report of the connected account.
3936#[derive(Clone, Eq, PartialEq)]
3937#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3938#[derive(serde::Serialize)]
3939pub struct UpdatePaymentLinkAutomaticTaxLiability {
3940    /// The connected account being referenced when `type` is `account`.
3941    #[serde(skip_serializing_if = "Option::is_none")]
3942    pub account: Option<String>,
3943    /// Type of the account referenced in the request.
3944    #[serde(rename = "type")]
3945    pub type_: UpdatePaymentLinkAutomaticTaxLiabilityType,
3946}
3947#[cfg(feature = "redact-generated-debug")]
3948impl std::fmt::Debug for UpdatePaymentLinkAutomaticTaxLiability {
3949    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3950        f.debug_struct("UpdatePaymentLinkAutomaticTaxLiability").finish_non_exhaustive()
3951    }
3952}
3953impl UpdatePaymentLinkAutomaticTaxLiability {
3954    pub fn new(type_: impl Into<UpdatePaymentLinkAutomaticTaxLiabilityType>) -> Self {
3955        Self { account: None, type_: type_.into() }
3956    }
3957}
3958/// Type of the account referenced in the request.
3959#[derive(Clone, Eq, PartialEq)]
3960#[non_exhaustive]
3961pub enum UpdatePaymentLinkAutomaticTaxLiabilityType {
3962    Account,
3963    Self_,
3964    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3965    Unknown(String),
3966}
3967impl UpdatePaymentLinkAutomaticTaxLiabilityType {
3968    pub fn as_str(&self) -> &str {
3969        use UpdatePaymentLinkAutomaticTaxLiabilityType::*;
3970        match self {
3971            Account => "account",
3972            Self_ => "self",
3973            Unknown(v) => v,
3974        }
3975    }
3976}
3977
3978impl std::str::FromStr for UpdatePaymentLinkAutomaticTaxLiabilityType {
3979    type Err = std::convert::Infallible;
3980    fn from_str(s: &str) -> Result<Self, Self::Err> {
3981        use UpdatePaymentLinkAutomaticTaxLiabilityType::*;
3982        match s {
3983            "account" => Ok(Account),
3984            "self" => Ok(Self_),
3985            v => {
3986                tracing::warn!(
3987                    "Unknown value '{}' for enum '{}'",
3988                    v,
3989                    "UpdatePaymentLinkAutomaticTaxLiabilityType"
3990                );
3991                Ok(Unknown(v.to_owned()))
3992            }
3993        }
3994    }
3995}
3996impl std::fmt::Display for UpdatePaymentLinkAutomaticTaxLiabilityType {
3997    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3998        f.write_str(self.as_str())
3999    }
4000}
4001
4002#[cfg(not(feature = "redact-generated-debug"))]
4003impl std::fmt::Debug for UpdatePaymentLinkAutomaticTaxLiabilityType {
4004    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4005        f.write_str(self.as_str())
4006    }
4007}
4008#[cfg(feature = "redact-generated-debug")]
4009impl std::fmt::Debug for UpdatePaymentLinkAutomaticTaxLiabilityType {
4010    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4011        f.debug_struct(stringify!(UpdatePaymentLinkAutomaticTaxLiabilityType))
4012            .finish_non_exhaustive()
4013    }
4014}
4015impl serde::Serialize for UpdatePaymentLinkAutomaticTaxLiabilityType {
4016    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4017    where
4018        S: serde::Serializer,
4019    {
4020        serializer.serialize_str(self.as_str())
4021    }
4022}
4023#[cfg(feature = "deserialize")]
4024impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkAutomaticTaxLiabilityType {
4025    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4026        use std::str::FromStr;
4027        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4028        Ok(Self::from_str(&s).expect("infallible"))
4029    }
4030}
4031/// Collect additional information from your customer using custom fields.
4032/// Up to 3 fields are supported.
4033/// You can't set this parameter if `ui_mode` is `custom`.
4034#[derive(Clone, Eq, PartialEq)]
4035#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4036#[derive(serde::Serialize)]
4037pub struct UpdatePaymentLinkCustomFields {
4038    /// Configuration for `type=dropdown` fields.
4039    #[serde(skip_serializing_if = "Option::is_none")]
4040    pub dropdown: Option<CustomFieldDropdownParam>,
4041    /// String of your choice that your integration can use to reconcile this field.
4042    /// Must be unique to this field, alphanumeric, and up to 200 characters.
4043    pub key: String,
4044    /// The label for the field, displayed to the customer.
4045    pub label: UpdatePaymentLinkCustomFieldsLabel,
4046    /// Configuration for `type=numeric` fields.
4047    #[serde(skip_serializing_if = "Option::is_none")]
4048    pub numeric: Option<UpdatePaymentLinkCustomFieldsNumeric>,
4049    /// Whether the customer is required to complete the field before completing the Checkout Session.
4050    /// Defaults to `false`.
4051    #[serde(skip_serializing_if = "Option::is_none")]
4052    pub optional: Option<bool>,
4053    /// Configuration for `type=text` fields.
4054    #[serde(skip_serializing_if = "Option::is_none")]
4055    pub text: Option<UpdatePaymentLinkCustomFieldsText>,
4056    /// The type of the field.
4057    #[serde(rename = "type")]
4058    pub type_: UpdatePaymentLinkCustomFieldsType,
4059}
4060#[cfg(feature = "redact-generated-debug")]
4061impl std::fmt::Debug for UpdatePaymentLinkCustomFields {
4062    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4063        f.debug_struct("UpdatePaymentLinkCustomFields").finish_non_exhaustive()
4064    }
4065}
4066impl UpdatePaymentLinkCustomFields {
4067    pub fn new(
4068        key: impl Into<String>,
4069        label: impl Into<UpdatePaymentLinkCustomFieldsLabel>,
4070        type_: impl Into<UpdatePaymentLinkCustomFieldsType>,
4071    ) -> Self {
4072        Self {
4073            dropdown: None,
4074            key: key.into(),
4075            label: label.into(),
4076            numeric: None,
4077            optional: None,
4078            text: None,
4079            type_: type_.into(),
4080        }
4081    }
4082}
4083/// The label for the field, displayed to the customer.
4084#[derive(Clone, Eq, PartialEq)]
4085#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4086#[derive(serde::Serialize)]
4087pub struct UpdatePaymentLinkCustomFieldsLabel {
4088    /// Custom text for the label, displayed to the customer. Up to 50 characters.
4089    pub custom: String,
4090    /// The type of the label.
4091    #[serde(rename = "type")]
4092    pub type_: UpdatePaymentLinkCustomFieldsLabelType,
4093}
4094#[cfg(feature = "redact-generated-debug")]
4095impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsLabel {
4096    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4097        f.debug_struct("UpdatePaymentLinkCustomFieldsLabel").finish_non_exhaustive()
4098    }
4099}
4100impl UpdatePaymentLinkCustomFieldsLabel {
4101    pub fn new(
4102        custom: impl Into<String>,
4103        type_: impl Into<UpdatePaymentLinkCustomFieldsLabelType>,
4104    ) -> Self {
4105        Self { custom: custom.into(), type_: type_.into() }
4106    }
4107}
4108/// The type of the label.
4109#[derive(Clone, Eq, PartialEq)]
4110#[non_exhaustive]
4111pub enum UpdatePaymentLinkCustomFieldsLabelType {
4112    Custom,
4113    /// An unrecognized value from Stripe. Should not be used as a request parameter.
4114    Unknown(String),
4115}
4116impl UpdatePaymentLinkCustomFieldsLabelType {
4117    pub fn as_str(&self) -> &str {
4118        use UpdatePaymentLinkCustomFieldsLabelType::*;
4119        match self {
4120            Custom => "custom",
4121            Unknown(v) => v,
4122        }
4123    }
4124}
4125
4126impl std::str::FromStr for UpdatePaymentLinkCustomFieldsLabelType {
4127    type Err = std::convert::Infallible;
4128    fn from_str(s: &str) -> Result<Self, Self::Err> {
4129        use UpdatePaymentLinkCustomFieldsLabelType::*;
4130        match s {
4131            "custom" => Ok(Custom),
4132            v => {
4133                tracing::warn!(
4134                    "Unknown value '{}' for enum '{}'",
4135                    v,
4136                    "UpdatePaymentLinkCustomFieldsLabelType"
4137                );
4138                Ok(Unknown(v.to_owned()))
4139            }
4140        }
4141    }
4142}
4143impl std::fmt::Display for UpdatePaymentLinkCustomFieldsLabelType {
4144    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4145        f.write_str(self.as_str())
4146    }
4147}
4148
4149#[cfg(not(feature = "redact-generated-debug"))]
4150impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsLabelType {
4151    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4152        f.write_str(self.as_str())
4153    }
4154}
4155#[cfg(feature = "redact-generated-debug")]
4156impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsLabelType {
4157    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4158        f.debug_struct(stringify!(UpdatePaymentLinkCustomFieldsLabelType)).finish_non_exhaustive()
4159    }
4160}
4161impl serde::Serialize for UpdatePaymentLinkCustomFieldsLabelType {
4162    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4163    where
4164        S: serde::Serializer,
4165    {
4166        serializer.serialize_str(self.as_str())
4167    }
4168}
4169#[cfg(feature = "deserialize")]
4170impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkCustomFieldsLabelType {
4171    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4172        use std::str::FromStr;
4173        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4174        Ok(Self::from_str(&s).expect("infallible"))
4175    }
4176}
4177/// Configuration for `type=numeric` fields.
4178#[derive(Clone, Eq, PartialEq)]
4179#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4180#[derive(serde::Serialize)]
4181pub struct UpdatePaymentLinkCustomFieldsNumeric {
4182    /// The value that pre-fills the field on the payment page.
4183    #[serde(skip_serializing_if = "Option::is_none")]
4184    pub default_value: Option<String>,
4185    /// The maximum character length constraint for the customer's input.
4186    #[serde(skip_serializing_if = "Option::is_none")]
4187    pub maximum_length: Option<i64>,
4188    /// The minimum character length requirement for the customer's input.
4189    #[serde(skip_serializing_if = "Option::is_none")]
4190    pub minimum_length: Option<i64>,
4191}
4192#[cfg(feature = "redact-generated-debug")]
4193impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsNumeric {
4194    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4195        f.debug_struct("UpdatePaymentLinkCustomFieldsNumeric").finish_non_exhaustive()
4196    }
4197}
4198impl UpdatePaymentLinkCustomFieldsNumeric {
4199    pub fn new() -> Self {
4200        Self { default_value: None, maximum_length: None, minimum_length: None }
4201    }
4202}
4203impl Default for UpdatePaymentLinkCustomFieldsNumeric {
4204    fn default() -> Self {
4205        Self::new()
4206    }
4207}
4208/// Configuration for `type=text` fields.
4209#[derive(Clone, Eq, PartialEq)]
4210#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4211#[derive(serde::Serialize)]
4212pub struct UpdatePaymentLinkCustomFieldsText {
4213    /// The value that pre-fills the field on the payment page.
4214    #[serde(skip_serializing_if = "Option::is_none")]
4215    pub default_value: Option<String>,
4216    /// The maximum character length constraint for the customer's input.
4217    #[serde(skip_serializing_if = "Option::is_none")]
4218    pub maximum_length: Option<i64>,
4219    /// The minimum character length requirement for the customer's input.
4220    #[serde(skip_serializing_if = "Option::is_none")]
4221    pub minimum_length: Option<i64>,
4222}
4223#[cfg(feature = "redact-generated-debug")]
4224impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsText {
4225    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4226        f.debug_struct("UpdatePaymentLinkCustomFieldsText").finish_non_exhaustive()
4227    }
4228}
4229impl UpdatePaymentLinkCustomFieldsText {
4230    pub fn new() -> Self {
4231        Self { default_value: None, maximum_length: None, minimum_length: None }
4232    }
4233}
4234impl Default for UpdatePaymentLinkCustomFieldsText {
4235    fn default() -> Self {
4236        Self::new()
4237    }
4238}
4239/// The type of the field.
4240#[derive(Clone, Eq, PartialEq)]
4241#[non_exhaustive]
4242pub enum UpdatePaymentLinkCustomFieldsType {
4243    Dropdown,
4244    Numeric,
4245    Text,
4246    /// An unrecognized value from Stripe. Should not be used as a request parameter.
4247    Unknown(String),
4248}
4249impl UpdatePaymentLinkCustomFieldsType {
4250    pub fn as_str(&self) -> &str {
4251        use UpdatePaymentLinkCustomFieldsType::*;
4252        match self {
4253            Dropdown => "dropdown",
4254            Numeric => "numeric",
4255            Text => "text",
4256            Unknown(v) => v,
4257        }
4258    }
4259}
4260
4261impl std::str::FromStr for UpdatePaymentLinkCustomFieldsType {
4262    type Err = std::convert::Infallible;
4263    fn from_str(s: &str) -> Result<Self, Self::Err> {
4264        use UpdatePaymentLinkCustomFieldsType::*;
4265        match s {
4266            "dropdown" => Ok(Dropdown),
4267            "numeric" => Ok(Numeric),
4268            "text" => Ok(Text),
4269            v => {
4270                tracing::warn!(
4271                    "Unknown value '{}' for enum '{}'",
4272                    v,
4273                    "UpdatePaymentLinkCustomFieldsType"
4274                );
4275                Ok(Unknown(v.to_owned()))
4276            }
4277        }
4278    }
4279}
4280impl std::fmt::Display for UpdatePaymentLinkCustomFieldsType {
4281    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4282        f.write_str(self.as_str())
4283    }
4284}
4285
4286#[cfg(not(feature = "redact-generated-debug"))]
4287impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsType {
4288    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4289        f.write_str(self.as_str())
4290    }
4291}
4292#[cfg(feature = "redact-generated-debug")]
4293impl std::fmt::Debug for UpdatePaymentLinkCustomFieldsType {
4294    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4295        f.debug_struct(stringify!(UpdatePaymentLinkCustomFieldsType)).finish_non_exhaustive()
4296    }
4297}
4298impl serde::Serialize for UpdatePaymentLinkCustomFieldsType {
4299    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4300    where
4301        S: serde::Serializer,
4302    {
4303        serializer.serialize_str(self.as_str())
4304    }
4305}
4306#[cfg(feature = "deserialize")]
4307impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkCustomFieldsType {
4308    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4309        use std::str::FromStr;
4310        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4311        Ok(Self::from_str(&s).expect("infallible"))
4312    }
4313}
4314/// Configures whether [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link create a [Customer](https://docs.stripe.com/api/customers).
4315#[derive(Clone, Eq, PartialEq)]
4316#[non_exhaustive]
4317pub enum UpdatePaymentLinkCustomerCreation {
4318    Always,
4319    IfRequired,
4320    /// An unrecognized value from Stripe. Should not be used as a request parameter.
4321    Unknown(String),
4322}
4323impl UpdatePaymentLinkCustomerCreation {
4324    pub fn as_str(&self) -> &str {
4325        use UpdatePaymentLinkCustomerCreation::*;
4326        match self {
4327            Always => "always",
4328            IfRequired => "if_required",
4329            Unknown(v) => v,
4330        }
4331    }
4332}
4333
4334impl std::str::FromStr for UpdatePaymentLinkCustomerCreation {
4335    type Err = std::convert::Infallible;
4336    fn from_str(s: &str) -> Result<Self, Self::Err> {
4337        use UpdatePaymentLinkCustomerCreation::*;
4338        match s {
4339            "always" => Ok(Always),
4340            "if_required" => Ok(IfRequired),
4341            v => {
4342                tracing::warn!(
4343                    "Unknown value '{}' for enum '{}'",
4344                    v,
4345                    "UpdatePaymentLinkCustomerCreation"
4346                );
4347                Ok(Unknown(v.to_owned()))
4348            }
4349        }
4350    }
4351}
4352impl std::fmt::Display for UpdatePaymentLinkCustomerCreation {
4353    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4354        f.write_str(self.as_str())
4355    }
4356}
4357
4358#[cfg(not(feature = "redact-generated-debug"))]
4359impl std::fmt::Debug for UpdatePaymentLinkCustomerCreation {
4360    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4361        f.write_str(self.as_str())
4362    }
4363}
4364#[cfg(feature = "redact-generated-debug")]
4365impl std::fmt::Debug for UpdatePaymentLinkCustomerCreation {
4366    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4367        f.debug_struct(stringify!(UpdatePaymentLinkCustomerCreation)).finish_non_exhaustive()
4368    }
4369}
4370impl serde::Serialize for UpdatePaymentLinkCustomerCreation {
4371    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4372    where
4373        S: serde::Serializer,
4374    {
4375        serializer.serialize_str(self.as_str())
4376    }
4377}
4378#[cfg(feature = "deserialize")]
4379impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkCustomerCreation {
4380    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4381        use std::str::FromStr;
4382        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4383        Ok(Self::from_str(&s).expect("infallible"))
4384    }
4385}
4386/// Generate a post-purchase Invoice for one-time payments.
4387#[derive(Clone)]
4388#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4389#[derive(serde::Serialize)]
4390pub struct UpdatePaymentLinkInvoiceCreation {
4391    /// Whether the feature is enabled
4392    pub enabled: bool,
4393    /// Invoice PDF configuration.
4394    #[serde(skip_serializing_if = "Option::is_none")]
4395    pub invoice_data: Option<UpdatePaymentLinkInvoiceCreationInvoiceData>,
4396}
4397#[cfg(feature = "redact-generated-debug")]
4398impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreation {
4399    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4400        f.debug_struct("UpdatePaymentLinkInvoiceCreation").finish_non_exhaustive()
4401    }
4402}
4403impl UpdatePaymentLinkInvoiceCreation {
4404    pub fn new(enabled: impl Into<bool>) -> Self {
4405        Self { enabled: enabled.into(), invoice_data: None }
4406    }
4407}
4408/// Invoice PDF configuration.
4409#[derive(Clone)]
4410#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4411#[derive(serde::Serialize)]
4412pub struct UpdatePaymentLinkInvoiceCreationInvoiceData {
4413    /// The account tax IDs associated with the invoice.
4414    #[serde(skip_serializing_if = "Option::is_none")]
4415    pub account_tax_ids: Option<Vec<String>>,
4416    /// Default custom fields to be displayed on invoices for this customer.
4417    #[serde(skip_serializing_if = "Option::is_none")]
4418    pub custom_fields: Option<Vec<CustomFieldParams>>,
4419    /// An arbitrary string attached to the object. Often useful for displaying to users.
4420    #[serde(skip_serializing_if = "Option::is_none")]
4421    pub description: Option<String>,
4422    /// Default footer to be displayed on invoices for this customer.
4423    #[serde(skip_serializing_if = "Option::is_none")]
4424    pub footer: Option<String>,
4425    /// The connected account that issues the invoice.
4426    /// The invoice is presented with the branding and support information of the specified account.
4427    #[serde(skip_serializing_if = "Option::is_none")]
4428    pub issuer: Option<UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer>,
4429    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
4430    /// This can be useful for storing additional information about the object in a structured format.
4431    /// Individual keys can be unset by posting an empty value to them.
4432    /// All keys can be unset by posting an empty value to `metadata`.
4433    #[serde(skip_serializing_if = "Option::is_none")]
4434    pub metadata: Option<std::collections::HashMap<String, String>>,
4435    /// Default options for invoice PDF rendering for this customer.
4436    #[serde(skip_serializing_if = "Option::is_none")]
4437    pub rendering_options: Option<UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions>,
4438}
4439#[cfg(feature = "redact-generated-debug")]
4440impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreationInvoiceData {
4441    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4442        f.debug_struct("UpdatePaymentLinkInvoiceCreationInvoiceData").finish_non_exhaustive()
4443    }
4444}
4445impl UpdatePaymentLinkInvoiceCreationInvoiceData {
4446    pub fn new() -> Self {
4447        Self {
4448            account_tax_ids: None,
4449            custom_fields: None,
4450            description: None,
4451            footer: None,
4452            issuer: None,
4453            metadata: None,
4454            rendering_options: None,
4455        }
4456    }
4457}
4458impl Default for UpdatePaymentLinkInvoiceCreationInvoiceData {
4459    fn default() -> Self {
4460        Self::new()
4461    }
4462}
4463/// The connected account that issues the invoice.
4464/// The invoice is presented with the branding and support information of the specified account.
4465#[derive(Clone, Eq, PartialEq)]
4466#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4467#[derive(serde::Serialize)]
4468pub struct UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer {
4469    /// The connected account being referenced when `type` is `account`.
4470    #[serde(skip_serializing_if = "Option::is_none")]
4471    pub account: Option<String>,
4472    /// Type of the account referenced in the request.
4473    #[serde(rename = "type")]
4474    pub type_: UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType,
4475}
4476#[cfg(feature = "redact-generated-debug")]
4477impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer {
4478    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4479        f.debug_struct("UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer").finish_non_exhaustive()
4480    }
4481}
4482impl UpdatePaymentLinkInvoiceCreationInvoiceDataIssuer {
4483    pub fn new(type_: impl Into<UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType>) -> Self {
4484        Self { account: None, type_: type_.into() }
4485    }
4486}
4487/// Type of the account referenced in the request.
4488#[derive(Clone, Eq, PartialEq)]
4489#[non_exhaustive]
4490pub enum UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4491    Account,
4492    Self_,
4493    /// An unrecognized value from Stripe. Should not be used as a request parameter.
4494    Unknown(String),
4495}
4496impl UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4497    pub fn as_str(&self) -> &str {
4498        use UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*;
4499        match self {
4500            Account => "account",
4501            Self_ => "self",
4502            Unknown(v) => v,
4503        }
4504    }
4505}
4506
4507impl std::str::FromStr for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4508    type Err = std::convert::Infallible;
4509    fn from_str(s: &str) -> Result<Self, Self::Err> {
4510        use UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType::*;
4511        match s {
4512            "account" => Ok(Account),
4513            "self" => Ok(Self_),
4514            v => {
4515                tracing::warn!(
4516                    "Unknown value '{}' for enum '{}'",
4517                    v,
4518                    "UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType"
4519                );
4520                Ok(Unknown(v.to_owned()))
4521            }
4522        }
4523    }
4524}
4525impl std::fmt::Display for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4526    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4527        f.write_str(self.as_str())
4528    }
4529}
4530
4531#[cfg(not(feature = "redact-generated-debug"))]
4532impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4533    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4534        f.write_str(self.as_str())
4535    }
4536}
4537#[cfg(feature = "redact-generated-debug")]
4538impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4539    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4540        f.debug_struct(stringify!(UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType))
4541            .finish_non_exhaustive()
4542    }
4543}
4544impl serde::Serialize for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4545    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4546    where
4547        S: serde::Serializer,
4548    {
4549        serializer.serialize_str(self.as_str())
4550    }
4551}
4552#[cfg(feature = "deserialize")]
4553impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkInvoiceCreationInvoiceDataIssuerType {
4554    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4555        use std::str::FromStr;
4556        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4557        Ok(Self::from_str(&s).expect("infallible"))
4558    }
4559}
4560/// Default options for invoice PDF rendering for this customer.
4561#[derive(Clone, Eq, PartialEq)]
4562#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4563#[derive(serde::Serialize)]
4564pub struct UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
4565    /// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
4566    /// One of `exclude_tax` or `include_inclusive_tax`.
4567    /// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
4568    /// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
4569    #[serde(skip_serializing_if = "Option::is_none")]
4570    pub amount_tax_display:
4571        Option<UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay>,
4572    /// ID of the invoice rendering template to use for this invoice.
4573    #[serde(skip_serializing_if = "Option::is_none")]
4574    pub template: Option<String>,
4575}
4576#[cfg(feature = "redact-generated-debug")]
4577impl std::fmt::Debug for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
4578    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4579        f.debug_struct("UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions")
4580            .finish_non_exhaustive()
4581    }
4582}
4583impl UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
4584    pub fn new() -> Self {
4585        Self { amount_tax_display: None, template: None }
4586    }
4587}
4588impl Default for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptions {
4589    fn default() -> Self {
4590        Self::new()
4591    }
4592}
4593/// How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
4594/// One of `exclude_tax` or `include_inclusive_tax`.
4595/// `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts.
4596/// `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
4597#[derive(Clone, Eq, PartialEq)]
4598#[non_exhaustive]
4599pub enum UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay {
4600    ExcludeTax,
4601    IncludeInclusiveTax,
4602    /// An unrecognized value from Stripe. Should not be used as a request parameter.
4603    Unknown(String),
4604}
4605impl UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay {
4606    pub fn as_str(&self) -> &str {
4607        use UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*;
4608        match self {
4609            ExcludeTax => "exclude_tax",
4610            IncludeInclusiveTax => "include_inclusive_tax",
4611            Unknown(v) => v,
4612        }
4613    }
4614}
4615
4616impl std::str::FromStr
4617    for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4618{
4619    type Err = std::convert::Infallible;
4620    fn from_str(s: &str) -> Result<Self, Self::Err> {
4621        use UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay::*;
4622        match s {
4623            "exclude_tax" => Ok(ExcludeTax),
4624            "include_inclusive_tax" => Ok(IncludeInclusiveTax),
4625            v => {
4626                tracing::warn!(
4627                    "Unknown value '{}' for enum '{}'",
4628                    v,
4629                    "UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay"
4630                );
4631                Ok(Unknown(v.to_owned()))
4632            }
4633        }
4634    }
4635}
4636impl std::fmt::Display
4637    for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4638{
4639    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4640        f.write_str(self.as_str())
4641    }
4642}
4643
4644#[cfg(not(feature = "redact-generated-debug"))]
4645impl std::fmt::Debug
4646    for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4647{
4648    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4649        f.write_str(self.as_str())
4650    }
4651}
4652#[cfg(feature = "redact-generated-debug")]
4653impl std::fmt::Debug
4654    for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4655{
4656    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4657        f.debug_struct(stringify!(
4658            UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4659        ))
4660        .finish_non_exhaustive()
4661    }
4662}
4663impl serde::Serialize
4664    for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4665{
4666    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4667    where
4668        S: serde::Serializer,
4669    {
4670        serializer.serialize_str(self.as_str())
4671    }
4672}
4673#[cfg(feature = "deserialize")]
4674impl<'de> serde::Deserialize<'de>
4675    for UpdatePaymentLinkInvoiceCreationInvoiceDataRenderingOptionsAmountTaxDisplay
4676{
4677    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4678        use std::str::FromStr;
4679        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4680        Ok(Self::from_str(&s).expect("infallible"))
4681    }
4682}
4683/// The line items representing what is being sold.
4684/// Each line item represents an item being sold.
4685/// Up to 20 line items are supported.
4686#[derive(Clone, Eq, PartialEq)]
4687#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4688#[derive(serde::Serialize)]
4689pub struct UpdatePaymentLinkLineItems {
4690    /// When set, provides configuration for this item’s quantity to be adjusted by the customer during checkout.
4691    #[serde(skip_serializing_if = "Option::is_none")]
4692    pub adjustable_quantity: Option<AdjustableQuantityParams>,
4693    /// The ID of an existing line item on the payment link.
4694    pub id: String,
4695    /// The quantity of the line item being purchased.
4696    #[serde(skip_serializing_if = "Option::is_none")]
4697    pub quantity: Option<u64>,
4698}
4699#[cfg(feature = "redact-generated-debug")]
4700impl std::fmt::Debug for UpdatePaymentLinkLineItems {
4701    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4702        f.debug_struct("UpdatePaymentLinkLineItems").finish_non_exhaustive()
4703    }
4704}
4705impl UpdatePaymentLinkLineItems {
4706    pub fn new(id: impl Into<String>) -> Self {
4707        Self { adjustable_quantity: None, id: id.into(), quantity: None }
4708    }
4709}
4710/// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
4711#[derive(Clone)]
4712#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4713#[derive(serde::Serialize)]
4714pub struct UpdatePaymentLinkPaymentIntentData {
4715    /// An arbitrary string attached to the object. Often useful for displaying to users.
4716    #[serde(skip_serializing_if = "Option::is_none")]
4717    pub description: Option<String>,
4718    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that will declaratively set metadata on [Payment Intents](https://docs.stripe.com/api/payment_intents) generated from this payment link.
4719    /// Unlike object-level metadata, this field is declarative.
4720    /// Updates will clear prior values.
4721    #[serde(skip_serializing_if = "Option::is_none")]
4722    pub metadata: Option<std::collections::HashMap<String, String>>,
4723    /// Text that appears on the customer's statement as the statement descriptor for a non-card charge.
4724    /// This value overrides the account's default statement descriptor.
4725    /// For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors).
4726    ///
4727    /// Setting this value for a card charge returns an error.
4728    /// For card charges, set the [statement_descriptor_suffix](https://docs.stripe.com/get-started/account/statement-descriptors#dynamic) instead.
4729    #[serde(skip_serializing_if = "Option::is_none")]
4730    pub statement_descriptor: Option<String>,
4731    /// Provides information about a card charge.
4732    /// Concatenated to the account's [statement descriptor prefix](https://docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer's statement.
4733    #[serde(skip_serializing_if = "Option::is_none")]
4734    pub statement_descriptor_suffix: Option<String>,
4735    /// A string that identifies the resulting payment as part of a group.
4736    /// See the PaymentIntents [use case for connected accounts](https://docs.stripe.com/connect/separate-charges-and-transfers) for details.
4737    #[serde(skip_serializing_if = "Option::is_none")]
4738    pub transfer_group: Option<String>,
4739}
4740#[cfg(feature = "redact-generated-debug")]
4741impl std::fmt::Debug for UpdatePaymentLinkPaymentIntentData {
4742    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4743        f.debug_struct("UpdatePaymentLinkPaymentIntentData").finish_non_exhaustive()
4744    }
4745}
4746impl UpdatePaymentLinkPaymentIntentData {
4747    pub fn new() -> Self {
4748        Self {
4749            description: None,
4750            metadata: None,
4751            statement_descriptor: None,
4752            statement_descriptor_suffix: None,
4753            transfer_group: None,
4754        }
4755    }
4756}
4757impl Default for UpdatePaymentLinkPaymentIntentData {
4758    fn default() -> Self {
4759        Self::new()
4760    }
4761}
4762/// Specify whether Checkout should collect a payment method.
4763/// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
4764///
4765/// Can only be set in `subscription` mode. Defaults to `always`.
4766///
4767/// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://docs.stripe.com/payments/checkout/free-trials).
4768#[derive(Clone, Eq, PartialEq)]
4769#[non_exhaustive]
4770pub enum UpdatePaymentLinkPaymentMethodCollection {
4771    Always,
4772    IfRequired,
4773    /// An unrecognized value from Stripe. Should not be used as a request parameter.
4774    Unknown(String),
4775}
4776impl UpdatePaymentLinkPaymentMethodCollection {
4777    pub fn as_str(&self) -> &str {
4778        use UpdatePaymentLinkPaymentMethodCollection::*;
4779        match self {
4780            Always => "always",
4781            IfRequired => "if_required",
4782            Unknown(v) => v,
4783        }
4784    }
4785}
4786
4787impl std::str::FromStr for UpdatePaymentLinkPaymentMethodCollection {
4788    type Err = std::convert::Infallible;
4789    fn from_str(s: &str) -> Result<Self, Self::Err> {
4790        use UpdatePaymentLinkPaymentMethodCollection::*;
4791        match s {
4792            "always" => Ok(Always),
4793            "if_required" => Ok(IfRequired),
4794            v => {
4795                tracing::warn!(
4796                    "Unknown value '{}' for enum '{}'",
4797                    v,
4798                    "UpdatePaymentLinkPaymentMethodCollection"
4799                );
4800                Ok(Unknown(v.to_owned()))
4801            }
4802        }
4803    }
4804}
4805impl std::fmt::Display for UpdatePaymentLinkPaymentMethodCollection {
4806    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4807        f.write_str(self.as_str())
4808    }
4809}
4810
4811#[cfg(not(feature = "redact-generated-debug"))]
4812impl std::fmt::Debug for UpdatePaymentLinkPaymentMethodCollection {
4813    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4814        f.write_str(self.as_str())
4815    }
4816}
4817#[cfg(feature = "redact-generated-debug")]
4818impl std::fmt::Debug for UpdatePaymentLinkPaymentMethodCollection {
4819    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4820        f.debug_struct(stringify!(UpdatePaymentLinkPaymentMethodCollection)).finish_non_exhaustive()
4821    }
4822}
4823impl serde::Serialize for UpdatePaymentLinkPaymentMethodCollection {
4824    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
4825    where
4826        S: serde::Serializer,
4827    {
4828        serializer.serialize_str(self.as_str())
4829    }
4830}
4831#[cfg(feature = "deserialize")]
4832impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkPaymentMethodCollection {
4833    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
4834        use std::str::FromStr;
4835        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
4836        Ok(Self::from_str(&s).expect("infallible"))
4837    }
4838}
4839/// Configuration for collecting the customer's shipping address.
4840#[derive(Clone, Eq, PartialEq)]
4841#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
4842#[derive(serde::Serialize)]
4843pub struct UpdatePaymentLinkShippingAddressCollection {
4844    /// An array of two-letter ISO country codes representing which countries Checkout should provide as options for.
4845    /// shipping locations.
4846    pub allowed_countries: Vec<UpdatePaymentLinkShippingAddressCollectionAllowedCountries>,
4847}
4848#[cfg(feature = "redact-generated-debug")]
4849impl std::fmt::Debug for UpdatePaymentLinkShippingAddressCollection {
4850    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4851        f.debug_struct("UpdatePaymentLinkShippingAddressCollection").finish_non_exhaustive()
4852    }
4853}
4854impl UpdatePaymentLinkShippingAddressCollection {
4855    pub fn new(
4856        allowed_countries: impl Into<Vec<UpdatePaymentLinkShippingAddressCollectionAllowedCountries>>,
4857    ) -> Self {
4858        Self { allowed_countries: allowed_countries.into() }
4859    }
4860}
4861/// An array of two-letter ISO country codes representing which countries Checkout should provide as options for.
4862/// shipping locations.
4863#[derive(Clone, Eq, PartialEq)]
4864#[non_exhaustive]
4865pub enum UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
4866    Ac,
4867    Ad,
4868    Ae,
4869    Af,
4870    Ag,
4871    Ai,
4872    Al,
4873    Am,
4874    Ao,
4875    Aq,
4876    Ar,
4877    At,
4878    Au,
4879    Aw,
4880    Ax,
4881    Az,
4882    Ba,
4883    Bb,
4884    Bd,
4885    Be,
4886    Bf,
4887    Bg,
4888    Bh,
4889    Bi,
4890    Bj,
4891    Bl,
4892    Bm,
4893    Bn,
4894    Bo,
4895    Bq,
4896    Br,
4897    Bs,
4898    Bt,
4899    Bv,
4900    Bw,
4901    By,
4902    Bz,
4903    Ca,
4904    Cd,
4905    Cf,
4906    Cg,
4907    Ch,
4908    Ci,
4909    Ck,
4910    Cl,
4911    Cm,
4912    Cn,
4913    Co,
4914    Cr,
4915    Cv,
4916    Cw,
4917    Cy,
4918    Cz,
4919    De,
4920    Dj,
4921    Dk,
4922    Dm,
4923    Do,
4924    Dz,
4925    Ec,
4926    Ee,
4927    Eg,
4928    Eh,
4929    Er,
4930    Es,
4931    Et,
4932    Fi,
4933    Fj,
4934    Fk,
4935    Fo,
4936    Fr,
4937    Ga,
4938    Gb,
4939    Gd,
4940    Ge,
4941    Gf,
4942    Gg,
4943    Gh,
4944    Gi,
4945    Gl,
4946    Gm,
4947    Gn,
4948    Gp,
4949    Gq,
4950    Gr,
4951    Gs,
4952    Gt,
4953    Gu,
4954    Gw,
4955    Gy,
4956    Hk,
4957    Hn,
4958    Hr,
4959    Ht,
4960    Hu,
4961    Id,
4962    Ie,
4963    Il,
4964    Im,
4965    In,
4966    Io,
4967    Iq,
4968    Is,
4969    It,
4970    Je,
4971    Jm,
4972    Jo,
4973    Jp,
4974    Ke,
4975    Kg,
4976    Kh,
4977    Ki,
4978    Km,
4979    Kn,
4980    Kr,
4981    Kw,
4982    Ky,
4983    Kz,
4984    La,
4985    Lb,
4986    Lc,
4987    Li,
4988    Lk,
4989    Lr,
4990    Ls,
4991    Lt,
4992    Lu,
4993    Lv,
4994    Ly,
4995    Ma,
4996    Mc,
4997    Md,
4998    Me,
4999    Mf,
5000    Mg,
5001    Mk,
5002    Ml,
5003    Mm,
5004    Mn,
5005    Mo,
5006    Mq,
5007    Mr,
5008    Ms,
5009    Mt,
5010    Mu,
5011    Mv,
5012    Mw,
5013    Mx,
5014    My,
5015    Mz,
5016    Na,
5017    Nc,
5018    Ne,
5019    Ng,
5020    Ni,
5021    Nl,
5022    No,
5023    Np,
5024    Nr,
5025    Nu,
5026    Nz,
5027    Om,
5028    Pa,
5029    Pe,
5030    Pf,
5031    Pg,
5032    Ph,
5033    Pk,
5034    Pl,
5035    Pm,
5036    Pn,
5037    Pr,
5038    Ps,
5039    Pt,
5040    Py,
5041    Qa,
5042    Re,
5043    Ro,
5044    Rs,
5045    Ru,
5046    Rw,
5047    Sa,
5048    Sb,
5049    Sc,
5050    Sd,
5051    Se,
5052    Sg,
5053    Sh,
5054    Si,
5055    Sj,
5056    Sk,
5057    Sl,
5058    Sm,
5059    Sn,
5060    So,
5061    Sr,
5062    Ss,
5063    St,
5064    Sv,
5065    Sx,
5066    Sz,
5067    Ta,
5068    Tc,
5069    Td,
5070    Tf,
5071    Tg,
5072    Th,
5073    Tj,
5074    Tk,
5075    Tl,
5076    Tm,
5077    Tn,
5078    To,
5079    Tr,
5080    Tt,
5081    Tv,
5082    Tw,
5083    Tz,
5084    Ua,
5085    Ug,
5086    Us,
5087    Uy,
5088    Uz,
5089    Va,
5090    Vc,
5091    Ve,
5092    Vg,
5093    Vn,
5094    Vu,
5095    Wf,
5096    Ws,
5097    Xk,
5098    Ye,
5099    Yt,
5100    Za,
5101    Zm,
5102    Zw,
5103    Zz,
5104    /// An unrecognized value from Stripe. Should not be used as a request parameter.
5105    Unknown(String),
5106}
5107impl UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5108    pub fn as_str(&self) -> &str {
5109        use UpdatePaymentLinkShippingAddressCollectionAllowedCountries::*;
5110        match self {
5111            Ac => "AC",
5112            Ad => "AD",
5113            Ae => "AE",
5114            Af => "AF",
5115            Ag => "AG",
5116            Ai => "AI",
5117            Al => "AL",
5118            Am => "AM",
5119            Ao => "AO",
5120            Aq => "AQ",
5121            Ar => "AR",
5122            At => "AT",
5123            Au => "AU",
5124            Aw => "AW",
5125            Ax => "AX",
5126            Az => "AZ",
5127            Ba => "BA",
5128            Bb => "BB",
5129            Bd => "BD",
5130            Be => "BE",
5131            Bf => "BF",
5132            Bg => "BG",
5133            Bh => "BH",
5134            Bi => "BI",
5135            Bj => "BJ",
5136            Bl => "BL",
5137            Bm => "BM",
5138            Bn => "BN",
5139            Bo => "BO",
5140            Bq => "BQ",
5141            Br => "BR",
5142            Bs => "BS",
5143            Bt => "BT",
5144            Bv => "BV",
5145            Bw => "BW",
5146            By => "BY",
5147            Bz => "BZ",
5148            Ca => "CA",
5149            Cd => "CD",
5150            Cf => "CF",
5151            Cg => "CG",
5152            Ch => "CH",
5153            Ci => "CI",
5154            Ck => "CK",
5155            Cl => "CL",
5156            Cm => "CM",
5157            Cn => "CN",
5158            Co => "CO",
5159            Cr => "CR",
5160            Cv => "CV",
5161            Cw => "CW",
5162            Cy => "CY",
5163            Cz => "CZ",
5164            De => "DE",
5165            Dj => "DJ",
5166            Dk => "DK",
5167            Dm => "DM",
5168            Do => "DO",
5169            Dz => "DZ",
5170            Ec => "EC",
5171            Ee => "EE",
5172            Eg => "EG",
5173            Eh => "EH",
5174            Er => "ER",
5175            Es => "ES",
5176            Et => "ET",
5177            Fi => "FI",
5178            Fj => "FJ",
5179            Fk => "FK",
5180            Fo => "FO",
5181            Fr => "FR",
5182            Ga => "GA",
5183            Gb => "GB",
5184            Gd => "GD",
5185            Ge => "GE",
5186            Gf => "GF",
5187            Gg => "GG",
5188            Gh => "GH",
5189            Gi => "GI",
5190            Gl => "GL",
5191            Gm => "GM",
5192            Gn => "GN",
5193            Gp => "GP",
5194            Gq => "GQ",
5195            Gr => "GR",
5196            Gs => "GS",
5197            Gt => "GT",
5198            Gu => "GU",
5199            Gw => "GW",
5200            Gy => "GY",
5201            Hk => "HK",
5202            Hn => "HN",
5203            Hr => "HR",
5204            Ht => "HT",
5205            Hu => "HU",
5206            Id => "ID",
5207            Ie => "IE",
5208            Il => "IL",
5209            Im => "IM",
5210            In => "IN",
5211            Io => "IO",
5212            Iq => "IQ",
5213            Is => "IS",
5214            It => "IT",
5215            Je => "JE",
5216            Jm => "JM",
5217            Jo => "JO",
5218            Jp => "JP",
5219            Ke => "KE",
5220            Kg => "KG",
5221            Kh => "KH",
5222            Ki => "KI",
5223            Km => "KM",
5224            Kn => "KN",
5225            Kr => "KR",
5226            Kw => "KW",
5227            Ky => "KY",
5228            Kz => "KZ",
5229            La => "LA",
5230            Lb => "LB",
5231            Lc => "LC",
5232            Li => "LI",
5233            Lk => "LK",
5234            Lr => "LR",
5235            Ls => "LS",
5236            Lt => "LT",
5237            Lu => "LU",
5238            Lv => "LV",
5239            Ly => "LY",
5240            Ma => "MA",
5241            Mc => "MC",
5242            Md => "MD",
5243            Me => "ME",
5244            Mf => "MF",
5245            Mg => "MG",
5246            Mk => "MK",
5247            Ml => "ML",
5248            Mm => "MM",
5249            Mn => "MN",
5250            Mo => "MO",
5251            Mq => "MQ",
5252            Mr => "MR",
5253            Ms => "MS",
5254            Mt => "MT",
5255            Mu => "MU",
5256            Mv => "MV",
5257            Mw => "MW",
5258            Mx => "MX",
5259            My => "MY",
5260            Mz => "MZ",
5261            Na => "NA",
5262            Nc => "NC",
5263            Ne => "NE",
5264            Ng => "NG",
5265            Ni => "NI",
5266            Nl => "NL",
5267            No => "NO",
5268            Np => "NP",
5269            Nr => "NR",
5270            Nu => "NU",
5271            Nz => "NZ",
5272            Om => "OM",
5273            Pa => "PA",
5274            Pe => "PE",
5275            Pf => "PF",
5276            Pg => "PG",
5277            Ph => "PH",
5278            Pk => "PK",
5279            Pl => "PL",
5280            Pm => "PM",
5281            Pn => "PN",
5282            Pr => "PR",
5283            Ps => "PS",
5284            Pt => "PT",
5285            Py => "PY",
5286            Qa => "QA",
5287            Re => "RE",
5288            Ro => "RO",
5289            Rs => "RS",
5290            Ru => "RU",
5291            Rw => "RW",
5292            Sa => "SA",
5293            Sb => "SB",
5294            Sc => "SC",
5295            Sd => "SD",
5296            Se => "SE",
5297            Sg => "SG",
5298            Sh => "SH",
5299            Si => "SI",
5300            Sj => "SJ",
5301            Sk => "SK",
5302            Sl => "SL",
5303            Sm => "SM",
5304            Sn => "SN",
5305            So => "SO",
5306            Sr => "SR",
5307            Ss => "SS",
5308            St => "ST",
5309            Sv => "SV",
5310            Sx => "SX",
5311            Sz => "SZ",
5312            Ta => "TA",
5313            Tc => "TC",
5314            Td => "TD",
5315            Tf => "TF",
5316            Tg => "TG",
5317            Th => "TH",
5318            Tj => "TJ",
5319            Tk => "TK",
5320            Tl => "TL",
5321            Tm => "TM",
5322            Tn => "TN",
5323            To => "TO",
5324            Tr => "TR",
5325            Tt => "TT",
5326            Tv => "TV",
5327            Tw => "TW",
5328            Tz => "TZ",
5329            Ua => "UA",
5330            Ug => "UG",
5331            Us => "US",
5332            Uy => "UY",
5333            Uz => "UZ",
5334            Va => "VA",
5335            Vc => "VC",
5336            Ve => "VE",
5337            Vg => "VG",
5338            Vn => "VN",
5339            Vu => "VU",
5340            Wf => "WF",
5341            Ws => "WS",
5342            Xk => "XK",
5343            Ye => "YE",
5344            Yt => "YT",
5345            Za => "ZA",
5346            Zm => "ZM",
5347            Zw => "ZW",
5348            Zz => "ZZ",
5349            Unknown(v) => v,
5350        }
5351    }
5352}
5353
5354impl std::str::FromStr for UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5355    type Err = std::convert::Infallible;
5356    fn from_str(s: &str) -> Result<Self, Self::Err> {
5357        use UpdatePaymentLinkShippingAddressCollectionAllowedCountries::*;
5358        match s {
5359            "AC" => Ok(Ac),
5360            "AD" => Ok(Ad),
5361            "AE" => Ok(Ae),
5362            "AF" => Ok(Af),
5363            "AG" => Ok(Ag),
5364            "AI" => Ok(Ai),
5365            "AL" => Ok(Al),
5366            "AM" => Ok(Am),
5367            "AO" => Ok(Ao),
5368            "AQ" => Ok(Aq),
5369            "AR" => Ok(Ar),
5370            "AT" => Ok(At),
5371            "AU" => Ok(Au),
5372            "AW" => Ok(Aw),
5373            "AX" => Ok(Ax),
5374            "AZ" => Ok(Az),
5375            "BA" => Ok(Ba),
5376            "BB" => Ok(Bb),
5377            "BD" => Ok(Bd),
5378            "BE" => Ok(Be),
5379            "BF" => Ok(Bf),
5380            "BG" => Ok(Bg),
5381            "BH" => Ok(Bh),
5382            "BI" => Ok(Bi),
5383            "BJ" => Ok(Bj),
5384            "BL" => Ok(Bl),
5385            "BM" => Ok(Bm),
5386            "BN" => Ok(Bn),
5387            "BO" => Ok(Bo),
5388            "BQ" => Ok(Bq),
5389            "BR" => Ok(Br),
5390            "BS" => Ok(Bs),
5391            "BT" => Ok(Bt),
5392            "BV" => Ok(Bv),
5393            "BW" => Ok(Bw),
5394            "BY" => Ok(By),
5395            "BZ" => Ok(Bz),
5396            "CA" => Ok(Ca),
5397            "CD" => Ok(Cd),
5398            "CF" => Ok(Cf),
5399            "CG" => Ok(Cg),
5400            "CH" => Ok(Ch),
5401            "CI" => Ok(Ci),
5402            "CK" => Ok(Ck),
5403            "CL" => Ok(Cl),
5404            "CM" => Ok(Cm),
5405            "CN" => Ok(Cn),
5406            "CO" => Ok(Co),
5407            "CR" => Ok(Cr),
5408            "CV" => Ok(Cv),
5409            "CW" => Ok(Cw),
5410            "CY" => Ok(Cy),
5411            "CZ" => Ok(Cz),
5412            "DE" => Ok(De),
5413            "DJ" => Ok(Dj),
5414            "DK" => Ok(Dk),
5415            "DM" => Ok(Dm),
5416            "DO" => Ok(Do),
5417            "DZ" => Ok(Dz),
5418            "EC" => Ok(Ec),
5419            "EE" => Ok(Ee),
5420            "EG" => Ok(Eg),
5421            "EH" => Ok(Eh),
5422            "ER" => Ok(Er),
5423            "ES" => Ok(Es),
5424            "ET" => Ok(Et),
5425            "FI" => Ok(Fi),
5426            "FJ" => Ok(Fj),
5427            "FK" => Ok(Fk),
5428            "FO" => Ok(Fo),
5429            "FR" => Ok(Fr),
5430            "GA" => Ok(Ga),
5431            "GB" => Ok(Gb),
5432            "GD" => Ok(Gd),
5433            "GE" => Ok(Ge),
5434            "GF" => Ok(Gf),
5435            "GG" => Ok(Gg),
5436            "GH" => Ok(Gh),
5437            "GI" => Ok(Gi),
5438            "GL" => Ok(Gl),
5439            "GM" => Ok(Gm),
5440            "GN" => Ok(Gn),
5441            "GP" => Ok(Gp),
5442            "GQ" => Ok(Gq),
5443            "GR" => Ok(Gr),
5444            "GS" => Ok(Gs),
5445            "GT" => Ok(Gt),
5446            "GU" => Ok(Gu),
5447            "GW" => Ok(Gw),
5448            "GY" => Ok(Gy),
5449            "HK" => Ok(Hk),
5450            "HN" => Ok(Hn),
5451            "HR" => Ok(Hr),
5452            "HT" => Ok(Ht),
5453            "HU" => Ok(Hu),
5454            "ID" => Ok(Id),
5455            "IE" => Ok(Ie),
5456            "IL" => Ok(Il),
5457            "IM" => Ok(Im),
5458            "IN" => Ok(In),
5459            "IO" => Ok(Io),
5460            "IQ" => Ok(Iq),
5461            "IS" => Ok(Is),
5462            "IT" => Ok(It),
5463            "JE" => Ok(Je),
5464            "JM" => Ok(Jm),
5465            "JO" => Ok(Jo),
5466            "JP" => Ok(Jp),
5467            "KE" => Ok(Ke),
5468            "KG" => Ok(Kg),
5469            "KH" => Ok(Kh),
5470            "KI" => Ok(Ki),
5471            "KM" => Ok(Km),
5472            "KN" => Ok(Kn),
5473            "KR" => Ok(Kr),
5474            "KW" => Ok(Kw),
5475            "KY" => Ok(Ky),
5476            "KZ" => Ok(Kz),
5477            "LA" => Ok(La),
5478            "LB" => Ok(Lb),
5479            "LC" => Ok(Lc),
5480            "LI" => Ok(Li),
5481            "LK" => Ok(Lk),
5482            "LR" => Ok(Lr),
5483            "LS" => Ok(Ls),
5484            "LT" => Ok(Lt),
5485            "LU" => Ok(Lu),
5486            "LV" => Ok(Lv),
5487            "LY" => Ok(Ly),
5488            "MA" => Ok(Ma),
5489            "MC" => Ok(Mc),
5490            "MD" => Ok(Md),
5491            "ME" => Ok(Me),
5492            "MF" => Ok(Mf),
5493            "MG" => Ok(Mg),
5494            "MK" => Ok(Mk),
5495            "ML" => Ok(Ml),
5496            "MM" => Ok(Mm),
5497            "MN" => Ok(Mn),
5498            "MO" => Ok(Mo),
5499            "MQ" => Ok(Mq),
5500            "MR" => Ok(Mr),
5501            "MS" => Ok(Ms),
5502            "MT" => Ok(Mt),
5503            "MU" => Ok(Mu),
5504            "MV" => Ok(Mv),
5505            "MW" => Ok(Mw),
5506            "MX" => Ok(Mx),
5507            "MY" => Ok(My),
5508            "MZ" => Ok(Mz),
5509            "NA" => Ok(Na),
5510            "NC" => Ok(Nc),
5511            "NE" => Ok(Ne),
5512            "NG" => Ok(Ng),
5513            "NI" => Ok(Ni),
5514            "NL" => Ok(Nl),
5515            "NO" => Ok(No),
5516            "NP" => Ok(Np),
5517            "NR" => Ok(Nr),
5518            "NU" => Ok(Nu),
5519            "NZ" => Ok(Nz),
5520            "OM" => Ok(Om),
5521            "PA" => Ok(Pa),
5522            "PE" => Ok(Pe),
5523            "PF" => Ok(Pf),
5524            "PG" => Ok(Pg),
5525            "PH" => Ok(Ph),
5526            "PK" => Ok(Pk),
5527            "PL" => Ok(Pl),
5528            "PM" => Ok(Pm),
5529            "PN" => Ok(Pn),
5530            "PR" => Ok(Pr),
5531            "PS" => Ok(Ps),
5532            "PT" => Ok(Pt),
5533            "PY" => Ok(Py),
5534            "QA" => Ok(Qa),
5535            "RE" => Ok(Re),
5536            "RO" => Ok(Ro),
5537            "RS" => Ok(Rs),
5538            "RU" => Ok(Ru),
5539            "RW" => Ok(Rw),
5540            "SA" => Ok(Sa),
5541            "SB" => Ok(Sb),
5542            "SC" => Ok(Sc),
5543            "SD" => Ok(Sd),
5544            "SE" => Ok(Se),
5545            "SG" => Ok(Sg),
5546            "SH" => Ok(Sh),
5547            "SI" => Ok(Si),
5548            "SJ" => Ok(Sj),
5549            "SK" => Ok(Sk),
5550            "SL" => Ok(Sl),
5551            "SM" => Ok(Sm),
5552            "SN" => Ok(Sn),
5553            "SO" => Ok(So),
5554            "SR" => Ok(Sr),
5555            "SS" => Ok(Ss),
5556            "ST" => Ok(St),
5557            "SV" => Ok(Sv),
5558            "SX" => Ok(Sx),
5559            "SZ" => Ok(Sz),
5560            "TA" => Ok(Ta),
5561            "TC" => Ok(Tc),
5562            "TD" => Ok(Td),
5563            "TF" => Ok(Tf),
5564            "TG" => Ok(Tg),
5565            "TH" => Ok(Th),
5566            "TJ" => Ok(Tj),
5567            "TK" => Ok(Tk),
5568            "TL" => Ok(Tl),
5569            "TM" => Ok(Tm),
5570            "TN" => Ok(Tn),
5571            "TO" => Ok(To),
5572            "TR" => Ok(Tr),
5573            "TT" => Ok(Tt),
5574            "TV" => Ok(Tv),
5575            "TW" => Ok(Tw),
5576            "TZ" => Ok(Tz),
5577            "UA" => Ok(Ua),
5578            "UG" => Ok(Ug),
5579            "US" => Ok(Us),
5580            "UY" => Ok(Uy),
5581            "UZ" => Ok(Uz),
5582            "VA" => Ok(Va),
5583            "VC" => Ok(Vc),
5584            "VE" => Ok(Ve),
5585            "VG" => Ok(Vg),
5586            "VN" => Ok(Vn),
5587            "VU" => Ok(Vu),
5588            "WF" => Ok(Wf),
5589            "WS" => Ok(Ws),
5590            "XK" => Ok(Xk),
5591            "YE" => Ok(Ye),
5592            "YT" => Ok(Yt),
5593            "ZA" => Ok(Za),
5594            "ZM" => Ok(Zm),
5595            "ZW" => Ok(Zw),
5596            "ZZ" => Ok(Zz),
5597            v => {
5598                tracing::warn!(
5599                    "Unknown value '{}' for enum '{}'",
5600                    v,
5601                    "UpdatePaymentLinkShippingAddressCollectionAllowedCountries"
5602                );
5603                Ok(Unknown(v.to_owned()))
5604            }
5605        }
5606    }
5607}
5608impl std::fmt::Display for UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5609    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5610        f.write_str(self.as_str())
5611    }
5612}
5613
5614#[cfg(not(feature = "redact-generated-debug"))]
5615impl std::fmt::Debug for UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5616    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5617        f.write_str(self.as_str())
5618    }
5619}
5620#[cfg(feature = "redact-generated-debug")]
5621impl std::fmt::Debug for UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5622    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5623        f.debug_struct(stringify!(UpdatePaymentLinkShippingAddressCollectionAllowedCountries))
5624            .finish_non_exhaustive()
5625    }
5626}
5627impl serde::Serialize for UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5628    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5629    where
5630        S: serde::Serializer,
5631    {
5632        serializer.serialize_str(self.as_str())
5633    }
5634}
5635#[cfg(feature = "deserialize")]
5636impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkShippingAddressCollectionAllowedCountries {
5637    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
5638        use std::str::FromStr;
5639        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
5640        Ok(Self::from_str(&s).expect("infallible"))
5641    }
5642}
5643/// When creating a subscription, the specified configuration data will be used.
5644/// There must be at least one line item with a recurring price to use `subscription_data`.
5645#[derive(Clone)]
5646#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
5647#[derive(serde::Serialize)]
5648pub struct UpdatePaymentLinkSubscriptionData {
5649    /// All invoices will be billed using the specified settings.
5650    #[serde(skip_serializing_if = "Option::is_none")]
5651    pub invoice_settings: Option<UpdatePaymentLinkSubscriptionDataInvoiceSettings>,
5652    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that will declaratively set metadata on [Subscriptions](https://docs.stripe.com/api/subscriptions) generated from this payment link.
5653    /// Unlike object-level metadata, this field is declarative.
5654    /// Updates will clear prior values.
5655    #[serde(skip_serializing_if = "Option::is_none")]
5656    pub metadata: Option<std::collections::HashMap<String, String>>,
5657    /// Integer representing the number of trial period days before the customer is charged for the first time.
5658    /// Has to be at least 1.
5659    #[serde(skip_serializing_if = "Option::is_none")]
5660    pub trial_period_days: Option<u32>,
5661    /// Settings related to subscription trials.
5662    #[serde(skip_serializing_if = "Option::is_none")]
5663    pub trial_settings: Option<UpdatePaymentLinkSubscriptionDataTrialSettings>,
5664}
5665#[cfg(feature = "redact-generated-debug")]
5666impl std::fmt::Debug for UpdatePaymentLinkSubscriptionData {
5667    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5668        f.debug_struct("UpdatePaymentLinkSubscriptionData").finish_non_exhaustive()
5669    }
5670}
5671impl UpdatePaymentLinkSubscriptionData {
5672    pub fn new() -> Self {
5673        Self {
5674            invoice_settings: None,
5675            metadata: None,
5676            trial_period_days: None,
5677            trial_settings: None,
5678        }
5679    }
5680}
5681impl Default for UpdatePaymentLinkSubscriptionData {
5682    fn default() -> Self {
5683        Self::new()
5684    }
5685}
5686/// All invoices will be billed using the specified settings.
5687#[derive(Clone, Eq, PartialEq)]
5688#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
5689#[derive(serde::Serialize)]
5690pub struct UpdatePaymentLinkSubscriptionDataInvoiceSettings {
5691    /// The connected account that issues the invoice.
5692    /// The invoice is presented with the branding and support information of the specified account.
5693    #[serde(skip_serializing_if = "Option::is_none")]
5694    pub issuer: Option<UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer>,
5695}
5696#[cfg(feature = "redact-generated-debug")]
5697impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataInvoiceSettings {
5698    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5699        f.debug_struct("UpdatePaymentLinkSubscriptionDataInvoiceSettings").finish_non_exhaustive()
5700    }
5701}
5702impl UpdatePaymentLinkSubscriptionDataInvoiceSettings {
5703    pub fn new() -> Self {
5704        Self { issuer: None }
5705    }
5706}
5707impl Default for UpdatePaymentLinkSubscriptionDataInvoiceSettings {
5708    fn default() -> Self {
5709        Self::new()
5710    }
5711}
5712/// The connected account that issues the invoice.
5713/// The invoice is presented with the branding and support information of the specified account.
5714#[derive(Clone, Eq, PartialEq)]
5715#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
5716#[derive(serde::Serialize)]
5717pub struct UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer {
5718    /// The connected account being referenced when `type` is `account`.
5719    #[serde(skip_serializing_if = "Option::is_none")]
5720    pub account: Option<String>,
5721    /// Type of the account referenced in the request.
5722    #[serde(rename = "type")]
5723    pub type_: UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType,
5724}
5725#[cfg(feature = "redact-generated-debug")]
5726impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer {
5727    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5728        f.debug_struct("UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer")
5729            .finish_non_exhaustive()
5730    }
5731}
5732impl UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuer {
5733    pub fn new(
5734        type_: impl Into<UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType>,
5735    ) -> Self {
5736        Self { account: None, type_: type_.into() }
5737    }
5738}
5739/// Type of the account referenced in the request.
5740#[derive(Clone, Eq, PartialEq)]
5741#[non_exhaustive]
5742pub enum UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5743    Account,
5744    Self_,
5745    /// An unrecognized value from Stripe. Should not be used as a request parameter.
5746    Unknown(String),
5747}
5748impl UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5749    pub fn as_str(&self) -> &str {
5750        use UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*;
5751        match self {
5752            Account => "account",
5753            Self_ => "self",
5754            Unknown(v) => v,
5755        }
5756    }
5757}
5758
5759impl std::str::FromStr for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5760    type Err = std::convert::Infallible;
5761    fn from_str(s: &str) -> Result<Self, Self::Err> {
5762        use UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType::*;
5763        match s {
5764            "account" => Ok(Account),
5765            "self" => Ok(Self_),
5766            v => {
5767                tracing::warn!(
5768                    "Unknown value '{}' for enum '{}'",
5769                    v,
5770                    "UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType"
5771                );
5772                Ok(Unknown(v.to_owned()))
5773            }
5774        }
5775    }
5776}
5777impl std::fmt::Display for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5778    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5779        f.write_str(self.as_str())
5780    }
5781}
5782
5783#[cfg(not(feature = "redact-generated-debug"))]
5784impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5785    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5786        f.write_str(self.as_str())
5787    }
5788}
5789#[cfg(feature = "redact-generated-debug")]
5790impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5791    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5792        f.debug_struct(stringify!(UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType))
5793            .finish_non_exhaustive()
5794    }
5795}
5796impl serde::Serialize for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5797    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5798    where
5799        S: serde::Serializer,
5800    {
5801        serializer.serialize_str(self.as_str())
5802    }
5803}
5804#[cfg(feature = "deserialize")]
5805impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkSubscriptionDataInvoiceSettingsIssuerType {
5806    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
5807        use std::str::FromStr;
5808        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
5809        Ok(Self::from_str(&s).expect("infallible"))
5810    }
5811}
5812/// Settings related to subscription trials.
5813#[derive(Clone, Eq, PartialEq)]
5814#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
5815#[derive(serde::Serialize)]
5816pub struct UpdatePaymentLinkSubscriptionDataTrialSettings {
5817    /// Defines how the subscription should behave when the user's free trial ends.
5818    pub end_behavior: UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior,
5819}
5820#[cfg(feature = "redact-generated-debug")]
5821impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataTrialSettings {
5822    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5823        f.debug_struct("UpdatePaymentLinkSubscriptionDataTrialSettings").finish_non_exhaustive()
5824    }
5825}
5826impl UpdatePaymentLinkSubscriptionDataTrialSettings {
5827    pub fn new(
5828        end_behavior: impl Into<UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior>,
5829    ) -> Self {
5830        Self { end_behavior: end_behavior.into() }
5831    }
5832}
5833/// Defines how the subscription should behave when the user's free trial ends.
5834#[derive(Clone, Eq, PartialEq)]
5835#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
5836#[derive(serde::Serialize)]
5837pub struct UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior {
5838    /// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
5839    pub missing_payment_method:
5840        UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod,
5841}
5842#[cfg(feature = "redact-generated-debug")]
5843impl std::fmt::Debug for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior {
5844    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5845        f.debug_struct("UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior")
5846            .finish_non_exhaustive()
5847    }
5848}
5849impl UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehavior {
5850    pub fn new(
5851        missing_payment_method: impl Into<
5852            UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod,
5853        >,
5854    ) -> Self {
5855        Self { missing_payment_method: missing_payment_method.into() }
5856    }
5857}
5858/// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
5859#[derive(Clone, Eq, PartialEq)]
5860#[non_exhaustive]
5861pub enum UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod {
5862    Cancel,
5863    CreateInvoice,
5864    Pause,
5865    /// An unrecognized value from Stripe. Should not be used as a request parameter.
5866    Unknown(String),
5867}
5868impl UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod {
5869    pub fn as_str(&self) -> &str {
5870        use UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*;
5871        match self {
5872            Cancel => "cancel",
5873            CreateInvoice => "create_invoice",
5874            Pause => "pause",
5875            Unknown(v) => v,
5876        }
5877    }
5878}
5879
5880impl std::str::FromStr
5881    for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5882{
5883    type Err = std::convert::Infallible;
5884    fn from_str(s: &str) -> Result<Self, Self::Err> {
5885        use UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod::*;
5886        match s {
5887            "cancel" => Ok(Cancel),
5888            "create_invoice" => Ok(CreateInvoice),
5889            "pause" => Ok(Pause),
5890            v => {
5891                tracing::warn!(
5892                    "Unknown value '{}' for enum '{}'",
5893                    v,
5894                    "UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod"
5895                );
5896                Ok(Unknown(v.to_owned()))
5897            }
5898        }
5899    }
5900}
5901impl std::fmt::Display
5902    for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5903{
5904    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5905        f.write_str(self.as_str())
5906    }
5907}
5908
5909#[cfg(not(feature = "redact-generated-debug"))]
5910impl std::fmt::Debug
5911    for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5912{
5913    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5914        f.write_str(self.as_str())
5915    }
5916}
5917#[cfg(feature = "redact-generated-debug")]
5918impl std::fmt::Debug
5919    for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5920{
5921    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5922        f.debug_struct(stringify!(
5923            UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5924        ))
5925        .finish_non_exhaustive()
5926    }
5927}
5928impl serde::Serialize
5929    for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5930{
5931    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
5932    where
5933        S: serde::Serializer,
5934    {
5935        serializer.serialize_str(self.as_str())
5936    }
5937}
5938#[cfg(feature = "deserialize")]
5939impl<'de> serde::Deserialize<'de>
5940    for UpdatePaymentLinkSubscriptionDataTrialSettingsEndBehaviorMissingPaymentMethod
5941{
5942    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
5943        use std::str::FromStr;
5944        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
5945        Ok(Self::from_str(&s).expect("infallible"))
5946    }
5947}
5948/// Controls tax ID collection during checkout.
5949#[derive(Clone, Eq, PartialEq)]
5950#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
5951#[derive(serde::Serialize)]
5952pub struct UpdatePaymentLinkTaxIdCollection {
5953    /// Enable tax ID collection during checkout. Defaults to `false`.
5954    pub enabled: bool,
5955    /// Describes whether a tax ID is required during checkout.
5956    /// Defaults to `never`.
5957    /// You can't set this parameter if `ui_mode` is `custom`.
5958    #[serde(skip_serializing_if = "Option::is_none")]
5959    pub required: Option<UpdatePaymentLinkTaxIdCollectionRequired>,
5960}
5961#[cfg(feature = "redact-generated-debug")]
5962impl std::fmt::Debug for UpdatePaymentLinkTaxIdCollection {
5963    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
5964        f.debug_struct("UpdatePaymentLinkTaxIdCollection").finish_non_exhaustive()
5965    }
5966}
5967impl UpdatePaymentLinkTaxIdCollection {
5968    pub fn new(enabled: impl Into<bool>) -> Self {
5969        Self { enabled: enabled.into(), required: None }
5970    }
5971}
5972/// Describes whether a tax ID is required during checkout.
5973/// Defaults to `never`.
5974/// You can't set this parameter if `ui_mode` is `custom`.
5975#[derive(Clone, Eq, PartialEq)]
5976#[non_exhaustive]
5977pub enum UpdatePaymentLinkTaxIdCollectionRequired {
5978    IfSupported,
5979    Never,
5980    /// An unrecognized value from Stripe. Should not be used as a request parameter.
5981    Unknown(String),
5982}
5983impl UpdatePaymentLinkTaxIdCollectionRequired {
5984    pub fn as_str(&self) -> &str {
5985        use UpdatePaymentLinkTaxIdCollectionRequired::*;
5986        match self {
5987            IfSupported => "if_supported",
5988            Never => "never",
5989            Unknown(v) => v,
5990        }
5991    }
5992}
5993
5994impl std::str::FromStr for UpdatePaymentLinkTaxIdCollectionRequired {
5995    type Err = std::convert::Infallible;
5996    fn from_str(s: &str) -> Result<Self, Self::Err> {
5997        use UpdatePaymentLinkTaxIdCollectionRequired::*;
5998        match s {
5999            "if_supported" => Ok(IfSupported),
6000            "never" => Ok(Never),
6001            v => {
6002                tracing::warn!(
6003                    "Unknown value '{}' for enum '{}'",
6004                    v,
6005                    "UpdatePaymentLinkTaxIdCollectionRequired"
6006                );
6007                Ok(Unknown(v.to_owned()))
6008            }
6009        }
6010    }
6011}
6012impl std::fmt::Display for UpdatePaymentLinkTaxIdCollectionRequired {
6013    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6014        f.write_str(self.as_str())
6015    }
6016}
6017
6018#[cfg(not(feature = "redact-generated-debug"))]
6019impl std::fmt::Debug for UpdatePaymentLinkTaxIdCollectionRequired {
6020    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6021        f.write_str(self.as_str())
6022    }
6023}
6024#[cfg(feature = "redact-generated-debug")]
6025impl std::fmt::Debug for UpdatePaymentLinkTaxIdCollectionRequired {
6026    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6027        f.debug_struct(stringify!(UpdatePaymentLinkTaxIdCollectionRequired)).finish_non_exhaustive()
6028    }
6029}
6030impl serde::Serialize for UpdatePaymentLinkTaxIdCollectionRequired {
6031    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
6032    where
6033        S: serde::Serializer,
6034    {
6035        serializer.serialize_str(self.as_str())
6036    }
6037}
6038#[cfg(feature = "deserialize")]
6039impl<'de> serde::Deserialize<'de> for UpdatePaymentLinkTaxIdCollectionRequired {
6040    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
6041        use std::str::FromStr;
6042        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
6043        Ok(Self::from_str(&s).expect("infallible"))
6044    }
6045}
6046/// Updates a payment link.
6047#[derive(Clone)]
6048#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6049#[derive(serde::Serialize)]
6050pub struct UpdatePaymentLink {
6051    inner: UpdatePaymentLinkBuilder,
6052    payment_link: stripe_shared::PaymentLinkId,
6053}
6054#[cfg(feature = "redact-generated-debug")]
6055impl std::fmt::Debug for UpdatePaymentLink {
6056    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6057        f.debug_struct("UpdatePaymentLink").finish_non_exhaustive()
6058    }
6059}
6060impl UpdatePaymentLink {
6061    /// Construct a new `UpdatePaymentLink`.
6062    pub fn new(payment_link: impl Into<stripe_shared::PaymentLinkId>) -> Self {
6063        Self { payment_link: payment_link.into(), inner: UpdatePaymentLinkBuilder::new() }
6064    }
6065    /// Whether the payment link's `url` is active.
6066    /// If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated.
6067    pub fn active(mut self, active: impl Into<bool>) -> Self {
6068        self.inner.active = Some(active.into());
6069        self
6070    }
6071    /// Behavior after the purchase is complete.
6072    pub fn after_completion(
6073        mut self,
6074        after_completion: impl Into<UpdatePaymentLinkAfterCompletion>,
6075    ) -> Self {
6076        self.inner.after_completion = Some(after_completion.into());
6077        self
6078    }
6079    /// Enables user redeemable promotion codes.
6080    pub fn allow_promotion_codes(mut self, allow_promotion_codes: impl Into<bool>) -> Self {
6081        self.inner.allow_promotion_codes = Some(allow_promotion_codes.into());
6082        self
6083    }
6084    /// Configuration for automatic tax collection.
6085    pub fn automatic_tax(
6086        mut self,
6087        automatic_tax: impl Into<UpdatePaymentLinkAutomaticTax>,
6088    ) -> Self {
6089        self.inner.automatic_tax = Some(automatic_tax.into());
6090        self
6091    }
6092    /// Configuration for collecting the customer's billing address. Defaults to `auto`.
6093    pub fn billing_address_collection(
6094        mut self,
6095        billing_address_collection: impl Into<stripe_shared::PaymentLinkBillingAddressCollection>,
6096    ) -> Self {
6097        self.inner.billing_address_collection = Some(billing_address_collection.into());
6098        self
6099    }
6100    /// Collect additional information from your customer using custom fields.
6101    /// Up to 3 fields are supported.
6102    /// You can't set this parameter if `ui_mode` is `custom`.
6103    pub fn custom_fields(
6104        mut self,
6105        custom_fields: impl Into<Vec<UpdatePaymentLinkCustomFields>>,
6106    ) -> Self {
6107        self.inner.custom_fields = Some(custom_fields.into());
6108        self
6109    }
6110    /// Display additional text for your customers using custom text.
6111    /// You can't set this parameter if `ui_mode` is `custom`.
6112    pub fn custom_text(mut self, custom_text: impl Into<CustomTextParam>) -> Self {
6113        self.inner.custom_text = Some(custom_text.into());
6114        self
6115    }
6116    /// Configures whether [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link create a [Customer](https://docs.stripe.com/api/customers).
6117    pub fn customer_creation(
6118        mut self,
6119        customer_creation: impl Into<UpdatePaymentLinkCustomerCreation>,
6120    ) -> Self {
6121        self.inner.customer_creation = Some(customer_creation.into());
6122        self
6123    }
6124    /// Specifies which fields in the response should be expanded.
6125    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
6126        self.inner.expand = Some(expand.into());
6127        self
6128    }
6129    /// The custom message to be displayed to a customer when a payment link is no longer active.
6130    pub fn inactive_message(mut self, inactive_message: impl Into<String>) -> Self {
6131        self.inner.inactive_message = Some(inactive_message.into());
6132        self
6133    }
6134    /// Generate a post-purchase Invoice for one-time payments.
6135    pub fn invoice_creation(
6136        mut self,
6137        invoice_creation: impl Into<UpdatePaymentLinkInvoiceCreation>,
6138    ) -> Self {
6139        self.inner.invoice_creation = Some(invoice_creation.into());
6140        self
6141    }
6142    /// The line items representing what is being sold.
6143    /// Each line item represents an item being sold.
6144    /// Up to 20 line items are supported.
6145    pub fn line_items(mut self, line_items: impl Into<Vec<UpdatePaymentLinkLineItems>>) -> Self {
6146        self.inner.line_items = Some(line_items.into());
6147        self
6148    }
6149    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
6150    /// This can be useful for storing additional information about the object in a structured format.
6151    /// Individual keys can be unset by posting an empty value to them.
6152    /// All keys can be unset by posting an empty value to `metadata`.
6153    /// Metadata associated with this Payment Link will automatically be copied to [checkout sessions](https://docs.stripe.com/api/checkout/sessions) created by this payment link.
6154    pub fn metadata(
6155        mut self,
6156        metadata: impl Into<std::collections::HashMap<String, String>>,
6157    ) -> Self {
6158        self.inner.metadata = Some(metadata.into());
6159        self
6160    }
6161    /// Controls settings applied for collecting the customer's name.
6162    pub fn name_collection(mut self, name_collection: impl Into<NameCollectionParams>) -> Self {
6163        self.inner.name_collection = Some(name_collection.into());
6164        self
6165    }
6166    /// A list of optional items the customer can add to their order at checkout.
6167    /// Use this parameter to pass one-time or recurring [Prices](https://docs.stripe.com/api/prices).
6168    /// There is a maximum of 10 optional items allowed on a payment link, and the existing limits on the number of line items allowed on a payment link apply to the combined number of line items and optional items.
6169    /// There is a maximum of 20 combined line items and optional items.
6170    pub fn optional_items(mut self, optional_items: impl Into<Vec<OptionalItemParams>>) -> Self {
6171        self.inner.optional_items = Some(optional_items.into());
6172        self
6173    }
6174    /// A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode.
6175    pub fn payment_intent_data(
6176        mut self,
6177        payment_intent_data: impl Into<UpdatePaymentLinkPaymentIntentData>,
6178    ) -> Self {
6179        self.inner.payment_intent_data = Some(payment_intent_data.into());
6180        self
6181    }
6182    /// Specify whether Checkout should collect a payment method.
6183    /// When set to `if_required`, Checkout will not collect a payment method when the total due for the session is 0.This may occur if the Checkout Session includes a free trial or a discount.
6184    ///
6185    /// Can only be set in `subscription` mode. Defaults to `always`.
6186    ///
6187    /// If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://docs.stripe.com/payments/checkout/free-trials).
6188    pub fn payment_method_collection(
6189        mut self,
6190        payment_method_collection: impl Into<UpdatePaymentLinkPaymentMethodCollection>,
6191    ) -> Self {
6192        self.inner.payment_method_collection = Some(payment_method_collection.into());
6193        self
6194    }
6195    /// The list of payment method types that customers can use.
6196    /// Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods).
6197    pub fn payment_method_types(
6198        mut self,
6199        payment_method_types: impl Into<Vec<stripe_shared::PaymentLinkPaymentMethodTypes>>,
6200    ) -> Self {
6201        self.inner.payment_method_types = Some(payment_method_types.into());
6202        self
6203    }
6204    /// Controls phone number collection settings during checkout.
6205    ///
6206    /// We recommend that you review your privacy policy and check with your legal contacts.
6207    pub fn phone_number_collection(
6208        mut self,
6209        phone_number_collection: impl Into<PhoneNumberCollectionParams>,
6210    ) -> Self {
6211        self.inner.phone_number_collection = Some(phone_number_collection.into());
6212        self
6213    }
6214    /// Settings that restrict the usage of a payment link.
6215    pub fn restrictions(mut self, restrictions: impl Into<RestrictionsParams>) -> Self {
6216        self.inner.restrictions = Some(restrictions.into());
6217        self
6218    }
6219    /// Configuration for collecting the customer's shipping address.
6220    pub fn shipping_address_collection(
6221        mut self,
6222        shipping_address_collection: impl Into<UpdatePaymentLinkShippingAddressCollection>,
6223    ) -> Self {
6224        self.inner.shipping_address_collection = Some(shipping_address_collection.into());
6225        self
6226    }
6227    /// Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button.
6228    /// Changing this value will also affect the hostname in the [url](https://docs.stripe.com/api/payment_links/payment_links/object#url) property (example: `donate.stripe.com`).
6229    pub fn submit_type(
6230        mut self,
6231        submit_type: impl Into<stripe_shared::PaymentLinkSubmitType>,
6232    ) -> Self {
6233        self.inner.submit_type = Some(submit_type.into());
6234        self
6235    }
6236    /// When creating a subscription, the specified configuration data will be used.
6237    /// There must be at least one line item with a recurring price to use `subscription_data`.
6238    pub fn subscription_data(
6239        mut self,
6240        subscription_data: impl Into<UpdatePaymentLinkSubscriptionData>,
6241    ) -> Self {
6242        self.inner.subscription_data = Some(subscription_data.into());
6243        self
6244    }
6245    /// Controls tax ID collection during checkout.
6246    pub fn tax_id_collection(
6247        mut self,
6248        tax_id_collection: impl Into<UpdatePaymentLinkTaxIdCollection>,
6249    ) -> Self {
6250        self.inner.tax_id_collection = Some(tax_id_collection.into());
6251        self
6252    }
6253}
6254impl UpdatePaymentLink {
6255    /// Send the request and return the deserialized response.
6256    pub async fn send<C: StripeClient>(
6257        &self,
6258        client: &C,
6259    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
6260        self.customize().send(client).await
6261    }
6262
6263    /// Send the request and return the deserialized response, blocking until completion.
6264    pub fn send_blocking<C: StripeBlockingClient>(
6265        &self,
6266        client: &C,
6267    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
6268        self.customize().send_blocking(client)
6269    }
6270}
6271
6272impl StripeRequest for UpdatePaymentLink {
6273    type Output = stripe_shared::PaymentLink;
6274
6275    fn build(&self) -> RequestBuilder {
6276        let payment_link = &self.payment_link;
6277        RequestBuilder::new(StripeMethod::Post, format!("/payment_links/{payment_link}"))
6278            .form(&self.inner)
6279    }
6280}
6281
6282#[derive(Clone, Eq, PartialEq)]
6283#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6284#[derive(serde::Serialize)]
6285pub struct AfterCompletionConfirmationPageParams {
6286    /// A custom message to display to the customer after the purchase is complete.
6287    #[serde(skip_serializing_if = "Option::is_none")]
6288    pub custom_message: Option<String>,
6289}
6290#[cfg(feature = "redact-generated-debug")]
6291impl std::fmt::Debug for AfterCompletionConfirmationPageParams {
6292    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6293        f.debug_struct("AfterCompletionConfirmationPageParams").finish_non_exhaustive()
6294    }
6295}
6296impl AfterCompletionConfirmationPageParams {
6297    pub fn new() -> Self {
6298        Self { custom_message: None }
6299    }
6300}
6301impl Default for AfterCompletionConfirmationPageParams {
6302    fn default() -> Self {
6303        Self::new()
6304    }
6305}
6306#[derive(Clone, Eq, PartialEq)]
6307#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6308#[derive(serde::Serialize)]
6309pub struct AfterCompletionRedirectParams {
6310    /// The URL the customer will be redirected to after the purchase is complete.
6311    /// You can embed `{CHECKOUT_SESSION_ID}` into the URL to have the `id` of the completed [checkout session](https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-id) included.
6312    pub url: String,
6313}
6314#[cfg(feature = "redact-generated-debug")]
6315impl std::fmt::Debug for AfterCompletionRedirectParams {
6316    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6317        f.debug_struct("AfterCompletionRedirectParams").finish_non_exhaustive()
6318    }
6319}
6320impl AfterCompletionRedirectParams {
6321    pub fn new(url: impl Into<String>) -> Self {
6322        Self { url: url.into() }
6323    }
6324}
6325#[derive(Clone, Eq, PartialEq)]
6326#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6327#[derive(serde::Serialize)]
6328pub struct CustomFieldOptionParam {
6329    /// The label for the option, displayed to the customer. Up to 100 characters.
6330    pub label: String,
6331    /// The value for this option, not displayed to the customer, used by your integration to reconcile the option selected by the customer.
6332    /// Must be unique to this option, alphanumeric, and up to 100 characters.
6333    pub value: String,
6334}
6335#[cfg(feature = "redact-generated-debug")]
6336impl std::fmt::Debug for CustomFieldOptionParam {
6337    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6338        f.debug_struct("CustomFieldOptionParam").finish_non_exhaustive()
6339    }
6340}
6341impl CustomFieldOptionParam {
6342    pub fn new(label: impl Into<String>, value: impl Into<String>) -> Self {
6343        Self { label: label.into(), value: value.into() }
6344    }
6345}
6346#[derive(Clone, Eq, PartialEq)]
6347#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6348#[derive(serde::Serialize)]
6349pub struct CustomTextPositionParam {
6350    /// Text can be up to 1200 characters in length.
6351    pub message: String,
6352}
6353#[cfg(feature = "redact-generated-debug")]
6354impl std::fmt::Debug for CustomTextPositionParam {
6355    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6356        f.debug_struct("CustomTextPositionParam").finish_non_exhaustive()
6357    }
6358}
6359impl CustomTextPositionParam {
6360    pub fn new(message: impl Into<String>) -> Self {
6361        Self { message: message.into() }
6362    }
6363}
6364#[derive(Clone, Eq, PartialEq)]
6365#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6366#[derive(serde::Serialize)]
6367pub struct CustomFieldParams {
6368    /// The name of the custom field. This may be up to 40 characters.
6369    pub name: String,
6370    /// The value of the custom field. This may be up to 140 characters.
6371    pub value: String,
6372}
6373#[cfg(feature = "redact-generated-debug")]
6374impl std::fmt::Debug for CustomFieldParams {
6375    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6376        f.debug_struct("CustomFieldParams").finish_non_exhaustive()
6377    }
6378}
6379impl CustomFieldParams {
6380    pub fn new(name: impl Into<String>, value: impl Into<String>) -> Self {
6381        Self { name: name.into(), value: value.into() }
6382    }
6383}
6384#[derive(Copy, Clone, Eq, PartialEq)]
6385#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6386#[derive(serde::Serialize)]
6387pub struct AdjustableQuantityParams {
6388    /// Set to true if the quantity can be adjusted to any non-negative Integer.
6389    pub enabled: bool,
6390    /// The maximum quantity the customer can purchase.
6391    /// By default this value is 99.
6392    /// You can specify a value up to 999999.
6393    #[serde(skip_serializing_if = "Option::is_none")]
6394    pub maximum: Option<i64>,
6395    /// The minimum quantity the customer can purchase.
6396    /// By default this value is 0.
6397    /// If there is only one item in the cart then that item's quantity cannot go down to 0.
6398    #[serde(skip_serializing_if = "Option::is_none")]
6399    pub minimum: Option<i64>,
6400}
6401#[cfg(feature = "redact-generated-debug")]
6402impl std::fmt::Debug for AdjustableQuantityParams {
6403    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6404        f.debug_struct("AdjustableQuantityParams").finish_non_exhaustive()
6405    }
6406}
6407impl AdjustableQuantityParams {
6408    pub fn new(enabled: impl Into<bool>) -> Self {
6409        Self { enabled: enabled.into(), maximum: None, minimum: None }
6410    }
6411}
6412#[derive(Copy, Clone, Eq, PartialEq)]
6413#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6414#[derive(serde::Serialize)]
6415pub struct NameCollectionBusinessParams {
6416    /// Enable business name collection on the payment link. Defaults to `false`.
6417    pub enabled: bool,
6418    /// Whether the customer is required to provide their business name before checking out.
6419    /// Defaults to `false`.
6420    #[serde(skip_serializing_if = "Option::is_none")]
6421    pub optional: Option<bool>,
6422}
6423#[cfg(feature = "redact-generated-debug")]
6424impl std::fmt::Debug for NameCollectionBusinessParams {
6425    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6426        f.debug_struct("NameCollectionBusinessParams").finish_non_exhaustive()
6427    }
6428}
6429impl NameCollectionBusinessParams {
6430    pub fn new(enabled: impl Into<bool>) -> Self {
6431        Self { enabled: enabled.into(), optional: None }
6432    }
6433}
6434#[derive(Copy, Clone, Eq, PartialEq)]
6435#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6436#[derive(serde::Serialize)]
6437pub struct NameCollectionIndividualParams {
6438    /// Enable individual name collection on the payment link. Defaults to `false`.
6439    pub enabled: bool,
6440    /// Whether the customer is required to provide their full name before checking out.
6441    /// Defaults to `false`.
6442    #[serde(skip_serializing_if = "Option::is_none")]
6443    pub optional: Option<bool>,
6444}
6445#[cfg(feature = "redact-generated-debug")]
6446impl std::fmt::Debug for NameCollectionIndividualParams {
6447    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6448        f.debug_struct("NameCollectionIndividualParams").finish_non_exhaustive()
6449    }
6450}
6451impl NameCollectionIndividualParams {
6452    pub fn new(enabled: impl Into<bool>) -> Self {
6453        Self { enabled: enabled.into(), optional: None }
6454    }
6455}
6456#[derive(Copy, Clone, Eq, PartialEq)]
6457#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6458#[derive(serde::Serialize)]
6459pub struct OptionalItemAdjustableQuantityParams {
6460    /// Set to true if the quantity can be adjusted to any non-negative integer.
6461    pub enabled: bool,
6462    /// The maximum quantity of this item the customer can purchase. By default this value is 99.
6463    #[serde(skip_serializing_if = "Option::is_none")]
6464    pub maximum: Option<i64>,
6465    /// The minimum quantity of this item the customer must purchase, if they choose to purchase it.
6466    /// Because this item is optional, the customer will always be able to remove it from their order, even if the `minimum` configured here is greater than 0.
6467    /// By default this value is 0.
6468    #[serde(skip_serializing_if = "Option::is_none")]
6469    pub minimum: Option<i64>,
6470}
6471#[cfg(feature = "redact-generated-debug")]
6472impl std::fmt::Debug for OptionalItemAdjustableQuantityParams {
6473    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6474        f.debug_struct("OptionalItemAdjustableQuantityParams").finish_non_exhaustive()
6475    }
6476}
6477impl OptionalItemAdjustableQuantityParams {
6478    pub fn new(enabled: impl Into<bool>) -> Self {
6479        Self { enabled: enabled.into(), maximum: None, minimum: None }
6480    }
6481}
6482#[derive(Copy, Clone, Eq, PartialEq)]
6483#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6484#[derive(serde::Serialize)]
6485pub struct PhoneNumberCollectionParams {
6486    /// Set to `true` to enable phone number collection.
6487    pub enabled: bool,
6488}
6489#[cfg(feature = "redact-generated-debug")]
6490impl std::fmt::Debug for PhoneNumberCollectionParams {
6491    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6492        f.debug_struct("PhoneNumberCollectionParams").finish_non_exhaustive()
6493    }
6494}
6495impl PhoneNumberCollectionParams {
6496    pub fn new(enabled: impl Into<bool>) -> Self {
6497        Self { enabled: enabled.into() }
6498    }
6499}
6500#[derive(Copy, Clone, Eq, PartialEq)]
6501#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6502#[derive(serde::Serialize)]
6503pub struct CompletedSessionsParams {
6504    /// The maximum number of checkout sessions that can be completed for the `completed_sessions` restriction to be met.
6505    pub limit: i64,
6506}
6507#[cfg(feature = "redact-generated-debug")]
6508impl std::fmt::Debug for CompletedSessionsParams {
6509    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6510        f.debug_struct("CompletedSessionsParams").finish_non_exhaustive()
6511    }
6512}
6513impl CompletedSessionsParams {
6514    pub fn new(limit: impl Into<i64>) -> Self {
6515        Self { limit: limit.into() }
6516    }
6517}
6518#[derive(Clone, Eq, PartialEq)]
6519#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6520#[derive(serde::Serialize)]
6521pub struct CustomFieldDropdownParam {
6522    /// The value that pre-fills the field on the payment page.Must match a `value` in the `options` array.
6523    #[serde(skip_serializing_if = "Option::is_none")]
6524    pub default_value: Option<String>,
6525    /// The options available for the customer to select. Up to 200 options allowed.
6526    pub options: Vec<CustomFieldOptionParam>,
6527}
6528#[cfg(feature = "redact-generated-debug")]
6529impl std::fmt::Debug for CustomFieldDropdownParam {
6530    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6531        f.debug_struct("CustomFieldDropdownParam").finish_non_exhaustive()
6532    }
6533}
6534impl CustomFieldDropdownParam {
6535    pub fn new(options: impl Into<Vec<CustomFieldOptionParam>>) -> Self {
6536        Self { default_value: None, options: options.into() }
6537    }
6538}
6539#[derive(Clone, Eq, PartialEq)]
6540#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6541#[derive(serde::Serialize)]
6542pub struct CustomTextParam {
6543    /// Custom text that should be displayed after the payment confirmation button.
6544    #[serde(skip_serializing_if = "Option::is_none")]
6545    pub after_submit: Option<CustomTextPositionParam>,
6546    /// Custom text that should be displayed alongside shipping address collection.
6547    #[serde(skip_serializing_if = "Option::is_none")]
6548    pub shipping_address: Option<CustomTextPositionParam>,
6549    /// Custom text that should be displayed alongside the payment confirmation button.
6550    #[serde(skip_serializing_if = "Option::is_none")]
6551    pub submit: Option<CustomTextPositionParam>,
6552    /// Custom text that should be displayed in place of the default terms of service agreement text.
6553    #[serde(skip_serializing_if = "Option::is_none")]
6554    pub terms_of_service_acceptance: Option<CustomTextPositionParam>,
6555}
6556#[cfg(feature = "redact-generated-debug")]
6557impl std::fmt::Debug for CustomTextParam {
6558    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6559        f.debug_struct("CustomTextParam").finish_non_exhaustive()
6560    }
6561}
6562impl CustomTextParam {
6563    pub fn new() -> Self {
6564        Self {
6565            after_submit: None,
6566            shipping_address: None,
6567            submit: None,
6568            terms_of_service_acceptance: None,
6569        }
6570    }
6571}
6572impl Default for CustomTextParam {
6573    fn default() -> Self {
6574        Self::new()
6575    }
6576}
6577#[derive(Copy, Clone, Eq, PartialEq)]
6578#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6579#[derive(serde::Serialize)]
6580pub struct NameCollectionParams {
6581    /// Controls settings applied for collecting the customer's business name.
6582    #[serde(skip_serializing_if = "Option::is_none")]
6583    pub business: Option<NameCollectionBusinessParams>,
6584    /// Controls settings applied for collecting the customer's individual name.
6585    #[serde(skip_serializing_if = "Option::is_none")]
6586    pub individual: Option<NameCollectionIndividualParams>,
6587}
6588#[cfg(feature = "redact-generated-debug")]
6589impl std::fmt::Debug for NameCollectionParams {
6590    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6591        f.debug_struct("NameCollectionParams").finish_non_exhaustive()
6592    }
6593}
6594impl NameCollectionParams {
6595    pub fn new() -> Self {
6596        Self { business: None, individual: None }
6597    }
6598}
6599impl Default for NameCollectionParams {
6600    fn default() -> Self {
6601        Self::new()
6602    }
6603}
6604#[derive(Clone, Eq, PartialEq)]
6605#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6606#[derive(serde::Serialize)]
6607pub struct OptionalItemParams {
6608    /// When set, provides configuration for the customer to adjust the quantity of the line item created when a customer chooses to add this optional item to their order.
6609    #[serde(skip_serializing_if = "Option::is_none")]
6610    pub adjustable_quantity: Option<OptionalItemAdjustableQuantityParams>,
6611    /// The ID of the [Price](https://docs.stripe.com/api/prices) or [Plan](https://docs.stripe.com/api/plans) object.
6612    pub price: String,
6613    /// The initial quantity of the line item created when a customer chooses to add this optional item to their order.
6614    pub quantity: u64,
6615}
6616#[cfg(feature = "redact-generated-debug")]
6617impl std::fmt::Debug for OptionalItemParams {
6618    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6619        f.debug_struct("OptionalItemParams").finish_non_exhaustive()
6620    }
6621}
6622impl OptionalItemParams {
6623    pub fn new(price: impl Into<String>, quantity: impl Into<u64>) -> Self {
6624        Self { adjustable_quantity: None, price: price.into(), quantity: quantity.into() }
6625    }
6626}
6627#[derive(Copy, Clone, Eq, PartialEq)]
6628#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
6629#[derive(serde::Serialize)]
6630pub struct RestrictionsParams {
6631    /// Configuration for the `completed_sessions` restriction type.
6632    pub completed_sessions: CompletedSessionsParams,
6633}
6634#[cfg(feature = "redact-generated-debug")]
6635impl std::fmt::Debug for RestrictionsParams {
6636    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
6637        f.debug_struct("RestrictionsParams").finish_non_exhaustive()
6638    }
6639}
6640impl RestrictionsParams {
6641    pub fn new(completed_sessions: impl Into<CompletedSessionsParams>) -> Self {
6642        Self { completed_sessions: completed_sessions.into() }
6643    }
6644}