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::{Deserialize, Result, make_place};
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                _ => <dyn Visitor>::ignore(),
139            })
140        }
141
142        fn deser_default() -> Self {
143            Self {
144                capture_method: Deserialize::default(),
145                installments: Deserialize::default(),
146                mandate_options: Deserialize::default(),
147                network: Deserialize::default(),
148                request_extended_authorization: Deserialize::default(),
149                request_incremental_authorization: Deserialize::default(),
150                request_multicapture: Deserialize::default(),
151                request_overcapture: Deserialize::default(),
152                request_three_d_secure: Deserialize::default(),
153                require_cvc_recollection: Deserialize::default(),
154                setup_future_usage: Deserialize::default(),
155                statement_descriptor_suffix_kana: Deserialize::default(),
156                statement_descriptor_suffix_kanji: Deserialize::default(),
157            }
158        }
159
160        fn take_out(&mut self) -> Option<Self::Out> {
161            let (
162                Some(capture_method),
163                Some(installments),
164                Some(mandate_options),
165                Some(network),
166                Some(request_extended_authorization),
167                Some(request_incremental_authorization),
168                Some(request_multicapture),
169                Some(request_overcapture),
170                Some(request_three_d_secure),
171                Some(require_cvc_recollection),
172                Some(setup_future_usage),
173                Some(statement_descriptor_suffix_kana),
174                Some(statement_descriptor_suffix_kanji),
175            ) = (
176                self.capture_method,
177                self.installments.take(),
178                self.mandate_options.take(),
179                self.network,
180                self.request_extended_authorization,
181                self.request_incremental_authorization,
182                self.request_multicapture,
183                self.request_overcapture,
184                self.request_three_d_secure,
185                self.require_cvc_recollection,
186                self.setup_future_usage,
187                self.statement_descriptor_suffix_kana.take(),
188                self.statement_descriptor_suffix_kanji.take(),
189            )
190            else {
191                return None;
192            };
193            Some(Self::Out {
194                capture_method,
195                installments,
196                mandate_options,
197                network,
198                request_extended_authorization,
199                request_incremental_authorization,
200                request_multicapture,
201                request_overcapture,
202                request_three_d_secure,
203                require_cvc_recollection,
204                setup_future_usage,
205                statement_descriptor_suffix_kana,
206                statement_descriptor_suffix_kanji,
207            })
208        }
209    }
210
211    impl Map for Builder<'_> {
212        fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
213            self.builder.key(k)
214        }
215
216        fn finish(&mut self) -> Result<()> {
217            *self.out = self.builder.take_out();
218            Ok(())
219        }
220    }
221
222    impl ObjectDeser for PaymentIntentPaymentMethodOptionsCard {
223        type Builder = PaymentIntentPaymentMethodOptionsCardBuilder;
224    }
225
226    impl FromValueOpt for PaymentIntentPaymentMethodOptionsCard {
227        fn from_value(v: Value) -> Option<Self> {
228            let Value::Object(obj) = v else {
229                return None;
230            };
231            let mut b = PaymentIntentPaymentMethodOptionsCardBuilder::deser_default();
232            for (k, v) in obj {
233                match k.as_str() {
234                    "capture_method" => b.capture_method = FromValueOpt::from_value(v),
235                    "installments" => b.installments = FromValueOpt::from_value(v),
236                    "mandate_options" => b.mandate_options = FromValueOpt::from_value(v),
237                    "network" => b.network = FromValueOpt::from_value(v),
238                    "request_extended_authorization" => {
239                        b.request_extended_authorization = FromValueOpt::from_value(v)
240                    }
241                    "request_incremental_authorization" => {
242                        b.request_incremental_authorization = FromValueOpt::from_value(v)
243                    }
244                    "request_multicapture" => b.request_multicapture = FromValueOpt::from_value(v),
245                    "request_overcapture" => b.request_overcapture = FromValueOpt::from_value(v),
246                    "request_three_d_secure" => {
247                        b.request_three_d_secure = FromValueOpt::from_value(v)
248                    }
249                    "require_cvc_recollection" => {
250                        b.require_cvc_recollection = FromValueOpt::from_value(v)
251                    }
252                    "setup_future_usage" => b.setup_future_usage = FromValueOpt::from_value(v),
253                    "statement_descriptor_suffix_kana" => {
254                        b.statement_descriptor_suffix_kana = FromValueOpt::from_value(v)
255                    }
256                    "statement_descriptor_suffix_kanji" => {
257                        b.statement_descriptor_suffix_kanji = FromValueOpt::from_value(v)
258                    }
259                    _ => {}
260                }
261            }
262            b.take_out()
263        }
264    }
265};
266/// Controls when the funds will be captured from the customer's account.
267#[derive(Copy, Clone, Eq, PartialEq)]
268pub enum PaymentIntentPaymentMethodOptionsCardCaptureMethod {
269    Manual,
270}
271impl PaymentIntentPaymentMethodOptionsCardCaptureMethod {
272    pub fn as_str(self) -> &'static str {
273        use PaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
274        match self {
275            Manual => "manual",
276        }
277    }
278}
279
280impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
281    type Err = stripe_types::StripeParseError;
282    fn from_str(s: &str) -> Result<Self, Self::Err> {
283        use PaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
284        match s {
285            "manual" => Ok(Manual),
286            _ => Err(stripe_types::StripeParseError),
287        }
288    }
289}
290impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
291    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
292        f.write_str(self.as_str())
293    }
294}
295
296impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
297    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
298        f.write_str(self.as_str())
299    }
300}
301#[cfg(feature = "serialize")]
302impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
303    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
304    where
305        S: serde::Serializer,
306    {
307        serializer.serialize_str(self.as_str())
308    }
309}
310impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
311    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
312        crate::Place::new(out)
313    }
314}
315
316impl miniserde::de::Visitor for crate::Place<PaymentIntentPaymentMethodOptionsCardCaptureMethod> {
317    fn string(&mut self, s: &str) -> miniserde::Result<()> {
318        use std::str::FromStr;
319        self.out = Some(
320            PaymentIntentPaymentMethodOptionsCardCaptureMethod::from_str(s)
321                .map_err(|_| miniserde::Error)?,
322        );
323        Ok(())
324    }
325}
326
327stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardCaptureMethod);
328#[cfg(feature = "deserialize")]
329impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardCaptureMethod {
330    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
331        use std::str::FromStr;
332        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
333        Self::from_str(&s).map_err(|_| {
334            serde::de::Error::custom(
335                "Unknown value for PaymentIntentPaymentMethodOptionsCardCaptureMethod",
336            )
337        })
338    }
339}
340/// Selected network to process this payment intent on.
341/// Depends on the available networks of the card attached to the payment intent.
342/// Can be only set confirm-time.
343#[derive(Copy, Clone, Eq, PartialEq)]
344pub enum PaymentIntentPaymentMethodOptionsCardNetwork {
345    Amex,
346    CartesBancaires,
347    Diners,
348    Discover,
349    EftposAu,
350    Girocard,
351    Interac,
352    Jcb,
353    Link,
354    Mastercard,
355    Unionpay,
356    Unknown,
357    Visa,
358}
359impl PaymentIntentPaymentMethodOptionsCardNetwork {
360    pub fn as_str(self) -> &'static str {
361        use PaymentIntentPaymentMethodOptionsCardNetwork::*;
362        match self {
363            Amex => "amex",
364            CartesBancaires => "cartes_bancaires",
365            Diners => "diners",
366            Discover => "discover",
367            EftposAu => "eftpos_au",
368            Girocard => "girocard",
369            Interac => "interac",
370            Jcb => "jcb",
371            Link => "link",
372            Mastercard => "mastercard",
373            Unionpay => "unionpay",
374            Unknown => "unknown",
375            Visa => "visa",
376        }
377    }
378}
379
380impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardNetwork {
381    type Err = stripe_types::StripeParseError;
382    fn from_str(s: &str) -> Result<Self, Self::Err> {
383        use PaymentIntentPaymentMethodOptionsCardNetwork::*;
384        match s {
385            "amex" => Ok(Amex),
386            "cartes_bancaires" => Ok(CartesBancaires),
387            "diners" => Ok(Diners),
388            "discover" => Ok(Discover),
389            "eftpos_au" => Ok(EftposAu),
390            "girocard" => Ok(Girocard),
391            "interac" => Ok(Interac),
392            "jcb" => Ok(Jcb),
393            "link" => Ok(Link),
394            "mastercard" => Ok(Mastercard),
395            "unionpay" => Ok(Unionpay),
396            "unknown" => Ok(Unknown),
397            "visa" => Ok(Visa),
398            _ => Err(stripe_types::StripeParseError),
399        }
400    }
401}
402impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardNetwork {
403    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
404        f.write_str(self.as_str())
405    }
406}
407
408impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardNetwork {
409    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
410        f.write_str(self.as_str())
411    }
412}
413#[cfg(feature = "serialize")]
414impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardNetwork {
415    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
416    where
417        S: serde::Serializer,
418    {
419        serializer.serialize_str(self.as_str())
420    }
421}
422impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardNetwork {
423    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
424        crate::Place::new(out)
425    }
426}
427
428impl miniserde::de::Visitor for crate::Place<PaymentIntentPaymentMethodOptionsCardNetwork> {
429    fn string(&mut self, s: &str) -> miniserde::Result<()> {
430        use std::str::FromStr;
431        self.out = Some(
432            PaymentIntentPaymentMethodOptionsCardNetwork::from_str(s)
433                .map_err(|_| miniserde::Error)?,
434        );
435        Ok(())
436    }
437}
438
439stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardNetwork);
440#[cfg(feature = "deserialize")]
441impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardNetwork {
442    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
443        use std::str::FromStr;
444        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
445        Self::from_str(&s).map_err(|_| {
446            serde::de::Error::custom(
447                "Unknown value for PaymentIntentPaymentMethodOptionsCardNetwork",
448            )
449        })
450    }
451}
452/// Request ability to [capture beyond the standard authorization validity window](https://stripe.com/docs/payments/extended-authorization) for this PaymentIntent.
453#[derive(Copy, Clone, Eq, PartialEq)]
454pub enum PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
455    IfAvailable,
456    Never,
457}
458impl PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
459    pub fn as_str(self) -> &'static str {
460        use PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
461        match self {
462            IfAvailable => "if_available",
463            Never => "never",
464        }
465    }
466}
467
468impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
469    type Err = stripe_types::StripeParseError;
470    fn from_str(s: &str) -> Result<Self, Self::Err> {
471        use PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
472        match s {
473            "if_available" => Ok(IfAvailable),
474            "never" => Ok(Never),
475            _ => Err(stripe_types::StripeParseError),
476        }
477    }
478}
479impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
480    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
481        f.write_str(self.as_str())
482    }
483}
484
485impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
486    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
487        f.write_str(self.as_str())
488    }
489}
490#[cfg(feature = "serialize")]
491impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
492    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
493    where
494        S: serde::Serializer,
495    {
496        serializer.serialize_str(self.as_str())
497    }
498}
499impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
500    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
501        crate::Place::new(out)
502    }
503}
504
505impl miniserde::de::Visitor
506    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>
507{
508    fn string(&mut self, s: &str) -> miniserde::Result<()> {
509        use std::str::FromStr;
510        self.out = Some(
511            PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::from_str(s)
512                .map_err(|_| miniserde::Error)?,
513        );
514        Ok(())
515    }
516}
517
518stripe_types::impl_from_val_with_from_str!(
519    PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
520);
521#[cfg(feature = "deserialize")]
522impl<'de> serde::Deserialize<'de>
523    for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
524{
525    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
526        use std::str::FromStr;
527        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
528        Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization"))
529    }
530}
531/// Request ability to [increment the authorization](https://stripe.com/docs/payments/incremental-authorization) for this PaymentIntent.
532#[derive(Copy, Clone, Eq, PartialEq)]
533pub enum PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
534    IfAvailable,
535    Never,
536}
537impl PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
538    pub fn as_str(self) -> &'static str {
539        use PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
540        match self {
541            IfAvailable => "if_available",
542            Never => "never",
543        }
544    }
545}
546
547impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
548    type Err = stripe_types::StripeParseError;
549    fn from_str(s: &str) -> Result<Self, Self::Err> {
550        use PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
551        match s {
552            "if_available" => Ok(IfAvailable),
553            "never" => Ok(Never),
554            _ => Err(stripe_types::StripeParseError),
555        }
556    }
557}
558impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
559    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
560        f.write_str(self.as_str())
561    }
562}
563
564impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
565    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
566        f.write_str(self.as_str())
567    }
568}
569#[cfg(feature = "serialize")]
570impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
571    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
572    where
573        S: serde::Serializer,
574    {
575        serializer.serialize_str(self.as_str())
576    }
577}
578impl miniserde::Deserialize
579    for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
580{
581    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
582        crate::Place::new(out)
583    }
584}
585
586impl miniserde::de::Visitor
587    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>
588{
589    fn string(&mut self, s: &str) -> miniserde::Result<()> {
590        use std::str::FromStr;
591        self.out = Some(
592            PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::from_str(s)
593                .map_err(|_| miniserde::Error)?,
594        );
595        Ok(())
596    }
597}
598
599stripe_types::impl_from_val_with_from_str!(
600    PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
601);
602#[cfg(feature = "deserialize")]
603impl<'de> serde::Deserialize<'de>
604    for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
605{
606    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
607        use std::str::FromStr;
608        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
609        Self::from_str(&s).map_err(|_| serde::de::Error::custom("Unknown value for PaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization"))
610    }
611}
612/// Request ability to make [multiple captures](https://stripe.com/docs/payments/multicapture) for this PaymentIntent.
613#[derive(Copy, Clone, Eq, PartialEq)]
614pub enum PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
615    IfAvailable,
616    Never,
617}
618impl PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
619    pub fn as_str(self) -> &'static str {
620        use PaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
621        match self {
622            IfAvailable => "if_available",
623            Never => "never",
624        }
625    }
626}
627
628impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
629    type Err = stripe_types::StripeParseError;
630    fn from_str(s: &str) -> Result<Self, Self::Err> {
631        use PaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
632        match s {
633            "if_available" => Ok(IfAvailable),
634            "never" => Ok(Never),
635            _ => Err(stripe_types::StripeParseError),
636        }
637    }
638}
639impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
640    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
641        f.write_str(self.as_str())
642    }
643}
644
645impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
646    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
647        f.write_str(self.as_str())
648    }
649}
650#[cfg(feature = "serialize")]
651impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
652    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
653    where
654        S: serde::Serializer,
655    {
656        serializer.serialize_str(self.as_str())
657    }
658}
659impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
660    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
661        crate::Place::new(out)
662    }
663}
664
665impl miniserde::de::Visitor
666    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestMulticapture>
667{
668    fn string(&mut self, s: &str) -> miniserde::Result<()> {
669        use std::str::FromStr;
670        self.out = Some(
671            PaymentIntentPaymentMethodOptionsCardRequestMulticapture::from_str(s)
672                .map_err(|_| miniserde::Error)?,
673        );
674        Ok(())
675    }
676}
677
678stripe_types::impl_from_val_with_from_str!(
679    PaymentIntentPaymentMethodOptionsCardRequestMulticapture
680);
681#[cfg(feature = "deserialize")]
682impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardRequestMulticapture {
683    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
684        use std::str::FromStr;
685        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
686        Self::from_str(&s).map_err(|_| {
687            serde::de::Error::custom(
688                "Unknown value for PaymentIntentPaymentMethodOptionsCardRequestMulticapture",
689            )
690        })
691    }
692}
693/// Request ability to [overcapture](https://stripe.com/docs/payments/overcapture) for this PaymentIntent.
694#[derive(Copy, Clone, Eq, PartialEq)]
695pub enum PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
696    IfAvailable,
697    Never,
698}
699impl PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
700    pub fn as_str(self) -> &'static str {
701        use PaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
702        match self {
703            IfAvailable => "if_available",
704            Never => "never",
705        }
706    }
707}
708
709impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
710    type Err = stripe_types::StripeParseError;
711    fn from_str(s: &str) -> Result<Self, Self::Err> {
712        use PaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
713        match s {
714            "if_available" => Ok(IfAvailable),
715            "never" => Ok(Never),
716            _ => Err(stripe_types::StripeParseError),
717        }
718    }
719}
720impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
721    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
722        f.write_str(self.as_str())
723    }
724}
725
726impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
727    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
728        f.write_str(self.as_str())
729    }
730}
731#[cfg(feature = "serialize")]
732impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
733    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
734    where
735        S: serde::Serializer,
736    {
737        serializer.serialize_str(self.as_str())
738    }
739}
740impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
741    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
742        crate::Place::new(out)
743    }
744}
745
746impl miniserde::de::Visitor
747    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestOvercapture>
748{
749    fn string(&mut self, s: &str) -> miniserde::Result<()> {
750        use std::str::FromStr;
751        self.out = Some(
752            PaymentIntentPaymentMethodOptionsCardRequestOvercapture::from_str(s)
753                .map_err(|_| miniserde::Error)?,
754        );
755        Ok(())
756    }
757}
758
759stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardRequestOvercapture);
760#[cfg(feature = "deserialize")]
761impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardRequestOvercapture {
762    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
763        use std::str::FromStr;
764        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
765        Self::from_str(&s).map_err(|_| {
766            serde::de::Error::custom(
767                "Unknown value for PaymentIntentPaymentMethodOptionsCardRequestOvercapture",
768            )
769        })
770    }
771}
772/// 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).
773/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
774/// If not provided, this value defaults to `automatic`.
775/// 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.
776#[derive(Copy, Clone, Eq, PartialEq)]
777pub enum PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
778    Any,
779    Automatic,
780    Challenge,
781}
782impl PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
783    pub fn as_str(self) -> &'static str {
784        use PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
785        match self {
786            Any => "any",
787            Automatic => "automatic",
788            Challenge => "challenge",
789        }
790    }
791}
792
793impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
794    type Err = stripe_types::StripeParseError;
795    fn from_str(s: &str) -> Result<Self, Self::Err> {
796        use PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
797        match s {
798            "any" => Ok(Any),
799            "automatic" => Ok(Automatic),
800            "challenge" => Ok(Challenge),
801            _ => Err(stripe_types::StripeParseError),
802        }
803    }
804}
805impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
806    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
807        f.write_str(self.as_str())
808    }
809}
810
811impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
812    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
813        f.write_str(self.as_str())
814    }
815}
816#[cfg(feature = "serialize")]
817impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
818    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
819    where
820        S: serde::Serializer,
821    {
822        serializer.serialize_str(self.as_str())
823    }
824}
825impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
826    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
827        crate::Place::new(out)
828    }
829}
830
831impl miniserde::de::Visitor
832    for crate::Place<PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>
833{
834    fn string(&mut self, s: &str) -> miniserde::Result<()> {
835        use std::str::FromStr;
836        self.out = Some(
837            PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::from_str(s)
838                .map_err(|_| miniserde::Error)?,
839        );
840        Ok(())
841    }
842}
843
844stripe_types::impl_from_val_with_from_str!(
845    PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure
846);
847#[cfg(feature = "deserialize")]
848impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
849    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
850        use std::str::FromStr;
851        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
852        Self::from_str(&s).map_err(|_| {
853            serde::de::Error::custom(
854                "Unknown value for PaymentIntentPaymentMethodOptionsCardRequestThreeDSecure",
855            )
856        })
857    }
858}
859/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
860///
861/// 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.
862/// 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.
863///
864/// 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.
865///
866/// 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).
867#[derive(Copy, Clone, Eq, PartialEq)]
868pub enum PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
869    None,
870    OffSession,
871    OnSession,
872}
873impl PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
874    pub fn as_str(self) -> &'static str {
875        use PaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
876        match self {
877            None => "none",
878            OffSession => "off_session",
879            OnSession => "on_session",
880        }
881    }
882}
883
884impl std::str::FromStr for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
885    type Err = stripe_types::StripeParseError;
886    fn from_str(s: &str) -> Result<Self, Self::Err> {
887        use PaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
888        match s {
889            "none" => Ok(None),
890            "off_session" => Ok(OffSession),
891            "on_session" => Ok(OnSession),
892            _ => Err(stripe_types::StripeParseError),
893        }
894    }
895}
896impl std::fmt::Display for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
897    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
898        f.write_str(self.as_str())
899    }
900}
901
902impl std::fmt::Debug for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
903    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
904        f.write_str(self.as_str())
905    }
906}
907#[cfg(feature = "serialize")]
908impl serde::Serialize for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
909    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
910    where
911        S: serde::Serializer,
912    {
913        serializer.serialize_str(self.as_str())
914    }
915}
916impl miniserde::Deserialize for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
917    fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
918        crate::Place::new(out)
919    }
920}
921
922impl miniserde::de::Visitor
923    for crate::Place<PaymentIntentPaymentMethodOptionsCardSetupFutureUsage>
924{
925    fn string(&mut self, s: &str) -> miniserde::Result<()> {
926        use std::str::FromStr;
927        self.out = Some(
928            PaymentIntentPaymentMethodOptionsCardSetupFutureUsage::from_str(s)
929                .map_err(|_| miniserde::Error)?,
930        );
931        Ok(())
932    }
933}
934
935stripe_types::impl_from_val_with_from_str!(PaymentIntentPaymentMethodOptionsCardSetupFutureUsage);
936#[cfg(feature = "deserialize")]
937impl<'de> serde::Deserialize<'de> for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
938    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
939        use std::str::FromStr;
940        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
941        Self::from_str(&s).map_err(|_| {
942            serde::de::Error::custom(
943                "Unknown value for PaymentIntentPaymentMethodOptionsCardSetupFutureUsage",
944            )
945        })
946    }
947}