stripe_shared/
payment_intent_payment_method_options_card.rs

1#[derive(Clone, Debug)]
2#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
3#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
4pub struct PaymentIntentPaymentMethodOptionsCard {
5    /// Controls when the funds will be captured from the customer's account.
6    pub capture_method: Option<PaymentIntentPaymentMethodOptionsCardCaptureMethod>,
7    /// Installment details for this payment.
8    ///
9    /// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments).
10    pub installments: Option<stripe_shared::PaymentMethodOptionsCardInstallments>,
11    /// Configuration options for setting up an eMandate for cards issued in India.
12    pub mandate_options: Option<stripe_shared::PaymentMethodOptionsCardMandateOptions>,
13    /// Selected network to process this payment intent on.
14    /// Depends on the available networks of the card attached to the payment intent.
15    /// Can be only set confirm-time.
16    pub network: Option<PaymentIntentPaymentMethodOptionsCardNetwork>,
17    /// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent.
18    pub request_extended_authorization:
19        Option<PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>,
20    /// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent.
21    pub request_incremental_authorization:
22        Option<PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>,
23    /// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent.
24    pub request_multicapture: Option<PaymentIntentPaymentMethodOptionsCardRequestMulticapture>,
25    /// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent.
26    pub request_overcapture: Option<PaymentIntentPaymentMethodOptionsCardRequestOvercapture>,
27    /// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication).
28    /// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
29    /// If not provided, this value defaults to `automatic`.
30    /// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
31    pub request_three_d_secure: Option<PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>,
32    /// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e.
33    /// using the cvc_token parameter).
34    pub require_cvc_recollection: Option<bool>,
35    /// Indicates that you intend to make future payments with this PaymentIntent's payment method.
36    ///
37    /// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
38    /// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
39    ///
40    /// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
41    ///
42    /// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
43    pub setup_future_usage: Option<PaymentIntentPaymentMethodOptionsCardSetupFutureUsage>,
44    /// Provides information about a card payment that customers see on their statements.
45    /// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor.
46    /// Maximum 22 characters.
47    /// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
48    pub statement_descriptor_suffix_kana: Option<String>,
49    /// Provides information about a card payment that customers see on their statements.
50    /// Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that’s set on the account to form the complete statement descriptor.
51    /// Maximum 17 characters.
52    /// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
53    pub statement_descriptor_suffix_kanji: Option<String>,
54}
55#[doc(hidden)]
56pub struct PaymentIntentPaymentMethodOptionsCardBuilder {
57    capture_method: Option<Option<PaymentIntentPaymentMethodOptionsCardCaptureMethod>>,
58    installments: Option<Option<stripe_shared::PaymentMethodOptionsCardInstallments>>,
59    mandate_options: Option<Option<stripe_shared::PaymentMethodOptionsCardMandateOptions>>,
60    network: Option<Option<PaymentIntentPaymentMethodOptionsCardNetwork>>,
61    request_extended_authorization:
62        Option<Option<PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>>,
63    request_incremental_authorization:
64        Option<Option<PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>>,
65    request_multicapture: Option<Option<PaymentIntentPaymentMethodOptionsCardRequestMulticapture>>,
66    request_overcapture: Option<Option<PaymentIntentPaymentMethodOptionsCardRequestOvercapture>>,
67    request_three_d_secure:
68        Option<Option<PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>>,
69    require_cvc_recollection: Option<Option<bool>>,
70    setup_future_usage: Option<Option<PaymentIntentPaymentMethodOptionsCardSetupFutureUsage>>,
71    statement_descriptor_suffix_kana: Option<Option<String>>,
72    statement_descriptor_suffix_kanji: Option<Option<String>>,
73}
74
75#[allow(
76    unused_variables,
77    irrefutable_let_patterns,
78    clippy::let_unit_value,
79    clippy::match_single_binding,
80    clippy::single_match
81)]
82const _: () = {
83    use miniserde::de::{Map, Visitor};
84    use miniserde::json::Value;
85    use miniserde::{make_place, Deserialize, Result};
86    use stripe_types::miniserde_helpers::FromValueOpt;
87    use stripe_types::{MapBuilder, ObjectDeser};
88
89    make_place!(Place);
90
91    impl Deserialize for PaymentIntentPaymentMethodOptionsCard {
92        fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
93            Place::new(out)
94        }
95    }
96
97    struct Builder<'a> {
98        out: &'a mut Option<PaymentIntentPaymentMethodOptionsCard>,
99        builder: PaymentIntentPaymentMethodOptionsCardBuilder,
100    }
101
102    impl Visitor for Place<PaymentIntentPaymentMethodOptionsCard> {
103        fn map(&mut self) -> Result<Box<dyn Map + '_>> {
104            Ok(Box::new(Builder {
105                out: &mut self.out,
106                builder: PaymentIntentPaymentMethodOptionsCardBuilder::deser_default(),
107            }))
108        }
109    }
110
111    impl MapBuilder for PaymentIntentPaymentMethodOptionsCardBuilder {
112        type Out = PaymentIntentPaymentMethodOptionsCard;
113        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
114            Ok(match k {
115                "capture_method" => Deserialize::begin(&mut self.capture_method),
116                "installments" => Deserialize::begin(&mut self.installments),
117                "mandate_options" => Deserialize::begin(&mut self.mandate_options),
118                "network" => Deserialize::begin(&mut self.network),
119                "request_extended_authorization" => {
120                    Deserialize::begin(&mut self.request_extended_authorization)
121                }
122                "request_incremental_authorization" => {
123                    Deserialize::begin(&mut self.request_incremental_authorization)
124                }
125                "request_multicapture" => Deserialize::begin(&mut self.request_multicapture),
126                "request_overcapture" => Deserialize::begin(&mut self.request_overcapture),
127                "request_three_d_secure" => Deserialize::begin(&mut self.request_three_d_secure),
128                "require_cvc_recollection" => {
129                    Deserialize::begin(&mut self.require_cvc_recollection)
130                }
131                "setup_future_usage" => Deserialize::begin(&mut self.setup_future_usage),
132                "statement_descriptor_suffix_kana" => {
133                    Deserialize::begin(&mut self.statement_descriptor_suffix_kana)
134                }
135                "statement_descriptor_suffix_kanji" => {
136                    Deserialize::begin(&mut self.statement_descriptor_suffix_kanji)
137                }
138
139                _ => <dyn Visitor>::ignore(),
140            })
141        }
142
143        fn deser_default() -> Self {
144            Self {
145                capture_method: Deserialize::default(),
146                installments: Deserialize::default(),
147                mandate_options: Deserialize::default(),
148                network: Deserialize::default(),
149                request_extended_authorization: Deserialize::default(),
150                request_incremental_authorization: Deserialize::default(),
151                request_multicapture: Deserialize::default(),
152                request_overcapture: Deserialize::default(),
153                request_three_d_secure: Deserialize::default(),
154                require_cvc_recollection: Deserialize::default(),
155                setup_future_usage: Deserialize::default(),
156                statement_descriptor_suffix_kana: Deserialize::default(),
157                statement_descriptor_suffix_kanji: Deserialize::default(),
158            }
159        }
160
161        fn take_out(&mut self) -> Option<Self::Out> {
162            let (
163                Some(capture_method),
164                Some(installments),
165                Some(mandate_options),
166                Some(network),
167                Some(request_extended_authorization),
168                Some(request_incremental_authorization),
169                Some(request_multicapture),
170                Some(request_overcapture),
171                Some(request_three_d_secure),
172                Some(require_cvc_recollection),
173                Some(setup_future_usage),
174                Some(statement_descriptor_suffix_kana),
175                Some(statement_descriptor_suffix_kanji),
176            ) = (
177                self.capture_method,
178                self.installments.take(),
179                self.mandate_options.take(),
180                self.network,
181                self.request_extended_authorization,
182                self.request_incremental_authorization,
183                self.request_multicapture,
184                self.request_overcapture,
185                self.request_three_d_secure,
186                self.require_cvc_recollection,
187                self.setup_future_usage,
188                self.statement_descriptor_suffix_kana.take(),
189                self.statement_descriptor_suffix_kanji.take(),
190            )
191            else {
192                return None;
193            };
194            Some(Self::Out {
195                capture_method,
196                installments,
197                mandate_options,
198                network,
199                request_extended_authorization,
200                request_incremental_authorization,
201                request_multicapture,
202                request_overcapture,
203                request_three_d_secure,
204                require_cvc_recollection,
205                setup_future_usage,
206                statement_descriptor_suffix_kana,
207                statement_descriptor_suffix_kanji,
208            })
209        }
210    }
211
212    impl Map for Builder<'_> {
213        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
214            self.builder.key(k)
215        }
216
217        fn finish(&mut self) -> Result<()> {
218            *self.out = self.builder.take_out();
219            Ok(())
220        }
221    }
222
223    impl ObjectDeser for PaymentIntentPaymentMethodOptionsCard {
224        type Builder = PaymentIntentPaymentMethodOptionsCardBuilder;
225    }
226
227    impl FromValueOpt for PaymentIntentPaymentMethodOptionsCard {
228        fn from_value(v: Value) -> Option<Self> {
229            let Value::Object(obj) = v else {
230                return None;
231            };
232            let mut b = PaymentIntentPaymentMethodOptionsCardBuilder::deser_default();
233            for (k, v) in obj {
234                match k.as_str() {
235                    "capture_method" => b.capture_method = FromValueOpt::from_value(v),
236                    "installments" => b.installments = FromValueOpt::from_value(v),
237                    "mandate_options" => b.mandate_options = FromValueOpt::from_value(v),
238                    "network" => b.network = FromValueOpt::from_value(v),
239                    "request_extended_authorization" => {
240                        b.request_extended_authorization = FromValueOpt::from_value(v)
241                    }
242                    "request_incremental_authorization" => {
243                        b.request_incremental_authorization = FromValueOpt::from_value(v)
244                    }
245                    "request_multicapture" => b.request_multicapture = FromValueOpt::from_value(v),
246                    "request_overcapture" => b.request_overcapture = FromValueOpt::from_value(v),
247                    "request_three_d_secure" => {
248                        b.request_three_d_secure = FromValueOpt::from_value(v)
249                    }
250                    "require_cvc_recollection" => {
251                        b.require_cvc_recollection = FromValueOpt::from_value(v)
252                    }
253                    "setup_future_usage" => b.setup_future_usage = FromValueOpt::from_value(v),
254                    "statement_descriptor_suffix_kana" => {
255                        b.statement_descriptor_suffix_kana = FromValueOpt::from_value(v)
256                    }
257                    "statement_descriptor_suffix_kanji" => {
258                        b.statement_descriptor_suffix_kanji = FromValueOpt::from_value(v)
259                    }
260
261                    _ => {}
262                }
263            }
264            b.take_out()
265        }
266    }
267};
268/// Controls when the funds will be captured from the customer's account.
269#[derive(Copy, Clone, Eq, PartialEq)]
270pub enum PaymentIntentPaymentMethodOptionsCardCaptureMethod {
271    Manual,
272}
273impl PaymentIntentPaymentMethodOptionsCardCaptureMethod {
274    pub fn as_str(self) -> &'static str {
275        use PaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
276        match self {
277            Manual => "manual",
278        }
279    }
280}
281
282impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
283    type Err = stripe_types::StripeParseError;
284    fn from_str(s: &str) -> Result<Self, Self::Err> {
285        use PaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
286        match s {
287            "manual" => Ok(Manual),
288            _ => Err(stripe_types::StripeParseError),
289        }
290    }
291}
292impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
293    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
294        f.write_str(self.as_str())
295    }
296}
297
298impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
299    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
300        f.write_str(self.as_str())
301    }
302}
303#[cfg(feature = "serialize")]
304impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
305    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
306    where
307        S: serde::Serializer,
308    {
309        serializer.serialize_str(self.as_str())
310    }
311}
312impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
313    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
314        crate::Place::new(out)
315    }
316}
317
318impl miniserde::de::Visitor for crate::Place<PaymentIntentPaymentMethodOptionsCardCaptureMethod> {
319    fn string(&mut self, s: &str) -> miniserde::Result<()> {
320        use std::str::FromStr;
321        self.out = Some(
322            PaymentIntentPaymentMethodOptionsCardCaptureMethod::from_str(s)
323                .map_err(|_| miniserde::Error)?,
324        );
325        Ok(())
326    }
327}
328
329stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardCaptureMethod);
330#[cfg(feature = "deserialize")]
331impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
332    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
333        use std::str::FromStr;
334        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
335        Self::from_str(&s).map_err(|_| {
336            serde::de::Error::custom(
337                "Unknown value for PaymentIntentPaymentMethodOptionsCardCaptureMethod",
338            )
339        })
340    }
341}
342/// Selected network to process this payment intent on.
343/// Depends on the available networks of the card attached to the payment intent.
344/// Can be only set confirm-time.
345#[derive(Copy, Clone, Eq, PartialEq)]
346pub enum PaymentIntentPaymentMethodOptionsCardNetwork {
347    Amex,
348    CartesBancaires,
349    Diners,
350    Discover,
351    EftposAu,
352    Girocard,
353    Interac,
354    Jcb,
355    Link,
356    Mastercard,
357    Unionpay,
358    Unknown,
359    Visa,
360}
361impl PaymentIntentPaymentMethodOptionsCardNetwork {
362    pub fn as_str(self) -> &'static str {
363        use PaymentIntentPaymentMethodOptionsCardNetwork::*;
364        match self {
365            Amex => "amex",
366            CartesBancaires => "cartes_bancaires",
367            Diners => "diners",
368            Discover => "discover",
369            EftposAu => "eftpos_au",
370            Girocard => "girocard",
371            Interac => "interac",
372            Jcb => "jcb",
373            Link => "link",
374            Mastercard => "mastercard",
375            Unionpay => "unionpay",
376            Unknown => "unknown",
377            Visa => "visa",
378        }
379    }
380}
381
382impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardNetwork {
383    type Err = stripe_types::StripeParseError;
384    fn from_str(s: &str) -> Result<Self, Self::Err> {
385        use PaymentIntentPaymentMethodOptionsCardNetwork::*;
386        match s {
387            "amex" => Ok(Amex),
388            "cartes_bancaires" => Ok(CartesBancaires),
389            "diners" => Ok(Diners),
390            "discover" => Ok(Discover),
391            "eftpos_au" => Ok(EftposAu),
392            "girocard" => Ok(Girocard),
393            "interac" => Ok(Interac),
394            "jcb" => Ok(Jcb),
395            "link" => Ok(Link),
396            "mastercard" => Ok(Mastercard),
397            "unionpay" => Ok(Unionpay),
398            "unknown" => Ok(Unknown),
399            "visa" => Ok(Visa),
400            _ => Err(stripe_types::StripeParseError),
401        }
402    }
403}
404impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardNetwork {
405    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
406        f.write_str(self.as_str())
407    }
408}
409
410impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardNetwork {
411    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
412        f.write_str(self.as_str())
413    }
414}
415#[cfg(feature = "serialize")]
416impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardNetwork {
417    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
418    where
419        S: serde::Serializer,
420    {
421        serializer.serialize_str(self.as_str())
422    }
423}
424impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardNetwork {
425    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
426        crate::Place::new(out)
427    }
428}
429
430impl miniserde::de::Visitor for crate::Place<PaymentIntentPaymentMethodOptionsCardNetwork> {
431    fn string(&mut self, s: &str) -> miniserde::Result<()> {
432        use std::str::FromStr;
433        self.out = Some(
434            PaymentIntentPaymentMethodOptionsCardNetwork::from_str(s)
435                .map_err(|_| miniserde::Error)?,
436        );
437        Ok(())
438    }
439}
440
441stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardNetwork);
442#[cfg(feature = "deserialize")]
443impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardNetwork {
444    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
445        use std::str::FromStr;
446        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
447        Self::from_str(&s).map_err(|_| {
448            serde::de::Error::custom(
449                "Unknown value for PaymentIntentPaymentMethodOptionsCardNetwork",
450            )
451        })
452    }
453}
454/// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent.
455#[derive(Copy, Clone, Eq, PartialEq)]
456pub enum PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
457    IfAvailable,
458    Never,
459}
460impl PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
461    pub fn as_str(self) -> &'static str {
462        use PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
463        match self {
464            IfAvailable => "if_available",
465            Never => "never",
466        }
467    }
468}
469
470impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
471    type Err = stripe_types::StripeParseError;
472    fn from_str(s: &str) -> Result<Self, Self::Err> {
473        use PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
474        match s {
475            "if_available" => Ok(IfAvailable),
476            "never" => Ok(Never),
477            _ => Err(stripe_types::StripeParseError),
478        }
479    }
480}
481impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
482    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
483        f.write_str(self.as_str())
484    }
485}
486
487impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
488    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
489        f.write_str(self.as_str())
490    }
491}
492#[cfg(feature = "serialize")]
493impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
494    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
495    where
496        S: serde::Serializer,
497    {
498        serializer.serialize_str(self.as_str())
499    }
500}
501impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
502    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
503        crate::Place::new(out)
504    }
505}
506
507impl miniserde::de::Visitor
508    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>
509{
510    fn string(&mut self, s: &str) -> miniserde::Result<()> {
511        use std::str::FromStr;
512        self.out = Some(
513            PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::from_str(s)
514                .map_err(|_| miniserde::Error)?,
515        );
516        Ok(())
517    }
518}
519
520stripe_types::impl_from_val_with_from_str!(
521    PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
522);
523#[cfg(feature = "deserialize")]
524impl<'de> serde::Deserialize<'de>
525    for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
526{
527    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
528        use std::str::FromStr;
529        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
530        Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization"))
531    }
532}
533/// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent.
534#[derive(Copy, Clone, Eq, PartialEq)]
535pub enum PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
536    IfAvailable,
537    Never,
538}
539impl PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
540    pub fn as_str(self) -> &'static str {
541        use PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
542        match self {
543            IfAvailable => "if_available",
544            Never => "never",
545        }
546    }
547}
548
549impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
550    type Err = stripe_types::StripeParseError;
551    fn from_str(s: &str) -> Result<Self, Self::Err> {
552        use PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
553        match s {
554            "if_available" => Ok(IfAvailable),
555            "never" => Ok(Never),
556            _ => Err(stripe_types::StripeParseError),
557        }
558    }
559}
560impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
561    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
562        f.write_str(self.as_str())
563    }
564}
565
566impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
567    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
568        f.write_str(self.as_str())
569    }
570}
571#[cfg(feature = "serialize")]
572impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
573    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
574    where
575        S: serde::Serializer,
576    {
577        serializer.serialize_str(self.as_str())
578    }
579}
580impl miniserde::Deserialize
581    for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
582{
583    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
584        crate::Place::new(out)
585    }
586}
587
588impl miniserde::de::Visitor
589    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>
590{
591    fn string(&mut self, s: &str) -> miniserde::Result<()> {
592        use std::str::FromStr;
593        self.out = Some(
594            PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::from_str(s)
595                .map_err(|_| miniserde::Error)?,
596        );
597        Ok(())
598    }
599}
600
601stripe_types::impl_from_val_with_from_str!(
602    PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
603);
604#[cfg(feature = "deserialize")]
605impl<'de> serde::Deserialize<'de>
606    for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
607{
608    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
609        use std::str::FromStr;
610        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
611        Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization"))
612    }
613}
614/// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent.
615#[derive(Copy, Clone, Eq, PartialEq)]
616pub enum PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
617    IfAvailable,
618    Never,
619}
620impl PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
621    pub fn as_str(self) -> &'static str {
622        use PaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
623        match self {
624            IfAvailable => "if_available",
625            Never => "never",
626        }
627    }
628}
629
630impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
631    type Err = stripe_types::StripeParseError;
632    fn from_str(s: &str) -> Result<Self, Self::Err> {
633        use PaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
634        match s {
635            "if_available" => Ok(IfAvailable),
636            "never" => Ok(Never),
637            _ => Err(stripe_types::StripeParseError),
638        }
639    }
640}
641impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
642    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
643        f.write_str(self.as_str())
644    }
645}
646
647impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
648    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
649        f.write_str(self.as_str())
650    }
651}
652#[cfg(feature = "serialize")]
653impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
654    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
655    where
656        S: serde::Serializer,
657    {
658        serializer.serialize_str(self.as_str())
659    }
660}
661impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
662    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
663        crate::Place::new(out)
664    }
665}
666
667impl miniserde::de::Visitor
668    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestMulticapture>
669{
670    fn string(&mut self, s: &str) -> miniserde::Result<()> {
671        use std::str::FromStr;
672        self.out = Some(
673            PaymentIntentPaymentMethodOptionsCardRequestMulticapture::from_str(s)
674                .map_err(|_| miniserde::Error)?,
675        );
676        Ok(())
677    }
678}
679
680stripe_types::impl_from_val_with_from_str!(
681    PaymentIntentPaymentMethodOptionsCardRequestMulticapture
682);
683#[cfg(feature = "deserialize")]
684impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
685    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
686        use std::str::FromStr;
687        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
688        Self::from_str(&s).map_err(|_| {
689            serde::de::Error::custom(
690                "Unknown value for PaymentIntentPaymentMethodOptionsCardRequestMulticapture",
691            )
692        })
693    }
694}
695/// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent.
696#[derive(Copy, Clone, Eq, PartialEq)]
697pub enum PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
698    IfAvailable,
699    Never,
700}
701impl PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
702    pub fn as_str(self) -> &'static str {
703        use PaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
704        match self {
705            IfAvailable => "if_available",
706            Never => "never",
707        }
708    }
709}
710
711impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
712    type Err = stripe_types::StripeParseError;
713    fn from_str(s: &str) -> Result<Self, Self::Err> {
714        use PaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
715        match s {
716            "if_available" => Ok(IfAvailable),
717            "never" => Ok(Never),
718            _ => Err(stripe_types::StripeParseError),
719        }
720    }
721}
722impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
723    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
724        f.write_str(self.as_str())
725    }
726}
727
728impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
729    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
730        f.write_str(self.as_str())
731    }
732}
733#[cfg(feature = "serialize")]
734impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
735    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
736    where
737        S: serde::Serializer,
738    {
739        serializer.serialize_str(self.as_str())
740    }
741}
742impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
743    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
744        crate::Place::new(out)
745    }
746}
747
748impl miniserde::de::Visitor
749    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestOvercapture>
750{
751    fn string(&mut self, s: &str) -> miniserde::Result<()> {
752        use std::str::FromStr;
753        self.out = Some(
754            PaymentIntentPaymentMethodOptionsCardRequestOvercapture::from_str(s)
755                .map_err(|_| miniserde::Error)?,
756        );
757        Ok(())
758    }
759}
760
761stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardRequestOvercapture);
762#[cfg(feature = "deserialize")]
763impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
764    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
765        use std::str::FromStr;
766        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
767        Self::from_str(&s).map_err(|_| {
768            serde::de::Error::custom(
769                "Unknown value for PaymentIntentPaymentMethodOptionsCardRequestOvercapture",
770            )
771        })
772    }
773}
774/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication).
775/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
776/// If not provided, this value defaults to `automatic`.
777/// Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
778#[derive(Copy, Clone, Eq, PartialEq)]
779pub enum PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
780    Any,
781    Automatic,
782    Challenge,
783}
784impl PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
785    pub fn as_str(self) -> &'static str {
786        use PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
787        match self {
788            Any => "any",
789            Automatic => "automatic",
790            Challenge => "challenge",
791        }
792    }
793}
794
795impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
796    type Err = stripe_types::StripeParseError;
797    fn from_str(s: &str) -> Result<Self, Self::Err> {
798        use PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
799        match s {
800            "any" => Ok(Any),
801            "automatic" => Ok(Automatic),
802            "challenge" => Ok(Challenge),
803            _ => Err(stripe_types::StripeParseError),
804        }
805    }
806}
807impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
808    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
809        f.write_str(self.as_str())
810    }
811}
812
813impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
814    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
815        f.write_str(self.as_str())
816    }
817}
818#[cfg(feature = "serialize")]
819impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
820    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
821    where
822        S: serde::Serializer,
823    {
824        serializer.serialize_str(self.as_str())
825    }
826}
827impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
828    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
829        crate::Place::new(out)
830    }
831}
832
833impl miniserde::de::Visitor
834    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>
835{
836    fn string(&mut self, s: &str) -> miniserde::Result<()> {
837        use std::str::FromStr;
838        self.out = Some(
839            PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::from_str(s)
840                .map_err(|_| miniserde::Error)?,
841        );
842        Ok(())
843    }
844}
845
846stripe_types::impl_from_val_with_from_str!(
847    PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure
848);
849#[cfg(feature = "deserialize")]
850impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
851    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
852        use std::str::FromStr;
853        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
854        Self::from_str(&s).map_err(|_| {
855            serde::de::Error::custom(
856                "Unknown value for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure",
857            )
858        })
859    }
860}
861/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
862///
863/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
864/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
865///
866/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
867///
868/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
869#[derive(Copy, Clone, Eq, PartialEq)]
870pub enum PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
871    None,
872    OffSession,
873    OnSession,
874}
875impl PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
876    pub fn as_str(self) -> &'static str {
877        use PaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
878        match self {
879            None => "none",
880            OffSession => "off_session",
881            OnSession => "on_session",
882        }
883    }
884}
885
886impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
887    type Err = stripe_types::StripeParseError;
888    fn from_str(s: &str) -> Result<Self, Self::Err> {
889        use PaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
890        match s {
891            "none" => Ok(None),
892            "off_session" => Ok(OffSession),
893            "on_session" => Ok(OnSession),
894            _ => Err(stripe_types::StripeParseError),
895        }
896    }
897}
898impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
899    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
900        f.write_str(self.as_str())
901    }
902}
903
904impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
905    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
906        f.write_str(self.as_str())
907    }
908}
909#[cfg(feature = "serialize")]
910impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
911    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
912    where
913        S: serde::Serializer,
914    {
915        serializer.serialize_str(self.as_str())
916    }
917}
918impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
919    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
920        crate::Place::new(out)
921    }
922}
923
924impl miniserde::de::Visitor
925    for crate::Place<PaymentIntentPaymentMethodOptionsCardSetupFutureUsage>
926{
927    fn string(&mut self, s: &str) -> miniserde::Result<()> {
928        use std::str::FromStr;
929        self.out = Some(
930            PaymentIntentPaymentMethodOptionsCardSetupFutureUsage::from_str(s)
931                .map_err(|_| miniserde::Error)?,
932        );
933        Ok(())
934    }
935}
936
937stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardSetupFutureUsage);
938#[cfg(feature = "deserialize")]
939impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
940    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
941        use std::str::FromStr;
942        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
943        Self::from_str(&s).map_err(|_| {
944            serde::de::Error::custom(
945                "Unknown value for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage",
946            )
947        })
948    }
949}