Skip to main content

stripe_payment/payment_method/
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 ListPaymentMethodBuilder {
9    #[serde(skip_serializing_if = "Option::is_none")]
10    allow_redisplay: Option<stripe_shared::PaymentMethodAllowRedisplay>,
11    #[serde(skip_serializing_if = "Option::is_none")]
12    customer: Option<String>,
13    #[serde(skip_serializing_if = "Option::is_none")]
14    customer_account: Option<String>,
15    #[serde(skip_serializing_if = "Option::is_none")]
16    ending_before: Option<String>,
17    #[serde(skip_serializing_if = "Option::is_none")]
18    expand: Option<Vec<String>>,
19    #[serde(skip_serializing_if = "Option::is_none")]
20    limit: Option<i64>,
21    #[serde(skip_serializing_if = "Option::is_none")]
22    starting_after: Option<String>,
23    #[serde(rename = "type")]
24    #[serde(skip_serializing_if = "Option::is_none")]
25    type_: Option<ListPaymentMethodType>,
26}
27#[cfg(feature = "redact-generated-debug")]
28impl std::fmt::Debug for ListPaymentMethodBuilder {
29    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
30        f.debug_struct("ListPaymentMethodBuilder").finish_non_exhaustive()
31    }
32}
33impl ListPaymentMethodBuilder {
34    fn new() -> Self {
35        Self {
36            allow_redisplay: None,
37            customer: None,
38            customer_account: None,
39            ending_before: None,
40            expand: None,
41            limit: None,
42            starting_after: None,
43            type_: None,
44        }
45    }
46}
47/// Filters the list by the object `type` field.
48/// Unfiltered, the list returns all payment method types except `custom`.
49/// If your integration expects only one type of payment method in the response, specify that type value in the request to reduce your payload.
50#[derive(Clone, Eq, PartialEq)]
51#[non_exhaustive]
52pub enum ListPaymentMethodType {
53    AcssDebit,
54    Affirm,
55    AfterpayClearpay,
56    Alipay,
57    Alma,
58    AmazonPay,
59    AuBecsDebit,
60    BacsDebit,
61    Bancontact,
62    Billie,
63    Blik,
64    Boleto,
65    Card,
66    Cashapp,
67    Crypto,
68    Custom,
69    CustomerBalance,
70    Eps,
71    Fpx,
72    Giropay,
73    Grabpay,
74    Ideal,
75    KakaoPay,
76    Klarna,
77    Konbini,
78    KrCard,
79    Link,
80    MbWay,
81    Mobilepay,
82    Multibanco,
83    NaverPay,
84    NzBankAccount,
85    Oxxo,
86    P24,
87    PayByBank,
88    Payco,
89    Paynow,
90    Paypal,
91    Payto,
92    Pix,
93    Promptpay,
94    RevolutPay,
95    SamsungPay,
96    Satispay,
97    SepaDebit,
98    Sofort,
99    Swish,
100    Twint,
101    Upi,
102    UsBankAccount,
103    WechatPay,
104    Zip,
105    /// An unrecognized value from Stripe. Should not be used as a request parameter.
106    Unknown(String),
107}
108impl ListPaymentMethodType {
109    pub fn as_str(&self) -> &str {
110        use ListPaymentMethodType::*;
111        match self {
112            AcssDebit => "acss_debit",
113            Affirm => "affirm",
114            AfterpayClearpay => "afterpay_clearpay",
115            Alipay => "alipay",
116            Alma => "alma",
117            AmazonPay => "amazon_pay",
118            AuBecsDebit => "au_becs_debit",
119            BacsDebit => "bacs_debit",
120            Bancontact => "bancontact",
121            Billie => "billie",
122            Blik => "blik",
123            Boleto => "boleto",
124            Card => "card",
125            Cashapp => "cashapp",
126            Crypto => "crypto",
127            Custom => "custom",
128            CustomerBalance => "customer_balance",
129            Eps => "eps",
130            Fpx => "fpx",
131            Giropay => "giropay",
132            Grabpay => "grabpay",
133            Ideal => "ideal",
134            KakaoPay => "kakao_pay",
135            Klarna => "klarna",
136            Konbini => "konbini",
137            KrCard => "kr_card",
138            Link => "link",
139            MbWay => "mb_way",
140            Mobilepay => "mobilepay",
141            Multibanco => "multibanco",
142            NaverPay => "naver_pay",
143            NzBankAccount => "nz_bank_account",
144            Oxxo => "oxxo",
145            P24 => "p24",
146            PayByBank => "pay_by_bank",
147            Payco => "payco",
148            Paynow => "paynow",
149            Paypal => "paypal",
150            Payto => "payto",
151            Pix => "pix",
152            Promptpay => "promptpay",
153            RevolutPay => "revolut_pay",
154            SamsungPay => "samsung_pay",
155            Satispay => "satispay",
156            SepaDebit => "sepa_debit",
157            Sofort => "sofort",
158            Swish => "swish",
159            Twint => "twint",
160            Upi => "upi",
161            UsBankAccount => "us_bank_account",
162            WechatPay => "wechat_pay",
163            Zip => "zip",
164            Unknown(v) => v,
165        }
166    }
167}
168
169impl std::str::FromStr for ListPaymentMethodType {
170    type Err = std::convert::Infallible;
171    fn from_str(s: &str) -> Result<Self, Self::Err> {
172        use ListPaymentMethodType::*;
173        match s {
174            "acss_debit" => Ok(AcssDebit),
175            "affirm" => Ok(Affirm),
176            "afterpay_clearpay" => Ok(AfterpayClearpay),
177            "alipay" => Ok(Alipay),
178            "alma" => Ok(Alma),
179            "amazon_pay" => Ok(AmazonPay),
180            "au_becs_debit" => Ok(AuBecsDebit),
181            "bacs_debit" => Ok(BacsDebit),
182            "bancontact" => Ok(Bancontact),
183            "billie" => Ok(Billie),
184            "blik" => Ok(Blik),
185            "boleto" => Ok(Boleto),
186            "card" => Ok(Card),
187            "cashapp" => Ok(Cashapp),
188            "crypto" => Ok(Crypto),
189            "custom" => Ok(Custom),
190            "customer_balance" => Ok(CustomerBalance),
191            "eps" => Ok(Eps),
192            "fpx" => Ok(Fpx),
193            "giropay" => Ok(Giropay),
194            "grabpay" => Ok(Grabpay),
195            "ideal" => Ok(Ideal),
196            "kakao_pay" => Ok(KakaoPay),
197            "klarna" => Ok(Klarna),
198            "konbini" => Ok(Konbini),
199            "kr_card" => Ok(KrCard),
200            "link" => Ok(Link),
201            "mb_way" => Ok(MbWay),
202            "mobilepay" => Ok(Mobilepay),
203            "multibanco" => Ok(Multibanco),
204            "naver_pay" => Ok(NaverPay),
205            "nz_bank_account" => Ok(NzBankAccount),
206            "oxxo" => Ok(Oxxo),
207            "p24" => Ok(P24),
208            "pay_by_bank" => Ok(PayByBank),
209            "payco" => Ok(Payco),
210            "paynow" => Ok(Paynow),
211            "paypal" => Ok(Paypal),
212            "payto" => Ok(Payto),
213            "pix" => Ok(Pix),
214            "promptpay" => Ok(Promptpay),
215            "revolut_pay" => Ok(RevolutPay),
216            "samsung_pay" => Ok(SamsungPay),
217            "satispay" => Ok(Satispay),
218            "sepa_debit" => Ok(SepaDebit),
219            "sofort" => Ok(Sofort),
220            "swish" => Ok(Swish),
221            "twint" => Ok(Twint),
222            "upi" => Ok(Upi),
223            "us_bank_account" => Ok(UsBankAccount),
224            "wechat_pay" => Ok(WechatPay),
225            "zip" => Ok(Zip),
226            v => {
227                tracing::warn!("Unknown value '{}' for enum '{}'", v, "ListPaymentMethodType");
228                Ok(Unknown(v.to_owned()))
229            }
230        }
231    }
232}
233impl std::fmt::Display for ListPaymentMethodType {
234    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
235        f.write_str(self.as_str())
236    }
237}
238
239#[cfg(not(feature = "redact-generated-debug"))]
240impl std::fmt::Debug for ListPaymentMethodType {
241    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
242        f.write_str(self.as_str())
243    }
244}
245#[cfg(feature = "redact-generated-debug")]
246impl std::fmt::Debug for ListPaymentMethodType {
247    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
248        f.debug_struct(stringify!(ListPaymentMethodType)).finish_non_exhaustive()
249    }
250}
251impl serde::Serialize for ListPaymentMethodType {
252    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
253    where
254        S: serde::Serializer,
255    {
256        serializer.serialize_str(self.as_str())
257    }
258}
259#[cfg(feature = "deserialize")]
260impl<'de> serde::Deserialize<'de> for ListPaymentMethodType {
261    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
262        use std::str::FromStr;
263        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
264        Ok(Self::from_str(&s).expect("infallible"))
265    }
266}
267/// Returns a list of all PaymentMethods.
268#[derive(Clone)]
269#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
270#[derive(serde::Serialize)]
271pub struct ListPaymentMethod {
272    inner: ListPaymentMethodBuilder,
273}
274#[cfg(feature = "redact-generated-debug")]
275impl std::fmt::Debug for ListPaymentMethod {
276    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
277        f.debug_struct("ListPaymentMethod").finish_non_exhaustive()
278    }
279}
280impl ListPaymentMethod {
281    /// Construct a new `ListPaymentMethod`.
282    pub fn new() -> Self {
283        Self { inner: ListPaymentMethodBuilder::new() }
284    }
285    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
286    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
287    pub fn allow_redisplay(
288        mut self,
289        allow_redisplay: impl Into<stripe_shared::PaymentMethodAllowRedisplay>,
290    ) -> Self {
291        self.inner.allow_redisplay = Some(allow_redisplay.into());
292        self
293    }
294    /// The ID of the customer whose PaymentMethods will be retrieved.
295    pub fn customer(mut self, customer: impl Into<String>) -> Self {
296        self.inner.customer = Some(customer.into());
297        self
298    }
299    /// The ID of the Account whose PaymentMethods will be retrieved.
300    pub fn customer_account(mut self, customer_account: impl Into<String>) -> Self {
301        self.inner.customer_account = Some(customer_account.into());
302        self
303    }
304    /// A cursor for use in pagination.
305    /// `ending_before` is an object ID that defines your place in the list.
306    /// 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.
307    pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
308        self.inner.ending_before = Some(ending_before.into());
309        self
310    }
311    /// Specifies which fields in the response should be expanded.
312    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
313        self.inner.expand = Some(expand.into());
314        self
315    }
316    /// A limit on the number of objects to be returned.
317    /// Limit can range between 1 and 100, and the default is 10.
318    pub fn limit(mut self, limit: impl Into<i64>) -> Self {
319        self.inner.limit = Some(limit.into());
320        self
321    }
322    /// A cursor for use in pagination.
323    /// `starting_after` is an object ID that defines your place in the list.
324    /// 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.
325    pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
326        self.inner.starting_after = Some(starting_after.into());
327        self
328    }
329    /// Filters the list by the object `type` field.
330    /// Unfiltered, the list returns all payment method types except `custom`.
331    /// If your integration expects only one type of payment method in the response, specify that type value in the request to reduce your payload.
332    pub fn type_(mut self, type_: impl Into<ListPaymentMethodType>) -> Self {
333        self.inner.type_ = Some(type_.into());
334        self
335    }
336}
337impl Default for ListPaymentMethod {
338    fn default() -> Self {
339        Self::new()
340    }
341}
342impl ListPaymentMethod {
343    /// Send the request and return the deserialized response.
344    pub async fn send<C: StripeClient>(
345        &self,
346        client: &C,
347    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
348        self.customize().send(client).await
349    }
350
351    /// Send the request and return the deserialized response, blocking until completion.
352    pub fn send_blocking<C: StripeBlockingClient>(
353        &self,
354        client: &C,
355    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
356        self.customize().send_blocking(client)
357    }
358
359    pub fn paginate(
360        &self,
361    ) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::PaymentMethod>> {
362        stripe_client_core::ListPaginator::new_list("/payment_methods", &self.inner)
363    }
364}
365
366impl StripeRequest for ListPaymentMethod {
367    type Output = stripe_types::List<stripe_shared::PaymentMethod>;
368
369    fn build(&self) -> RequestBuilder {
370        RequestBuilder::new(StripeMethod::Get, "/payment_methods").query(&self.inner)
371    }
372}
373#[derive(Clone, Eq, PartialEq)]
374#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
375#[derive(serde::Serialize)]
376struct RetrievePaymentMethodBuilder {
377    #[serde(skip_serializing_if = "Option::is_none")]
378    expand: Option<Vec<String>>,
379}
380#[cfg(feature = "redact-generated-debug")]
381impl std::fmt::Debug for RetrievePaymentMethodBuilder {
382    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
383        f.debug_struct("RetrievePaymentMethodBuilder").finish_non_exhaustive()
384    }
385}
386impl RetrievePaymentMethodBuilder {
387    fn new() -> Self {
388        Self { expand: None }
389    }
390}
391/// Retrieves a PaymentMethod object attached to the StripeAccount.
392/// To retrieve a payment method attached to a Customer, you should use [Retrieve a Customer’s PaymentMethods](https://stripe.com/docs/api/payment_methods/customer).
393#[derive(Clone)]
394#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
395#[derive(serde::Serialize)]
396pub struct RetrievePaymentMethod {
397    inner: RetrievePaymentMethodBuilder,
398    payment_method: stripe_shared::PaymentMethodId,
399}
400#[cfg(feature = "redact-generated-debug")]
401impl std::fmt::Debug for RetrievePaymentMethod {
402    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
403        f.debug_struct("RetrievePaymentMethod").finish_non_exhaustive()
404    }
405}
406impl RetrievePaymentMethod {
407    /// Construct a new `RetrievePaymentMethod`.
408    pub fn new(payment_method: impl Into<stripe_shared::PaymentMethodId>) -> Self {
409        Self { payment_method: payment_method.into(), inner: RetrievePaymentMethodBuilder::new() }
410    }
411    /// Specifies which fields in the response should be expanded.
412    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
413        self.inner.expand = Some(expand.into());
414        self
415    }
416}
417impl RetrievePaymentMethod {
418    /// Send the request and return the deserialized response.
419    pub async fn send<C: StripeClient>(
420        &self,
421        client: &C,
422    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
423        self.customize().send(client).await
424    }
425
426    /// Send the request and return the deserialized response, blocking until completion.
427    pub fn send_blocking<C: StripeBlockingClient>(
428        &self,
429        client: &C,
430    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
431        self.customize().send_blocking(client)
432    }
433}
434
435impl StripeRequest for RetrievePaymentMethod {
436    type Output = stripe_shared::PaymentMethod;
437
438    fn build(&self) -> RequestBuilder {
439        let payment_method = &self.payment_method;
440        RequestBuilder::new(StripeMethod::Get, format!("/payment_methods/{payment_method}"))
441            .query(&self.inner)
442    }
443}
444#[derive(Clone)]
445#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
446#[derive(serde::Serialize)]
447struct CreatePaymentMethodBuilder {
448    #[serde(skip_serializing_if = "Option::is_none")]
449    acss_debit: Option<CreatePaymentMethodAcssDebit>,
450    #[serde(skip_serializing_if = "Option::is_none")]
451    #[serde(with = "stripe_types::with_serde_json_opt")]
452    affirm: Option<miniserde::json::Value>,
453    #[serde(skip_serializing_if = "Option::is_none")]
454    #[serde(with = "stripe_types::with_serde_json_opt")]
455    afterpay_clearpay: Option<miniserde::json::Value>,
456    #[serde(skip_serializing_if = "Option::is_none")]
457    #[serde(with = "stripe_types::with_serde_json_opt")]
458    alipay: Option<miniserde::json::Value>,
459    #[serde(skip_serializing_if = "Option::is_none")]
460    allow_redisplay: Option<stripe_shared::PaymentMethodAllowRedisplay>,
461    #[serde(skip_serializing_if = "Option::is_none")]
462    #[serde(with = "stripe_types::with_serde_json_opt")]
463    alma: Option<miniserde::json::Value>,
464    #[serde(skip_serializing_if = "Option::is_none")]
465    #[serde(with = "stripe_types::with_serde_json_opt")]
466    amazon_pay: Option<miniserde::json::Value>,
467    #[serde(skip_serializing_if = "Option::is_none")]
468    au_becs_debit: Option<CreatePaymentMethodAuBecsDebit>,
469    #[serde(skip_serializing_if = "Option::is_none")]
470    bacs_debit: Option<CreatePaymentMethodBacsDebit>,
471    #[serde(skip_serializing_if = "Option::is_none")]
472    #[serde(with = "stripe_types::with_serde_json_opt")]
473    bancontact: Option<miniserde::json::Value>,
474    #[serde(skip_serializing_if = "Option::is_none")]
475    #[serde(with = "stripe_types::with_serde_json_opt")]
476    billie: Option<miniserde::json::Value>,
477    #[serde(skip_serializing_if = "Option::is_none")]
478    billing_details: Option<BillingDetailsInnerParams>,
479    #[serde(skip_serializing_if = "Option::is_none")]
480    #[serde(with = "stripe_types::with_serde_json_opt")]
481    blik: Option<miniserde::json::Value>,
482    #[serde(skip_serializing_if = "Option::is_none")]
483    boleto: Option<CreatePaymentMethodBoleto>,
484    #[serde(skip_serializing_if = "Option::is_none")]
485    card: Option<CreatePaymentMethodCard>,
486    #[serde(skip_serializing_if = "Option::is_none")]
487    #[serde(with = "stripe_types::with_serde_json_opt")]
488    cashapp: Option<miniserde::json::Value>,
489    #[serde(skip_serializing_if = "Option::is_none")]
490    #[serde(with = "stripe_types::with_serde_json_opt")]
491    crypto: Option<miniserde::json::Value>,
492    #[serde(skip_serializing_if = "Option::is_none")]
493    custom: Option<CreatePaymentMethodCustom>,
494    #[serde(skip_serializing_if = "Option::is_none")]
495    customer: Option<String>,
496    #[serde(skip_serializing_if = "Option::is_none")]
497    #[serde(with = "stripe_types::with_serde_json_opt")]
498    customer_balance: Option<miniserde::json::Value>,
499    #[serde(skip_serializing_if = "Option::is_none")]
500    eps: Option<CreatePaymentMethodEps>,
501    #[serde(skip_serializing_if = "Option::is_none")]
502    expand: Option<Vec<String>>,
503    #[serde(skip_serializing_if = "Option::is_none")]
504    fpx: Option<CreatePaymentMethodFpx>,
505    #[serde(skip_serializing_if = "Option::is_none")]
506    #[serde(with = "stripe_types::with_serde_json_opt")]
507    giropay: Option<miniserde::json::Value>,
508    #[serde(skip_serializing_if = "Option::is_none")]
509    #[serde(with = "stripe_types::with_serde_json_opt")]
510    grabpay: Option<miniserde::json::Value>,
511    #[serde(skip_serializing_if = "Option::is_none")]
512    ideal: Option<CreatePaymentMethodIdeal>,
513    #[serde(skip_serializing_if = "Option::is_none")]
514    #[serde(with = "stripe_types::with_serde_json_opt")]
515    interac_present: Option<miniserde::json::Value>,
516    #[serde(skip_serializing_if = "Option::is_none")]
517    #[serde(with = "stripe_types::with_serde_json_opt")]
518    kakao_pay: Option<miniserde::json::Value>,
519    #[serde(skip_serializing_if = "Option::is_none")]
520    klarna: Option<CreatePaymentMethodKlarna>,
521    #[serde(skip_serializing_if = "Option::is_none")]
522    #[serde(with = "stripe_types::with_serde_json_opt")]
523    konbini: Option<miniserde::json::Value>,
524    #[serde(skip_serializing_if = "Option::is_none")]
525    #[serde(with = "stripe_types::with_serde_json_opt")]
526    kr_card: Option<miniserde::json::Value>,
527    #[serde(skip_serializing_if = "Option::is_none")]
528    #[serde(with = "stripe_types::with_serde_json_opt")]
529    link: Option<miniserde::json::Value>,
530    #[serde(skip_serializing_if = "Option::is_none")]
531    #[serde(with = "stripe_types::with_serde_json_opt")]
532    mb_way: Option<miniserde::json::Value>,
533    #[serde(skip_serializing_if = "Option::is_none")]
534    metadata: Option<std::collections::HashMap<String, String>>,
535    #[serde(skip_serializing_if = "Option::is_none")]
536    #[serde(with = "stripe_types::with_serde_json_opt")]
537    mobilepay: Option<miniserde::json::Value>,
538    #[serde(skip_serializing_if = "Option::is_none")]
539    #[serde(with = "stripe_types::with_serde_json_opt")]
540    multibanco: Option<miniserde::json::Value>,
541    #[serde(skip_serializing_if = "Option::is_none")]
542    naver_pay: Option<CreatePaymentMethodNaverPay>,
543    #[serde(skip_serializing_if = "Option::is_none")]
544    nz_bank_account: Option<CreatePaymentMethodNzBankAccount>,
545    #[serde(skip_serializing_if = "Option::is_none")]
546    #[serde(with = "stripe_types::with_serde_json_opt")]
547    oxxo: Option<miniserde::json::Value>,
548    #[serde(skip_serializing_if = "Option::is_none")]
549    p24: Option<CreatePaymentMethodP24>,
550    #[serde(skip_serializing_if = "Option::is_none")]
551    #[serde(with = "stripe_types::with_serde_json_opt")]
552    pay_by_bank: Option<miniserde::json::Value>,
553    #[serde(skip_serializing_if = "Option::is_none")]
554    #[serde(with = "stripe_types::with_serde_json_opt")]
555    payco: Option<miniserde::json::Value>,
556    #[serde(skip_serializing_if = "Option::is_none")]
557    payment_method: Option<String>,
558    #[serde(skip_serializing_if = "Option::is_none")]
559    #[serde(with = "stripe_types::with_serde_json_opt")]
560    paynow: Option<miniserde::json::Value>,
561    #[serde(skip_serializing_if = "Option::is_none")]
562    #[serde(with = "stripe_types::with_serde_json_opt")]
563    paypal: Option<miniserde::json::Value>,
564    #[serde(skip_serializing_if = "Option::is_none")]
565    payto: Option<CreatePaymentMethodPayto>,
566    #[serde(skip_serializing_if = "Option::is_none")]
567    #[serde(with = "stripe_types::with_serde_json_opt")]
568    pix: Option<miniserde::json::Value>,
569    #[serde(skip_serializing_if = "Option::is_none")]
570    #[serde(with = "stripe_types::with_serde_json_opt")]
571    promptpay: Option<miniserde::json::Value>,
572    #[serde(skip_serializing_if = "Option::is_none")]
573    radar_options: Option<CreatePaymentMethodRadarOptions>,
574    #[serde(skip_serializing_if = "Option::is_none")]
575    #[serde(with = "stripe_types::with_serde_json_opt")]
576    revolut_pay: Option<miniserde::json::Value>,
577    #[serde(skip_serializing_if = "Option::is_none")]
578    #[serde(with = "stripe_types::with_serde_json_opt")]
579    samsung_pay: Option<miniserde::json::Value>,
580    #[serde(skip_serializing_if = "Option::is_none")]
581    #[serde(with = "stripe_types::with_serde_json_opt")]
582    satispay: Option<miniserde::json::Value>,
583    #[serde(skip_serializing_if = "Option::is_none")]
584    sepa_debit: Option<CreatePaymentMethodSepaDebit>,
585    #[serde(skip_serializing_if = "Option::is_none")]
586    sofort: Option<CreatePaymentMethodSofort>,
587    #[serde(skip_serializing_if = "Option::is_none")]
588    #[serde(with = "stripe_types::with_serde_json_opt")]
589    swish: Option<miniserde::json::Value>,
590    #[serde(skip_serializing_if = "Option::is_none")]
591    #[serde(with = "stripe_types::with_serde_json_opt")]
592    twint: Option<miniserde::json::Value>,
593    #[serde(rename = "type")]
594    #[serde(skip_serializing_if = "Option::is_none")]
595    type_: Option<CreatePaymentMethodType>,
596    #[serde(skip_serializing_if = "Option::is_none")]
597    upi: Option<CreatePaymentMethodUpi>,
598    #[serde(skip_serializing_if = "Option::is_none")]
599    us_bank_account: Option<CreatePaymentMethodUsBankAccount>,
600    #[serde(skip_serializing_if = "Option::is_none")]
601    #[serde(with = "stripe_types::with_serde_json_opt")]
602    wechat_pay: Option<miniserde::json::Value>,
603    #[serde(skip_serializing_if = "Option::is_none")]
604    #[serde(with = "stripe_types::with_serde_json_opt")]
605    zip: Option<miniserde::json::Value>,
606}
607#[cfg(feature = "redact-generated-debug")]
608impl std::fmt::Debug for CreatePaymentMethodBuilder {
609    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
610        f.debug_struct("CreatePaymentMethodBuilder").finish_non_exhaustive()
611    }
612}
613impl CreatePaymentMethodBuilder {
614    fn new() -> Self {
615        Self {
616            acss_debit: None,
617            affirm: None,
618            afterpay_clearpay: None,
619            alipay: None,
620            allow_redisplay: None,
621            alma: None,
622            amazon_pay: None,
623            au_becs_debit: None,
624            bacs_debit: None,
625            bancontact: None,
626            billie: None,
627            billing_details: None,
628            blik: None,
629            boleto: None,
630            card: None,
631            cashapp: None,
632            crypto: None,
633            custom: None,
634            customer: None,
635            customer_balance: None,
636            eps: None,
637            expand: None,
638            fpx: None,
639            giropay: None,
640            grabpay: None,
641            ideal: None,
642            interac_present: None,
643            kakao_pay: None,
644            klarna: None,
645            konbini: None,
646            kr_card: None,
647            link: None,
648            mb_way: None,
649            metadata: None,
650            mobilepay: None,
651            multibanco: None,
652            naver_pay: None,
653            nz_bank_account: None,
654            oxxo: None,
655            p24: None,
656            pay_by_bank: None,
657            payco: None,
658            payment_method: None,
659            paynow: None,
660            paypal: None,
661            payto: None,
662            pix: None,
663            promptpay: None,
664            radar_options: None,
665            revolut_pay: None,
666            samsung_pay: None,
667            satispay: None,
668            sepa_debit: None,
669            sofort: None,
670            swish: None,
671            twint: None,
672            type_: None,
673            upi: None,
674            us_bank_account: None,
675            wechat_pay: None,
676            zip: None,
677        }
678    }
679}
680/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
681#[derive(Clone, Eq, PartialEq)]
682#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
683#[derive(serde::Serialize)]
684pub struct CreatePaymentMethodAcssDebit {
685    /// Customer's bank account number.
686    pub account_number: String,
687    /// Institution number of the customer's bank.
688    pub institution_number: String,
689    /// Transit number of the customer's bank.
690    pub transit_number: String,
691}
692#[cfg(feature = "redact-generated-debug")]
693impl std::fmt::Debug for CreatePaymentMethodAcssDebit {
694    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
695        f.debug_struct("CreatePaymentMethodAcssDebit").finish_non_exhaustive()
696    }
697}
698impl CreatePaymentMethodAcssDebit {
699    pub fn new(
700        account_number: impl Into<String>,
701        institution_number: impl Into<String>,
702        transit_number: impl Into<String>,
703    ) -> Self {
704        Self {
705            account_number: account_number.into(),
706            institution_number: institution_number.into(),
707            transit_number: transit_number.into(),
708        }
709    }
710}
711/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
712#[derive(Clone, Eq, PartialEq)]
713#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
714#[derive(serde::Serialize)]
715pub struct CreatePaymentMethodAuBecsDebit {
716    /// The account number for the bank account.
717    pub account_number: String,
718    /// Bank-State-Branch number of the bank account.
719    pub bsb_number: String,
720}
721#[cfg(feature = "redact-generated-debug")]
722impl std::fmt::Debug for CreatePaymentMethodAuBecsDebit {
723    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
724        f.debug_struct("CreatePaymentMethodAuBecsDebit").finish_non_exhaustive()
725    }
726}
727impl CreatePaymentMethodAuBecsDebit {
728    pub fn new(account_number: impl Into<String>, bsb_number: impl Into<String>) -> Self {
729        Self { account_number: account_number.into(), bsb_number: bsb_number.into() }
730    }
731}
732/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
733#[derive(Clone, Eq, PartialEq)]
734#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
735#[derive(serde::Serialize)]
736pub struct CreatePaymentMethodBacsDebit {
737    /// Account number of the bank account that the funds will be debited from.
738    #[serde(skip_serializing_if = "Option::is_none")]
739    pub account_number: Option<String>,
740    /// Sort code of the bank account. (e.g., `10-20-30`)
741    #[serde(skip_serializing_if = "Option::is_none")]
742    pub sort_code: Option<String>,
743}
744#[cfg(feature = "redact-generated-debug")]
745impl std::fmt::Debug for CreatePaymentMethodBacsDebit {
746    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
747        f.debug_struct("CreatePaymentMethodBacsDebit").finish_non_exhaustive()
748    }
749}
750impl CreatePaymentMethodBacsDebit {
751    pub fn new() -> Self {
752        Self { account_number: None, sort_code: None }
753    }
754}
755impl Default for CreatePaymentMethodBacsDebit {
756    fn default() -> Self {
757        Self::new()
758    }
759}
760/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
761#[derive(Clone, Eq, PartialEq)]
762#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
763#[derive(serde::Serialize)]
764pub struct CreatePaymentMethodBoleto {
765    /// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
766    pub tax_id: String,
767}
768#[cfg(feature = "redact-generated-debug")]
769impl std::fmt::Debug for CreatePaymentMethodBoleto {
770    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
771        f.debug_struct("CreatePaymentMethodBoleto").finish_non_exhaustive()
772    }
773}
774impl CreatePaymentMethodBoleto {
775    pub fn new(tax_id: impl Into<String>) -> Self {
776        Self { tax_id: tax_id.into() }
777    }
778}
779/// If this is a `card` PaymentMethod, this hash contains the user's card details.
780/// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`.
781/// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance).
782/// We strongly recommend using Stripe.js instead of interacting with this API directly.
783#[derive(Clone, Eq, PartialEq)]
784#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
785#[derive(serde::Serialize)]
786#[serde(rename_all = "snake_case")]
787pub enum CreatePaymentMethodCard {
788    #[serde(untagged)]
789    CardDetailsParams(CreatePaymentMethodCardDetailsParams),
790    #[serde(untagged)]
791    TokenParams(CreatePaymentMethodTokenParams),
792}
793#[cfg(feature = "redact-generated-debug")]
794impl std::fmt::Debug for CreatePaymentMethodCard {
795    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
796        f.debug_struct("CreatePaymentMethodCard").finish_non_exhaustive()
797    }
798}
799/// If this is a `card` PaymentMethod, this hash contains the user's card details.
800/// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`.
801/// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance).
802/// We strongly recommend using Stripe.js instead of interacting with this API directly.
803#[derive(Clone, Eq, PartialEq)]
804#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
805#[derive(serde::Serialize)]
806pub struct CreatePaymentMethodCardDetailsParams {
807    /// The card's CVC. It is highly recommended to always include this value.
808    #[serde(skip_serializing_if = "Option::is_none")]
809    pub cvc: Option<String>,
810    /// Two-digit number representing the card's expiration month.
811    pub exp_month: i64,
812    /// Four-digit number representing the card's expiration year.
813    pub exp_year: i64,
814    /// Contains information about card networks used to process the payment.
815    #[serde(skip_serializing_if = "Option::is_none")]
816    pub networks: Option<CreatePaymentMethodCardDetailsParamsNetworks>,
817    /// The card number, as a string without any separators.
818    pub number: String,
819}
820#[cfg(feature = "redact-generated-debug")]
821impl std::fmt::Debug for CreatePaymentMethodCardDetailsParams {
822    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
823        f.debug_struct("CreatePaymentMethodCardDetailsParams").finish_non_exhaustive()
824    }
825}
826impl CreatePaymentMethodCardDetailsParams {
827    pub fn new(
828        exp_month: impl Into<i64>,
829        exp_year: impl Into<i64>,
830        number: impl Into<String>,
831    ) -> Self {
832        Self {
833            cvc: None,
834            exp_month: exp_month.into(),
835            exp_year: exp_year.into(),
836            networks: None,
837            number: number.into(),
838        }
839    }
840}
841/// Contains information about card networks used to process the payment.
842#[derive(Clone, Eq, PartialEq)]
843#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
844#[derive(serde::Serialize)]
845pub struct CreatePaymentMethodCardDetailsParamsNetworks {
846    /// The customer's preferred card network for co-branded cards.
847    /// Supports `cartes_bancaires`, `mastercard`, or `visa`.
848    /// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
849    #[serde(skip_serializing_if = "Option::is_none")]
850    pub preferred: Option<CreatePaymentMethodCardDetailsParamsNetworksPreferred>,
851}
852#[cfg(feature = "redact-generated-debug")]
853impl std::fmt::Debug for CreatePaymentMethodCardDetailsParamsNetworks {
854    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
855        f.debug_struct("CreatePaymentMethodCardDetailsParamsNetworks").finish_non_exhaustive()
856    }
857}
858impl CreatePaymentMethodCardDetailsParamsNetworks {
859    pub fn new() -> Self {
860        Self { preferred: None }
861    }
862}
863impl Default for CreatePaymentMethodCardDetailsParamsNetworks {
864    fn default() -> Self {
865        Self::new()
866    }
867}
868/// The customer's preferred card network for co-branded cards.
869/// Supports `cartes_bancaires`, `mastercard`, or `visa`.
870/// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
871#[derive(Clone, Eq, PartialEq)]
872#[non_exhaustive]
873pub enum CreatePaymentMethodCardDetailsParamsNetworksPreferred {
874    CartesBancaires,
875    Mastercard,
876    Visa,
877    /// An unrecognized value from Stripe. Should not be used as a request parameter.
878    Unknown(String),
879}
880impl CreatePaymentMethodCardDetailsParamsNetworksPreferred {
881    pub fn as_str(&self) -> &str {
882        use CreatePaymentMethodCardDetailsParamsNetworksPreferred::*;
883        match self {
884            CartesBancaires => "cartes_bancaires",
885            Mastercard => "mastercard",
886            Visa => "visa",
887            Unknown(v) => v,
888        }
889    }
890}
891
892impl std::str::FromStr for CreatePaymentMethodCardDetailsParamsNetworksPreferred {
893    type Err = std::convert::Infallible;
894    fn from_str(s: &str) -> Result<Self, Self::Err> {
895        use CreatePaymentMethodCardDetailsParamsNetworksPreferred::*;
896        match s {
897            "cartes_bancaires" => Ok(CartesBancaires),
898            "mastercard" => Ok(Mastercard),
899            "visa" => Ok(Visa),
900            v => {
901                tracing::warn!(
902                    "Unknown value '{}' for enum '{}'",
903                    v,
904                    "CreatePaymentMethodCardDetailsParamsNetworksPreferred"
905                );
906                Ok(Unknown(v.to_owned()))
907            }
908        }
909    }
910}
911impl std::fmt::Display for CreatePaymentMethodCardDetailsParamsNetworksPreferred {
912    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
913        f.write_str(self.as_str())
914    }
915}
916
917#[cfg(not(feature = "redact-generated-debug"))]
918impl std::fmt::Debug for CreatePaymentMethodCardDetailsParamsNetworksPreferred {
919    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
920        f.write_str(self.as_str())
921    }
922}
923#[cfg(feature = "redact-generated-debug")]
924impl std::fmt::Debug for CreatePaymentMethodCardDetailsParamsNetworksPreferred {
925    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
926        f.debug_struct(stringify!(CreatePaymentMethodCardDetailsParamsNetworksPreferred))
927            .finish_non_exhaustive()
928    }
929}
930impl serde::Serialize for CreatePaymentMethodCardDetailsParamsNetworksPreferred {
931    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
932    where
933        S: serde::Serializer,
934    {
935        serializer.serialize_str(self.as_str())
936    }
937}
938#[cfg(feature = "deserialize")]
939impl<'de> serde::Deserialize<'de> for CreatePaymentMethodCardDetailsParamsNetworksPreferred {
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        Ok(Self::from_str(&s).expect("infallible"))
944    }
945}
946/// If this is a `card` PaymentMethod, this hash contains the user's card details.
947/// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`.
948/// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance).
949/// We strongly recommend using Stripe.js instead of interacting with this API directly.
950#[derive(Clone, Eq, PartialEq)]
951#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
952#[derive(serde::Serialize)]
953pub struct CreatePaymentMethodTokenParams {
954    /// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format card: {token: "tok_visa"}.
955    pub token: String,
956}
957#[cfg(feature = "redact-generated-debug")]
958impl std::fmt::Debug for CreatePaymentMethodTokenParams {
959    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
960        f.debug_struct("CreatePaymentMethodTokenParams").finish_non_exhaustive()
961    }
962}
963impl CreatePaymentMethodTokenParams {
964    pub fn new(token: impl Into<String>) -> Self {
965        Self { token: token.into() }
966    }
967}
968/// If this is a `custom` PaymentMethod, this hash contains details about the Custom payment method.
969#[derive(Clone, Eq, PartialEq)]
970#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
971#[derive(serde::Serialize)]
972pub struct CreatePaymentMethodCustom {
973    /// ID of the Dashboard-only CustomPaymentMethodType.
974    /// This field is used by Stripe products' internal code to support CPMs.
975    #[serde(rename = "type")]
976    pub type_: String,
977}
978#[cfg(feature = "redact-generated-debug")]
979impl std::fmt::Debug for CreatePaymentMethodCustom {
980    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
981        f.debug_struct("CreatePaymentMethodCustom").finish_non_exhaustive()
982    }
983}
984impl CreatePaymentMethodCustom {
985    pub fn new(type_: impl Into<String>) -> Self {
986        Self { type_: type_.into() }
987    }
988}
989/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
990#[derive(Clone, Eq, PartialEq)]
991#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
992#[derive(serde::Serialize)]
993pub struct CreatePaymentMethodEps {
994    /// The customer's bank.
995    #[serde(skip_serializing_if = "Option::is_none")]
996    pub bank: Option<CreatePaymentMethodEpsBank>,
997}
998#[cfg(feature = "redact-generated-debug")]
999impl std::fmt::Debug for CreatePaymentMethodEps {
1000    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1001        f.debug_struct("CreatePaymentMethodEps").finish_non_exhaustive()
1002    }
1003}
1004impl CreatePaymentMethodEps {
1005    pub fn new() -> Self {
1006        Self { bank: None }
1007    }
1008}
1009impl Default for CreatePaymentMethodEps {
1010    fn default() -> Self {
1011        Self::new()
1012    }
1013}
1014/// The customer's bank.
1015#[derive(Clone, Eq, PartialEq)]
1016#[non_exhaustive]
1017pub enum CreatePaymentMethodEpsBank {
1018    ArzteUndApothekerBank,
1019    AustrianAnadiBankAg,
1020    BankAustria,
1021    BankhausCarlSpangler,
1022    BankhausSchelhammerUndSchatteraAg,
1023    BawagPskAg,
1024    BksBankAg,
1025    BrullKallmusBankAg,
1026    BtvVierLanderBank,
1027    CapitalBankGraweGruppeAg,
1028    DeutscheBankAg,
1029    Dolomitenbank,
1030    EasybankAg,
1031    ErsteBankUndSparkassen,
1032    HypoAlpeadriabankInternationalAg,
1033    HypoBankBurgenlandAktiengesellschaft,
1034    HypoNoeLbFurNiederosterreichUWien,
1035    HypoOberosterreichSalzburgSteiermark,
1036    HypoTirolBankAg,
1037    HypoVorarlbergBankAg,
1038    MarchfelderBank,
1039    OberbankAg,
1040    RaiffeisenBankengruppeOsterreich,
1041    SchoellerbankAg,
1042    SpardaBankWien,
1043    VolksbankGruppe,
1044    VolkskreditbankAg,
1045    VrBankBraunau,
1046    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1047    Unknown(String),
1048}
1049impl CreatePaymentMethodEpsBank {
1050    pub fn as_str(&self) -> &str {
1051        use CreatePaymentMethodEpsBank::*;
1052        match self {
1053            ArzteUndApothekerBank => "arzte_und_apotheker_bank",
1054            AustrianAnadiBankAg => "austrian_anadi_bank_ag",
1055            BankAustria => "bank_austria",
1056            BankhausCarlSpangler => "bankhaus_carl_spangler",
1057            BankhausSchelhammerUndSchatteraAg => "bankhaus_schelhammer_und_schattera_ag",
1058            BawagPskAg => "bawag_psk_ag",
1059            BksBankAg => "bks_bank_ag",
1060            BrullKallmusBankAg => "brull_kallmus_bank_ag",
1061            BtvVierLanderBank => "btv_vier_lander_bank",
1062            CapitalBankGraweGruppeAg => "capital_bank_grawe_gruppe_ag",
1063            DeutscheBankAg => "deutsche_bank_ag",
1064            Dolomitenbank => "dolomitenbank",
1065            EasybankAg => "easybank_ag",
1066            ErsteBankUndSparkassen => "erste_bank_und_sparkassen",
1067            HypoAlpeadriabankInternationalAg => "hypo_alpeadriabank_international_ag",
1068            HypoBankBurgenlandAktiengesellschaft => "hypo_bank_burgenland_aktiengesellschaft",
1069            HypoNoeLbFurNiederosterreichUWien => "hypo_noe_lb_fur_niederosterreich_u_wien",
1070            HypoOberosterreichSalzburgSteiermark => "hypo_oberosterreich_salzburg_steiermark",
1071            HypoTirolBankAg => "hypo_tirol_bank_ag",
1072            HypoVorarlbergBankAg => "hypo_vorarlberg_bank_ag",
1073            MarchfelderBank => "marchfelder_bank",
1074            OberbankAg => "oberbank_ag",
1075            RaiffeisenBankengruppeOsterreich => "raiffeisen_bankengruppe_osterreich",
1076            SchoellerbankAg => "schoellerbank_ag",
1077            SpardaBankWien => "sparda_bank_wien",
1078            VolksbankGruppe => "volksbank_gruppe",
1079            VolkskreditbankAg => "volkskreditbank_ag",
1080            VrBankBraunau => "vr_bank_braunau",
1081            Unknown(v) => v,
1082        }
1083    }
1084}
1085
1086impl std::str::FromStr for CreatePaymentMethodEpsBank {
1087    type Err = std::convert::Infallible;
1088    fn from_str(s: &str) -> Result<Self, Self::Err> {
1089        use CreatePaymentMethodEpsBank::*;
1090        match s {
1091            "arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank),
1092            "austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg),
1093            "bank_austria" => Ok(BankAustria),
1094            "bankhaus_carl_spangler" => Ok(BankhausCarlSpangler),
1095            "bankhaus_schelhammer_und_schattera_ag" => Ok(BankhausSchelhammerUndSchatteraAg),
1096            "bawag_psk_ag" => Ok(BawagPskAg),
1097            "bks_bank_ag" => Ok(BksBankAg),
1098            "brull_kallmus_bank_ag" => Ok(BrullKallmusBankAg),
1099            "btv_vier_lander_bank" => Ok(BtvVierLanderBank),
1100            "capital_bank_grawe_gruppe_ag" => Ok(CapitalBankGraweGruppeAg),
1101            "deutsche_bank_ag" => Ok(DeutscheBankAg),
1102            "dolomitenbank" => Ok(Dolomitenbank),
1103            "easybank_ag" => Ok(EasybankAg),
1104            "erste_bank_und_sparkassen" => Ok(ErsteBankUndSparkassen),
1105            "hypo_alpeadriabank_international_ag" => Ok(HypoAlpeadriabankInternationalAg),
1106            "hypo_bank_burgenland_aktiengesellschaft" => Ok(HypoBankBurgenlandAktiengesellschaft),
1107            "hypo_noe_lb_fur_niederosterreich_u_wien" => Ok(HypoNoeLbFurNiederosterreichUWien),
1108            "hypo_oberosterreich_salzburg_steiermark" => Ok(HypoOberosterreichSalzburgSteiermark),
1109            "hypo_tirol_bank_ag" => Ok(HypoTirolBankAg),
1110            "hypo_vorarlberg_bank_ag" => Ok(HypoVorarlbergBankAg),
1111            "marchfelder_bank" => Ok(MarchfelderBank),
1112            "oberbank_ag" => Ok(OberbankAg),
1113            "raiffeisen_bankengruppe_osterreich" => Ok(RaiffeisenBankengruppeOsterreich),
1114            "schoellerbank_ag" => Ok(SchoellerbankAg),
1115            "sparda_bank_wien" => Ok(SpardaBankWien),
1116            "volksbank_gruppe" => Ok(VolksbankGruppe),
1117            "volkskreditbank_ag" => Ok(VolkskreditbankAg),
1118            "vr_bank_braunau" => Ok(VrBankBraunau),
1119            v => {
1120                tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreatePaymentMethodEpsBank");
1121                Ok(Unknown(v.to_owned()))
1122            }
1123        }
1124    }
1125}
1126impl std::fmt::Display for CreatePaymentMethodEpsBank {
1127    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1128        f.write_str(self.as_str())
1129    }
1130}
1131
1132#[cfg(not(feature = "redact-generated-debug"))]
1133impl std::fmt::Debug for CreatePaymentMethodEpsBank {
1134    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1135        f.write_str(self.as_str())
1136    }
1137}
1138#[cfg(feature = "redact-generated-debug")]
1139impl std::fmt::Debug for CreatePaymentMethodEpsBank {
1140    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1141        f.debug_struct(stringify!(CreatePaymentMethodEpsBank)).finish_non_exhaustive()
1142    }
1143}
1144impl serde::Serialize for CreatePaymentMethodEpsBank {
1145    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1146    where
1147        S: serde::Serializer,
1148    {
1149        serializer.serialize_str(self.as_str())
1150    }
1151}
1152#[cfg(feature = "deserialize")]
1153impl<'de> serde::Deserialize<'de> for CreatePaymentMethodEpsBank {
1154    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1155        use std::str::FromStr;
1156        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1157        Ok(Self::from_str(&s).expect("infallible"))
1158    }
1159}
1160/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
1161#[derive(Clone, Eq, PartialEq)]
1162#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1163#[derive(serde::Serialize)]
1164pub struct CreatePaymentMethodFpx {
1165    /// Account holder type for FPX transaction
1166    #[serde(skip_serializing_if = "Option::is_none")]
1167    pub account_holder_type: Option<CreatePaymentMethodFpxAccountHolderType>,
1168    /// The customer's bank.
1169    pub bank: CreatePaymentMethodFpxBank,
1170}
1171#[cfg(feature = "redact-generated-debug")]
1172impl std::fmt::Debug for CreatePaymentMethodFpx {
1173    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1174        f.debug_struct("CreatePaymentMethodFpx").finish_non_exhaustive()
1175    }
1176}
1177impl CreatePaymentMethodFpx {
1178    pub fn new(bank: impl Into<CreatePaymentMethodFpxBank>) -> Self {
1179        Self { account_holder_type: None, bank: bank.into() }
1180    }
1181}
1182/// Account holder type for FPX transaction
1183#[derive(Clone, Eq, PartialEq)]
1184#[non_exhaustive]
1185pub enum CreatePaymentMethodFpxAccountHolderType {
1186    Company,
1187    Individual,
1188    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1189    Unknown(String),
1190}
1191impl CreatePaymentMethodFpxAccountHolderType {
1192    pub fn as_str(&self) -> &str {
1193        use CreatePaymentMethodFpxAccountHolderType::*;
1194        match self {
1195            Company => "company",
1196            Individual => "individual",
1197            Unknown(v) => v,
1198        }
1199    }
1200}
1201
1202impl std::str::FromStr for CreatePaymentMethodFpxAccountHolderType {
1203    type Err = std::convert::Infallible;
1204    fn from_str(s: &str) -> Result<Self, Self::Err> {
1205        use CreatePaymentMethodFpxAccountHolderType::*;
1206        match s {
1207            "company" => Ok(Company),
1208            "individual" => Ok(Individual),
1209            v => {
1210                tracing::warn!(
1211                    "Unknown value '{}' for enum '{}'",
1212                    v,
1213                    "CreatePaymentMethodFpxAccountHolderType"
1214                );
1215                Ok(Unknown(v.to_owned()))
1216            }
1217        }
1218    }
1219}
1220impl std::fmt::Display for CreatePaymentMethodFpxAccountHolderType {
1221    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1222        f.write_str(self.as_str())
1223    }
1224}
1225
1226#[cfg(not(feature = "redact-generated-debug"))]
1227impl std::fmt::Debug for CreatePaymentMethodFpxAccountHolderType {
1228    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1229        f.write_str(self.as_str())
1230    }
1231}
1232#[cfg(feature = "redact-generated-debug")]
1233impl std::fmt::Debug for CreatePaymentMethodFpxAccountHolderType {
1234    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1235        f.debug_struct(stringify!(CreatePaymentMethodFpxAccountHolderType)).finish_non_exhaustive()
1236    }
1237}
1238impl serde::Serialize for CreatePaymentMethodFpxAccountHolderType {
1239    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1240    where
1241        S: serde::Serializer,
1242    {
1243        serializer.serialize_str(self.as_str())
1244    }
1245}
1246#[cfg(feature = "deserialize")]
1247impl<'de> serde::Deserialize<'de> for CreatePaymentMethodFpxAccountHolderType {
1248    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1249        use std::str::FromStr;
1250        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1251        Ok(Self::from_str(&s).expect("infallible"))
1252    }
1253}
1254/// The customer's bank.
1255#[derive(Clone, Eq, PartialEq)]
1256#[non_exhaustive]
1257pub enum CreatePaymentMethodFpxBank {
1258    AffinBank,
1259    Agrobank,
1260    AllianceBank,
1261    Ambank,
1262    BankIslam,
1263    BankMuamalat,
1264    BankOfChina,
1265    BankRakyat,
1266    Bsn,
1267    Cimb,
1268    DeutscheBank,
1269    HongLeongBank,
1270    Hsbc,
1271    Kfh,
1272    Maybank2e,
1273    Maybank2u,
1274    Ocbc,
1275    PbEnterprise,
1276    PublicBank,
1277    Rhb,
1278    StandardChartered,
1279    Uob,
1280    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1281    Unknown(String),
1282}
1283impl CreatePaymentMethodFpxBank {
1284    pub fn as_str(&self) -> &str {
1285        use CreatePaymentMethodFpxBank::*;
1286        match self {
1287            AffinBank => "affin_bank",
1288            Agrobank => "agrobank",
1289            AllianceBank => "alliance_bank",
1290            Ambank => "ambank",
1291            BankIslam => "bank_islam",
1292            BankMuamalat => "bank_muamalat",
1293            BankOfChina => "bank_of_china",
1294            BankRakyat => "bank_rakyat",
1295            Bsn => "bsn",
1296            Cimb => "cimb",
1297            DeutscheBank => "deutsche_bank",
1298            HongLeongBank => "hong_leong_bank",
1299            Hsbc => "hsbc",
1300            Kfh => "kfh",
1301            Maybank2e => "maybank2e",
1302            Maybank2u => "maybank2u",
1303            Ocbc => "ocbc",
1304            PbEnterprise => "pb_enterprise",
1305            PublicBank => "public_bank",
1306            Rhb => "rhb",
1307            StandardChartered => "standard_chartered",
1308            Uob => "uob",
1309            Unknown(v) => v,
1310        }
1311    }
1312}
1313
1314impl std::str::FromStr for CreatePaymentMethodFpxBank {
1315    type Err = std::convert::Infallible;
1316    fn from_str(s: &str) -> Result<Self, Self::Err> {
1317        use CreatePaymentMethodFpxBank::*;
1318        match s {
1319            "affin_bank" => Ok(AffinBank),
1320            "agrobank" => Ok(Agrobank),
1321            "alliance_bank" => Ok(AllianceBank),
1322            "ambank" => Ok(Ambank),
1323            "bank_islam" => Ok(BankIslam),
1324            "bank_muamalat" => Ok(BankMuamalat),
1325            "bank_of_china" => Ok(BankOfChina),
1326            "bank_rakyat" => Ok(BankRakyat),
1327            "bsn" => Ok(Bsn),
1328            "cimb" => Ok(Cimb),
1329            "deutsche_bank" => Ok(DeutscheBank),
1330            "hong_leong_bank" => Ok(HongLeongBank),
1331            "hsbc" => Ok(Hsbc),
1332            "kfh" => Ok(Kfh),
1333            "maybank2e" => Ok(Maybank2e),
1334            "maybank2u" => Ok(Maybank2u),
1335            "ocbc" => Ok(Ocbc),
1336            "pb_enterprise" => Ok(PbEnterprise),
1337            "public_bank" => Ok(PublicBank),
1338            "rhb" => Ok(Rhb),
1339            "standard_chartered" => Ok(StandardChartered),
1340            "uob" => Ok(Uob),
1341            v => {
1342                tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreatePaymentMethodFpxBank");
1343                Ok(Unknown(v.to_owned()))
1344            }
1345        }
1346    }
1347}
1348impl std::fmt::Display for CreatePaymentMethodFpxBank {
1349    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1350        f.write_str(self.as_str())
1351    }
1352}
1353
1354#[cfg(not(feature = "redact-generated-debug"))]
1355impl std::fmt::Debug for CreatePaymentMethodFpxBank {
1356    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1357        f.write_str(self.as_str())
1358    }
1359}
1360#[cfg(feature = "redact-generated-debug")]
1361impl std::fmt::Debug for CreatePaymentMethodFpxBank {
1362    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1363        f.debug_struct(stringify!(CreatePaymentMethodFpxBank)).finish_non_exhaustive()
1364    }
1365}
1366impl serde::Serialize for CreatePaymentMethodFpxBank {
1367    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1368    where
1369        S: serde::Serializer,
1370    {
1371        serializer.serialize_str(self.as_str())
1372    }
1373}
1374#[cfg(feature = "deserialize")]
1375impl<'de> serde::Deserialize<'de> for CreatePaymentMethodFpxBank {
1376    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1377        use std::str::FromStr;
1378        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1379        Ok(Self::from_str(&s).expect("infallible"))
1380    }
1381}
1382/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
1383#[derive(Clone, Eq, PartialEq)]
1384#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1385#[derive(serde::Serialize)]
1386pub struct CreatePaymentMethodIdeal {
1387    /// The customer's bank.
1388    /// Only use this parameter for existing customers.
1389    /// Don't use it for new customers.
1390    #[serde(skip_serializing_if = "Option::is_none")]
1391    pub bank: Option<CreatePaymentMethodIdealBank>,
1392}
1393#[cfg(feature = "redact-generated-debug")]
1394impl std::fmt::Debug for CreatePaymentMethodIdeal {
1395    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1396        f.debug_struct("CreatePaymentMethodIdeal").finish_non_exhaustive()
1397    }
1398}
1399impl CreatePaymentMethodIdeal {
1400    pub fn new() -> Self {
1401        Self { bank: None }
1402    }
1403}
1404impl Default for CreatePaymentMethodIdeal {
1405    fn default() -> Self {
1406        Self::new()
1407    }
1408}
1409/// The customer's bank.
1410/// Only use this parameter for existing customers.
1411/// Don't use it for new customers.
1412#[derive(Clone, Eq, PartialEq)]
1413#[non_exhaustive]
1414pub enum CreatePaymentMethodIdealBank {
1415    AbnAmro,
1416    Adyen,
1417    AsnBank,
1418    Bunq,
1419    Buut,
1420    Finom,
1421    Handelsbanken,
1422    Ing,
1423    Knab,
1424    Mollie,
1425    Moneyou,
1426    N26,
1427    Nn,
1428    Rabobank,
1429    Regiobank,
1430    Revolut,
1431    SnsBank,
1432    TriodosBank,
1433    VanLanschot,
1434    Yoursafe,
1435    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1436    Unknown(String),
1437}
1438impl CreatePaymentMethodIdealBank {
1439    pub fn as_str(&self) -> &str {
1440        use CreatePaymentMethodIdealBank::*;
1441        match self {
1442            AbnAmro => "abn_amro",
1443            Adyen => "adyen",
1444            AsnBank => "asn_bank",
1445            Bunq => "bunq",
1446            Buut => "buut",
1447            Finom => "finom",
1448            Handelsbanken => "handelsbanken",
1449            Ing => "ing",
1450            Knab => "knab",
1451            Mollie => "mollie",
1452            Moneyou => "moneyou",
1453            N26 => "n26",
1454            Nn => "nn",
1455            Rabobank => "rabobank",
1456            Regiobank => "regiobank",
1457            Revolut => "revolut",
1458            SnsBank => "sns_bank",
1459            TriodosBank => "triodos_bank",
1460            VanLanschot => "van_lanschot",
1461            Yoursafe => "yoursafe",
1462            Unknown(v) => v,
1463        }
1464    }
1465}
1466
1467impl std::str::FromStr for CreatePaymentMethodIdealBank {
1468    type Err = std::convert::Infallible;
1469    fn from_str(s: &str) -> Result<Self, Self::Err> {
1470        use CreatePaymentMethodIdealBank::*;
1471        match s {
1472            "abn_amro" => Ok(AbnAmro),
1473            "adyen" => Ok(Adyen),
1474            "asn_bank" => Ok(AsnBank),
1475            "bunq" => Ok(Bunq),
1476            "buut" => Ok(Buut),
1477            "finom" => Ok(Finom),
1478            "handelsbanken" => Ok(Handelsbanken),
1479            "ing" => Ok(Ing),
1480            "knab" => Ok(Knab),
1481            "mollie" => Ok(Mollie),
1482            "moneyou" => Ok(Moneyou),
1483            "n26" => Ok(N26),
1484            "nn" => Ok(Nn),
1485            "rabobank" => Ok(Rabobank),
1486            "regiobank" => Ok(Regiobank),
1487            "revolut" => Ok(Revolut),
1488            "sns_bank" => Ok(SnsBank),
1489            "triodos_bank" => Ok(TriodosBank),
1490            "van_lanschot" => Ok(VanLanschot),
1491            "yoursafe" => Ok(Yoursafe),
1492            v => {
1493                tracing::warn!(
1494                    "Unknown value '{}' for enum '{}'",
1495                    v,
1496                    "CreatePaymentMethodIdealBank"
1497                );
1498                Ok(Unknown(v.to_owned()))
1499            }
1500        }
1501    }
1502}
1503impl std::fmt::Display for CreatePaymentMethodIdealBank {
1504    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1505        f.write_str(self.as_str())
1506    }
1507}
1508
1509#[cfg(not(feature = "redact-generated-debug"))]
1510impl std::fmt::Debug for CreatePaymentMethodIdealBank {
1511    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1512        f.write_str(self.as_str())
1513    }
1514}
1515#[cfg(feature = "redact-generated-debug")]
1516impl std::fmt::Debug for CreatePaymentMethodIdealBank {
1517    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1518        f.debug_struct(stringify!(CreatePaymentMethodIdealBank)).finish_non_exhaustive()
1519    }
1520}
1521impl serde::Serialize for CreatePaymentMethodIdealBank {
1522    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1523    where
1524        S: serde::Serializer,
1525    {
1526        serializer.serialize_str(self.as_str())
1527    }
1528}
1529#[cfg(feature = "deserialize")]
1530impl<'de> serde::Deserialize<'de> for CreatePaymentMethodIdealBank {
1531    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1532        use std::str::FromStr;
1533        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1534        Ok(Self::from_str(&s).expect("infallible"))
1535    }
1536}
1537/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
1538#[derive(Copy, Clone, Eq, PartialEq)]
1539#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1540#[derive(serde::Serialize)]
1541pub struct CreatePaymentMethodKlarna {
1542    /// Customer's date of birth
1543    #[serde(skip_serializing_if = "Option::is_none")]
1544    pub dob: Option<CreatePaymentMethodKlarnaDob>,
1545}
1546#[cfg(feature = "redact-generated-debug")]
1547impl std::fmt::Debug for CreatePaymentMethodKlarna {
1548    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1549        f.debug_struct("CreatePaymentMethodKlarna").finish_non_exhaustive()
1550    }
1551}
1552impl CreatePaymentMethodKlarna {
1553    pub fn new() -> Self {
1554        Self { dob: None }
1555    }
1556}
1557impl Default for CreatePaymentMethodKlarna {
1558    fn default() -> Self {
1559        Self::new()
1560    }
1561}
1562/// Customer's date of birth
1563#[derive(Copy, Clone, Eq, PartialEq)]
1564#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1565#[derive(serde::Serialize)]
1566pub struct CreatePaymentMethodKlarnaDob {
1567    /// The day of birth, between 1 and 31.
1568    pub day: i64,
1569    /// The month of birth, between 1 and 12.
1570    pub month: i64,
1571    /// The four-digit year of birth.
1572    pub year: i64,
1573}
1574#[cfg(feature = "redact-generated-debug")]
1575impl std::fmt::Debug for CreatePaymentMethodKlarnaDob {
1576    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1577        f.debug_struct("CreatePaymentMethodKlarnaDob").finish_non_exhaustive()
1578    }
1579}
1580impl CreatePaymentMethodKlarnaDob {
1581    pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
1582        Self { day: day.into(), month: month.into(), year: year.into() }
1583    }
1584}
1585/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
1586#[derive(Clone, Eq, PartialEq)]
1587#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1588#[derive(serde::Serialize)]
1589pub struct CreatePaymentMethodNaverPay {
1590    /// Whether to use Naver Pay points or a card to fund this transaction.
1591    /// If not provided, this defaults to `card`.
1592    #[serde(skip_serializing_if = "Option::is_none")]
1593    pub funding: Option<CreatePaymentMethodNaverPayFunding>,
1594}
1595#[cfg(feature = "redact-generated-debug")]
1596impl std::fmt::Debug for CreatePaymentMethodNaverPay {
1597    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1598        f.debug_struct("CreatePaymentMethodNaverPay").finish_non_exhaustive()
1599    }
1600}
1601impl CreatePaymentMethodNaverPay {
1602    pub fn new() -> Self {
1603        Self { funding: None }
1604    }
1605}
1606impl Default for CreatePaymentMethodNaverPay {
1607    fn default() -> Self {
1608        Self::new()
1609    }
1610}
1611/// Whether to use Naver Pay points or a card to fund this transaction.
1612/// If not provided, this defaults to `card`.
1613#[derive(Clone, Eq, PartialEq)]
1614#[non_exhaustive]
1615pub enum CreatePaymentMethodNaverPayFunding {
1616    Card,
1617    Points,
1618    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1619    Unknown(String),
1620}
1621impl CreatePaymentMethodNaverPayFunding {
1622    pub fn as_str(&self) -> &str {
1623        use CreatePaymentMethodNaverPayFunding::*;
1624        match self {
1625            Card => "card",
1626            Points => "points",
1627            Unknown(v) => v,
1628        }
1629    }
1630}
1631
1632impl std::str::FromStr for CreatePaymentMethodNaverPayFunding {
1633    type Err = std::convert::Infallible;
1634    fn from_str(s: &str) -> Result<Self, Self::Err> {
1635        use CreatePaymentMethodNaverPayFunding::*;
1636        match s {
1637            "card" => Ok(Card),
1638            "points" => Ok(Points),
1639            v => {
1640                tracing::warn!(
1641                    "Unknown value '{}' for enum '{}'",
1642                    v,
1643                    "CreatePaymentMethodNaverPayFunding"
1644                );
1645                Ok(Unknown(v.to_owned()))
1646            }
1647        }
1648    }
1649}
1650impl std::fmt::Display for CreatePaymentMethodNaverPayFunding {
1651    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1652        f.write_str(self.as_str())
1653    }
1654}
1655
1656#[cfg(not(feature = "redact-generated-debug"))]
1657impl std::fmt::Debug for CreatePaymentMethodNaverPayFunding {
1658    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1659        f.write_str(self.as_str())
1660    }
1661}
1662#[cfg(feature = "redact-generated-debug")]
1663impl std::fmt::Debug for CreatePaymentMethodNaverPayFunding {
1664    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1665        f.debug_struct(stringify!(CreatePaymentMethodNaverPayFunding)).finish_non_exhaustive()
1666    }
1667}
1668impl serde::Serialize for CreatePaymentMethodNaverPayFunding {
1669    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1670    where
1671        S: serde::Serializer,
1672    {
1673        serializer.serialize_str(self.as_str())
1674    }
1675}
1676#[cfg(feature = "deserialize")]
1677impl<'de> serde::Deserialize<'de> for CreatePaymentMethodNaverPayFunding {
1678    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1679        use std::str::FromStr;
1680        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1681        Ok(Self::from_str(&s).expect("infallible"))
1682    }
1683}
1684/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
1685#[derive(Clone, Eq, PartialEq)]
1686#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1687#[derive(serde::Serialize)]
1688pub struct CreatePaymentMethodNzBankAccount {
1689    /// The name on the bank account.
1690    /// Only required if the account holder name is different from the name of the authorized signatory collected in the PaymentMethod’s billing details.
1691    #[serde(skip_serializing_if = "Option::is_none")]
1692    pub account_holder_name: Option<String>,
1693    /// The account number for the bank account.
1694    pub account_number: String,
1695    /// The numeric code for the bank account's bank.
1696    pub bank_code: String,
1697    /// The numeric code for the bank account's bank branch.
1698    pub branch_code: String,
1699    #[serde(skip_serializing_if = "Option::is_none")]
1700    pub reference: Option<String>,
1701    /// The suffix of the bank account number.
1702    pub suffix: String,
1703}
1704#[cfg(feature = "redact-generated-debug")]
1705impl std::fmt::Debug for CreatePaymentMethodNzBankAccount {
1706    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1707        f.debug_struct("CreatePaymentMethodNzBankAccount").finish_non_exhaustive()
1708    }
1709}
1710impl CreatePaymentMethodNzBankAccount {
1711    pub fn new(
1712        account_number: impl Into<String>,
1713        bank_code: impl Into<String>,
1714        branch_code: impl Into<String>,
1715        suffix: impl Into<String>,
1716    ) -> Self {
1717        Self {
1718            account_holder_name: None,
1719            account_number: account_number.into(),
1720            bank_code: bank_code.into(),
1721            branch_code: branch_code.into(),
1722            reference: None,
1723            suffix: suffix.into(),
1724        }
1725    }
1726}
1727/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
1728#[derive(Clone, Eq, PartialEq)]
1729#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1730#[derive(serde::Serialize)]
1731pub struct CreatePaymentMethodP24 {
1732    /// The customer's bank.
1733    #[serde(skip_serializing_if = "Option::is_none")]
1734    pub bank: Option<CreatePaymentMethodP24Bank>,
1735}
1736#[cfg(feature = "redact-generated-debug")]
1737impl std::fmt::Debug for CreatePaymentMethodP24 {
1738    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1739        f.debug_struct("CreatePaymentMethodP24").finish_non_exhaustive()
1740    }
1741}
1742impl CreatePaymentMethodP24 {
1743    pub fn new() -> Self {
1744        Self { bank: None }
1745    }
1746}
1747impl Default for CreatePaymentMethodP24 {
1748    fn default() -> Self {
1749        Self::new()
1750    }
1751}
1752/// The customer's bank.
1753#[derive(Clone, Eq, PartialEq)]
1754#[non_exhaustive]
1755pub enum CreatePaymentMethodP24Bank {
1756    AliorBank,
1757    BankMillennium,
1758    BankNowyBfgSa,
1759    BankPekaoSa,
1760    BankiSpbdzielcze,
1761    Blik,
1762    BnpParibas,
1763    Boz,
1764    CitiHandlowy,
1765    CreditAgricole,
1766    Envelobank,
1767    EtransferPocztowy24,
1768    GetinBank,
1769    Ideabank,
1770    Ing,
1771    Inteligo,
1772    MbankMtransfer,
1773    NestPrzelew,
1774    NoblePay,
1775    PbacZIpko,
1776    PlusBank,
1777    SantanderPrzelew24,
1778    TmobileUsbugiBankowe,
1779    ToyotaBank,
1780    Velobank,
1781    VolkswagenBank,
1782    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1783    Unknown(String),
1784}
1785impl CreatePaymentMethodP24Bank {
1786    pub fn as_str(&self) -> &str {
1787        use CreatePaymentMethodP24Bank::*;
1788        match self {
1789            AliorBank => "alior_bank",
1790            BankMillennium => "bank_millennium",
1791            BankNowyBfgSa => "bank_nowy_bfg_sa",
1792            BankPekaoSa => "bank_pekao_sa",
1793            BankiSpbdzielcze => "banki_spbdzielcze",
1794            Blik => "blik",
1795            BnpParibas => "bnp_paribas",
1796            Boz => "boz",
1797            CitiHandlowy => "citi_handlowy",
1798            CreditAgricole => "credit_agricole",
1799            Envelobank => "envelobank",
1800            EtransferPocztowy24 => "etransfer_pocztowy24",
1801            GetinBank => "getin_bank",
1802            Ideabank => "ideabank",
1803            Ing => "ing",
1804            Inteligo => "inteligo",
1805            MbankMtransfer => "mbank_mtransfer",
1806            NestPrzelew => "nest_przelew",
1807            NoblePay => "noble_pay",
1808            PbacZIpko => "pbac_z_ipko",
1809            PlusBank => "plus_bank",
1810            SantanderPrzelew24 => "santander_przelew24",
1811            TmobileUsbugiBankowe => "tmobile_usbugi_bankowe",
1812            ToyotaBank => "toyota_bank",
1813            Velobank => "velobank",
1814            VolkswagenBank => "volkswagen_bank",
1815            Unknown(v) => v,
1816        }
1817    }
1818}
1819
1820impl std::str::FromStr for CreatePaymentMethodP24Bank {
1821    type Err = std::convert::Infallible;
1822    fn from_str(s: &str) -> Result<Self, Self::Err> {
1823        use CreatePaymentMethodP24Bank::*;
1824        match s {
1825            "alior_bank" => Ok(AliorBank),
1826            "bank_millennium" => Ok(BankMillennium),
1827            "bank_nowy_bfg_sa" => Ok(BankNowyBfgSa),
1828            "bank_pekao_sa" => Ok(BankPekaoSa),
1829            "banki_spbdzielcze" => Ok(BankiSpbdzielcze),
1830            "blik" => Ok(Blik),
1831            "bnp_paribas" => Ok(BnpParibas),
1832            "boz" => Ok(Boz),
1833            "citi_handlowy" => Ok(CitiHandlowy),
1834            "credit_agricole" => Ok(CreditAgricole),
1835            "envelobank" => Ok(Envelobank),
1836            "etransfer_pocztowy24" => Ok(EtransferPocztowy24),
1837            "getin_bank" => Ok(GetinBank),
1838            "ideabank" => Ok(Ideabank),
1839            "ing" => Ok(Ing),
1840            "inteligo" => Ok(Inteligo),
1841            "mbank_mtransfer" => Ok(MbankMtransfer),
1842            "nest_przelew" => Ok(NestPrzelew),
1843            "noble_pay" => Ok(NoblePay),
1844            "pbac_z_ipko" => Ok(PbacZIpko),
1845            "plus_bank" => Ok(PlusBank),
1846            "santander_przelew24" => Ok(SantanderPrzelew24),
1847            "tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe),
1848            "toyota_bank" => Ok(ToyotaBank),
1849            "velobank" => Ok(Velobank),
1850            "volkswagen_bank" => Ok(VolkswagenBank),
1851            v => {
1852                tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreatePaymentMethodP24Bank");
1853                Ok(Unknown(v.to_owned()))
1854            }
1855        }
1856    }
1857}
1858impl std::fmt::Display for CreatePaymentMethodP24Bank {
1859    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1860        f.write_str(self.as_str())
1861    }
1862}
1863
1864#[cfg(not(feature = "redact-generated-debug"))]
1865impl std::fmt::Debug for CreatePaymentMethodP24Bank {
1866    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1867        f.write_str(self.as_str())
1868    }
1869}
1870#[cfg(feature = "redact-generated-debug")]
1871impl std::fmt::Debug for CreatePaymentMethodP24Bank {
1872    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1873        f.debug_struct(stringify!(CreatePaymentMethodP24Bank)).finish_non_exhaustive()
1874    }
1875}
1876impl serde::Serialize for CreatePaymentMethodP24Bank {
1877    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1878    where
1879        S: serde::Serializer,
1880    {
1881        serializer.serialize_str(self.as_str())
1882    }
1883}
1884#[cfg(feature = "deserialize")]
1885impl<'de> serde::Deserialize<'de> for CreatePaymentMethodP24Bank {
1886    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1887        use std::str::FromStr;
1888        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1889        Ok(Self::from_str(&s).expect("infallible"))
1890    }
1891}
1892/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
1893#[derive(Clone, Eq, PartialEq)]
1894#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1895#[derive(serde::Serialize)]
1896pub struct CreatePaymentMethodPayto {
1897    /// The account number for the bank account.
1898    #[serde(skip_serializing_if = "Option::is_none")]
1899    pub account_number: Option<String>,
1900    /// Bank-State-Branch number of the bank account.
1901    #[serde(skip_serializing_if = "Option::is_none")]
1902    pub bsb_number: Option<String>,
1903    /// The PayID alias for the bank account.
1904    #[serde(skip_serializing_if = "Option::is_none")]
1905    pub pay_id: Option<String>,
1906}
1907#[cfg(feature = "redact-generated-debug")]
1908impl std::fmt::Debug for CreatePaymentMethodPayto {
1909    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1910        f.debug_struct("CreatePaymentMethodPayto").finish_non_exhaustive()
1911    }
1912}
1913impl CreatePaymentMethodPayto {
1914    pub fn new() -> Self {
1915        Self { account_number: None, bsb_number: None, pay_id: None }
1916    }
1917}
1918impl Default for CreatePaymentMethodPayto {
1919    fn default() -> Self {
1920        Self::new()
1921    }
1922}
1923/// Options to configure Radar.
1924/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
1925#[derive(Clone, Eq, PartialEq)]
1926#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1927#[derive(serde::Serialize)]
1928pub struct CreatePaymentMethodRadarOptions {
1929    /// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
1930    #[serde(skip_serializing_if = "Option::is_none")]
1931    pub session: Option<String>,
1932}
1933#[cfg(feature = "redact-generated-debug")]
1934impl std::fmt::Debug for CreatePaymentMethodRadarOptions {
1935    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1936        f.debug_struct("CreatePaymentMethodRadarOptions").finish_non_exhaustive()
1937    }
1938}
1939impl CreatePaymentMethodRadarOptions {
1940    pub fn new() -> Self {
1941        Self { session: None }
1942    }
1943}
1944impl Default for CreatePaymentMethodRadarOptions {
1945    fn default() -> Self {
1946        Self::new()
1947    }
1948}
1949/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
1950#[derive(Clone, Eq, PartialEq)]
1951#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1952#[derive(serde::Serialize)]
1953pub struct CreatePaymentMethodSepaDebit {
1954    /// IBAN of the bank account.
1955    pub iban: String,
1956}
1957#[cfg(feature = "redact-generated-debug")]
1958impl std::fmt::Debug for CreatePaymentMethodSepaDebit {
1959    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1960        f.debug_struct("CreatePaymentMethodSepaDebit").finish_non_exhaustive()
1961    }
1962}
1963impl CreatePaymentMethodSepaDebit {
1964    pub fn new(iban: impl Into<String>) -> Self {
1965        Self { iban: iban.into() }
1966    }
1967}
1968/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
1969#[derive(Clone, Eq, PartialEq)]
1970#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
1971#[derive(serde::Serialize)]
1972pub struct CreatePaymentMethodSofort {
1973    /// Two-letter ISO code representing the country the bank account is located in.
1974    pub country: CreatePaymentMethodSofortCountry,
1975}
1976#[cfg(feature = "redact-generated-debug")]
1977impl std::fmt::Debug for CreatePaymentMethodSofort {
1978    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1979        f.debug_struct("CreatePaymentMethodSofort").finish_non_exhaustive()
1980    }
1981}
1982impl CreatePaymentMethodSofort {
1983    pub fn new(country: impl Into<CreatePaymentMethodSofortCountry>) -> Self {
1984        Self { country: country.into() }
1985    }
1986}
1987/// Two-letter ISO code representing the country the bank account is located in.
1988#[derive(Clone, Eq, PartialEq)]
1989#[non_exhaustive]
1990pub enum CreatePaymentMethodSofortCountry {
1991    At,
1992    Be,
1993    De,
1994    Es,
1995    It,
1996    Nl,
1997    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1998    Unknown(String),
1999}
2000impl CreatePaymentMethodSofortCountry {
2001    pub fn as_str(&self) -> &str {
2002        use CreatePaymentMethodSofortCountry::*;
2003        match self {
2004            At => "AT",
2005            Be => "BE",
2006            De => "DE",
2007            Es => "ES",
2008            It => "IT",
2009            Nl => "NL",
2010            Unknown(v) => v,
2011        }
2012    }
2013}
2014
2015impl std::str::FromStr for CreatePaymentMethodSofortCountry {
2016    type Err = std::convert::Infallible;
2017    fn from_str(s: &str) -> Result<Self, Self::Err> {
2018        use CreatePaymentMethodSofortCountry::*;
2019        match s {
2020            "AT" => Ok(At),
2021            "BE" => Ok(Be),
2022            "DE" => Ok(De),
2023            "ES" => Ok(Es),
2024            "IT" => Ok(It),
2025            "NL" => Ok(Nl),
2026            v => {
2027                tracing::warn!(
2028                    "Unknown value '{}' for enum '{}'",
2029                    v,
2030                    "CreatePaymentMethodSofortCountry"
2031                );
2032                Ok(Unknown(v.to_owned()))
2033            }
2034        }
2035    }
2036}
2037impl std::fmt::Display for CreatePaymentMethodSofortCountry {
2038    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2039        f.write_str(self.as_str())
2040    }
2041}
2042
2043#[cfg(not(feature = "redact-generated-debug"))]
2044impl std::fmt::Debug for CreatePaymentMethodSofortCountry {
2045    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2046        f.write_str(self.as_str())
2047    }
2048}
2049#[cfg(feature = "redact-generated-debug")]
2050impl std::fmt::Debug for CreatePaymentMethodSofortCountry {
2051    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2052        f.debug_struct(stringify!(CreatePaymentMethodSofortCountry)).finish_non_exhaustive()
2053    }
2054}
2055impl serde::Serialize for CreatePaymentMethodSofortCountry {
2056    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2057    where
2058        S: serde::Serializer,
2059    {
2060        serializer.serialize_str(self.as_str())
2061    }
2062}
2063#[cfg(feature = "deserialize")]
2064impl<'de> serde::Deserialize<'de> for CreatePaymentMethodSofortCountry {
2065    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2066        use std::str::FromStr;
2067        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2068        Ok(Self::from_str(&s).expect("infallible"))
2069    }
2070}
2071/// The type of the PaymentMethod.
2072/// An additional hash is included on the PaymentMethod with a name matching this value.
2073/// It contains additional information specific to the PaymentMethod type.
2074#[derive(Clone, Eq, PartialEq)]
2075#[non_exhaustive]
2076pub enum CreatePaymentMethodType {
2077    AcssDebit,
2078    Affirm,
2079    AfterpayClearpay,
2080    Alipay,
2081    Alma,
2082    AmazonPay,
2083    AuBecsDebit,
2084    BacsDebit,
2085    Bancontact,
2086    Billie,
2087    Blik,
2088    Boleto,
2089    Card,
2090    Cashapp,
2091    Crypto,
2092    Custom,
2093    CustomerBalance,
2094    Eps,
2095    Fpx,
2096    Giropay,
2097    Grabpay,
2098    Ideal,
2099    KakaoPay,
2100    Klarna,
2101    Konbini,
2102    KrCard,
2103    Link,
2104    MbWay,
2105    Mobilepay,
2106    Multibanco,
2107    NaverPay,
2108    NzBankAccount,
2109    Oxxo,
2110    P24,
2111    PayByBank,
2112    Payco,
2113    Paynow,
2114    Paypal,
2115    Payto,
2116    Pix,
2117    Promptpay,
2118    RevolutPay,
2119    SamsungPay,
2120    Satispay,
2121    SepaDebit,
2122    Sofort,
2123    Swish,
2124    Twint,
2125    Upi,
2126    UsBankAccount,
2127    WechatPay,
2128    Zip,
2129    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2130    Unknown(String),
2131}
2132impl CreatePaymentMethodType {
2133    pub fn as_str(&self) -> &str {
2134        use CreatePaymentMethodType::*;
2135        match self {
2136            AcssDebit => "acss_debit",
2137            Affirm => "affirm",
2138            AfterpayClearpay => "afterpay_clearpay",
2139            Alipay => "alipay",
2140            Alma => "alma",
2141            AmazonPay => "amazon_pay",
2142            AuBecsDebit => "au_becs_debit",
2143            BacsDebit => "bacs_debit",
2144            Bancontact => "bancontact",
2145            Billie => "billie",
2146            Blik => "blik",
2147            Boleto => "boleto",
2148            Card => "card",
2149            Cashapp => "cashapp",
2150            Crypto => "crypto",
2151            Custom => "custom",
2152            CustomerBalance => "customer_balance",
2153            Eps => "eps",
2154            Fpx => "fpx",
2155            Giropay => "giropay",
2156            Grabpay => "grabpay",
2157            Ideal => "ideal",
2158            KakaoPay => "kakao_pay",
2159            Klarna => "klarna",
2160            Konbini => "konbini",
2161            KrCard => "kr_card",
2162            Link => "link",
2163            MbWay => "mb_way",
2164            Mobilepay => "mobilepay",
2165            Multibanco => "multibanco",
2166            NaverPay => "naver_pay",
2167            NzBankAccount => "nz_bank_account",
2168            Oxxo => "oxxo",
2169            P24 => "p24",
2170            PayByBank => "pay_by_bank",
2171            Payco => "payco",
2172            Paynow => "paynow",
2173            Paypal => "paypal",
2174            Payto => "payto",
2175            Pix => "pix",
2176            Promptpay => "promptpay",
2177            RevolutPay => "revolut_pay",
2178            SamsungPay => "samsung_pay",
2179            Satispay => "satispay",
2180            SepaDebit => "sepa_debit",
2181            Sofort => "sofort",
2182            Swish => "swish",
2183            Twint => "twint",
2184            Upi => "upi",
2185            UsBankAccount => "us_bank_account",
2186            WechatPay => "wechat_pay",
2187            Zip => "zip",
2188            Unknown(v) => v,
2189        }
2190    }
2191}
2192
2193impl std::str::FromStr for CreatePaymentMethodType {
2194    type Err = std::convert::Infallible;
2195    fn from_str(s: &str) -> Result<Self, Self::Err> {
2196        use CreatePaymentMethodType::*;
2197        match s {
2198            "acss_debit" => Ok(AcssDebit),
2199            "affirm" => Ok(Affirm),
2200            "afterpay_clearpay" => Ok(AfterpayClearpay),
2201            "alipay" => Ok(Alipay),
2202            "alma" => Ok(Alma),
2203            "amazon_pay" => Ok(AmazonPay),
2204            "au_becs_debit" => Ok(AuBecsDebit),
2205            "bacs_debit" => Ok(BacsDebit),
2206            "bancontact" => Ok(Bancontact),
2207            "billie" => Ok(Billie),
2208            "blik" => Ok(Blik),
2209            "boleto" => Ok(Boleto),
2210            "card" => Ok(Card),
2211            "cashapp" => Ok(Cashapp),
2212            "crypto" => Ok(Crypto),
2213            "custom" => Ok(Custom),
2214            "customer_balance" => Ok(CustomerBalance),
2215            "eps" => Ok(Eps),
2216            "fpx" => Ok(Fpx),
2217            "giropay" => Ok(Giropay),
2218            "grabpay" => Ok(Grabpay),
2219            "ideal" => Ok(Ideal),
2220            "kakao_pay" => Ok(KakaoPay),
2221            "klarna" => Ok(Klarna),
2222            "konbini" => Ok(Konbini),
2223            "kr_card" => Ok(KrCard),
2224            "link" => Ok(Link),
2225            "mb_way" => Ok(MbWay),
2226            "mobilepay" => Ok(Mobilepay),
2227            "multibanco" => Ok(Multibanco),
2228            "naver_pay" => Ok(NaverPay),
2229            "nz_bank_account" => Ok(NzBankAccount),
2230            "oxxo" => Ok(Oxxo),
2231            "p24" => Ok(P24),
2232            "pay_by_bank" => Ok(PayByBank),
2233            "payco" => Ok(Payco),
2234            "paynow" => Ok(Paynow),
2235            "paypal" => Ok(Paypal),
2236            "payto" => Ok(Payto),
2237            "pix" => Ok(Pix),
2238            "promptpay" => Ok(Promptpay),
2239            "revolut_pay" => Ok(RevolutPay),
2240            "samsung_pay" => Ok(SamsungPay),
2241            "satispay" => Ok(Satispay),
2242            "sepa_debit" => Ok(SepaDebit),
2243            "sofort" => Ok(Sofort),
2244            "swish" => Ok(Swish),
2245            "twint" => Ok(Twint),
2246            "upi" => Ok(Upi),
2247            "us_bank_account" => Ok(UsBankAccount),
2248            "wechat_pay" => Ok(WechatPay),
2249            "zip" => Ok(Zip),
2250            v => {
2251                tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreatePaymentMethodType");
2252                Ok(Unknown(v.to_owned()))
2253            }
2254        }
2255    }
2256}
2257impl std::fmt::Display for CreatePaymentMethodType {
2258    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2259        f.write_str(self.as_str())
2260    }
2261}
2262
2263#[cfg(not(feature = "redact-generated-debug"))]
2264impl std::fmt::Debug for CreatePaymentMethodType {
2265    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2266        f.write_str(self.as_str())
2267    }
2268}
2269#[cfg(feature = "redact-generated-debug")]
2270impl std::fmt::Debug for CreatePaymentMethodType {
2271    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2272        f.debug_struct(stringify!(CreatePaymentMethodType)).finish_non_exhaustive()
2273    }
2274}
2275impl serde::Serialize for CreatePaymentMethodType {
2276    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2277    where
2278        S: serde::Serializer,
2279    {
2280        serializer.serialize_str(self.as_str())
2281    }
2282}
2283#[cfg(feature = "deserialize")]
2284impl<'de> serde::Deserialize<'de> for CreatePaymentMethodType {
2285    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2286        use std::str::FromStr;
2287        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2288        Ok(Self::from_str(&s).expect("infallible"))
2289    }
2290}
2291/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
2292#[derive(Clone, Eq, PartialEq)]
2293#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2294#[derive(serde::Serialize)]
2295pub struct CreatePaymentMethodUpi {
2296    /// Configuration options for setting up an eMandate
2297    #[serde(skip_serializing_if = "Option::is_none")]
2298    pub mandate_options: Option<CreatePaymentMethodUpiMandateOptions>,
2299}
2300#[cfg(feature = "redact-generated-debug")]
2301impl std::fmt::Debug for CreatePaymentMethodUpi {
2302    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2303        f.debug_struct("CreatePaymentMethodUpi").finish_non_exhaustive()
2304    }
2305}
2306impl CreatePaymentMethodUpi {
2307    pub fn new() -> Self {
2308        Self { mandate_options: None }
2309    }
2310}
2311impl Default for CreatePaymentMethodUpi {
2312    fn default() -> Self {
2313        Self::new()
2314    }
2315}
2316/// Configuration options for setting up an eMandate
2317#[derive(Clone, Eq, PartialEq)]
2318#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2319#[derive(serde::Serialize)]
2320pub struct CreatePaymentMethodUpiMandateOptions {
2321    /// Amount to be charged for future payments.
2322    #[serde(skip_serializing_if = "Option::is_none")]
2323    pub amount: Option<i64>,
2324    /// One of `fixed` or `maximum`.
2325    /// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
2326    /// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
2327    #[serde(skip_serializing_if = "Option::is_none")]
2328    pub amount_type: Option<CreatePaymentMethodUpiMandateOptionsAmountType>,
2329    /// A description of the mandate or subscription that is meant to be displayed to the customer.
2330    #[serde(skip_serializing_if = "Option::is_none")]
2331    pub description: Option<String>,
2332    /// End date of the mandate or subscription.
2333    #[serde(skip_serializing_if = "Option::is_none")]
2334    pub end_date: Option<stripe_types::Timestamp>,
2335}
2336#[cfg(feature = "redact-generated-debug")]
2337impl std::fmt::Debug for CreatePaymentMethodUpiMandateOptions {
2338    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2339        f.debug_struct("CreatePaymentMethodUpiMandateOptions").finish_non_exhaustive()
2340    }
2341}
2342impl CreatePaymentMethodUpiMandateOptions {
2343    pub fn new() -> Self {
2344        Self { amount: None, amount_type: None, description: None, end_date: None }
2345    }
2346}
2347impl Default for CreatePaymentMethodUpiMandateOptions {
2348    fn default() -> Self {
2349        Self::new()
2350    }
2351}
2352/// One of `fixed` or `maximum`.
2353/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
2354/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
2355#[derive(Clone, Eq, PartialEq)]
2356#[non_exhaustive]
2357pub enum CreatePaymentMethodUpiMandateOptionsAmountType {
2358    Fixed,
2359    Maximum,
2360    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2361    Unknown(String),
2362}
2363impl CreatePaymentMethodUpiMandateOptionsAmountType {
2364    pub fn as_str(&self) -> &str {
2365        use CreatePaymentMethodUpiMandateOptionsAmountType::*;
2366        match self {
2367            Fixed => "fixed",
2368            Maximum => "maximum",
2369            Unknown(v) => v,
2370        }
2371    }
2372}
2373
2374impl std::str::FromStr for CreatePaymentMethodUpiMandateOptionsAmountType {
2375    type Err = std::convert::Infallible;
2376    fn from_str(s: &str) -> Result<Self, Self::Err> {
2377        use CreatePaymentMethodUpiMandateOptionsAmountType::*;
2378        match s {
2379            "fixed" => Ok(Fixed),
2380            "maximum" => Ok(Maximum),
2381            v => {
2382                tracing::warn!(
2383                    "Unknown value '{}' for enum '{}'",
2384                    v,
2385                    "CreatePaymentMethodUpiMandateOptionsAmountType"
2386                );
2387                Ok(Unknown(v.to_owned()))
2388            }
2389        }
2390    }
2391}
2392impl std::fmt::Display for CreatePaymentMethodUpiMandateOptionsAmountType {
2393    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2394        f.write_str(self.as_str())
2395    }
2396}
2397
2398#[cfg(not(feature = "redact-generated-debug"))]
2399impl std::fmt::Debug for CreatePaymentMethodUpiMandateOptionsAmountType {
2400    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2401        f.write_str(self.as_str())
2402    }
2403}
2404#[cfg(feature = "redact-generated-debug")]
2405impl std::fmt::Debug for CreatePaymentMethodUpiMandateOptionsAmountType {
2406    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2407        f.debug_struct(stringify!(CreatePaymentMethodUpiMandateOptionsAmountType))
2408            .finish_non_exhaustive()
2409    }
2410}
2411impl serde::Serialize for CreatePaymentMethodUpiMandateOptionsAmountType {
2412    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2413    where
2414        S: serde::Serializer,
2415    {
2416        serializer.serialize_str(self.as_str())
2417    }
2418}
2419#[cfg(feature = "deserialize")]
2420impl<'de> serde::Deserialize<'de> for CreatePaymentMethodUpiMandateOptionsAmountType {
2421    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2422        use std::str::FromStr;
2423        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2424        Ok(Self::from_str(&s).expect("infallible"))
2425    }
2426}
2427/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
2428#[derive(Clone, Eq, PartialEq)]
2429#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2430#[derive(serde::Serialize)]
2431pub struct CreatePaymentMethodUsBankAccount {
2432    /// Account holder type: individual or company.
2433    #[serde(skip_serializing_if = "Option::is_none")]
2434    pub account_holder_type: Option<CreatePaymentMethodUsBankAccountAccountHolderType>,
2435    /// Account number of the bank account.
2436    #[serde(skip_serializing_if = "Option::is_none")]
2437    pub account_number: Option<String>,
2438    /// Account type: checkings or savings. Defaults to checking if omitted.
2439    #[serde(skip_serializing_if = "Option::is_none")]
2440    pub account_type: Option<CreatePaymentMethodUsBankAccountAccountType>,
2441    /// The ID of a Financial Connections Account to use as a payment method.
2442    #[serde(skip_serializing_if = "Option::is_none")]
2443    pub financial_connections_account: Option<String>,
2444    /// Routing number of the bank account.
2445    #[serde(skip_serializing_if = "Option::is_none")]
2446    pub routing_number: Option<String>,
2447}
2448#[cfg(feature = "redact-generated-debug")]
2449impl std::fmt::Debug for CreatePaymentMethodUsBankAccount {
2450    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2451        f.debug_struct("CreatePaymentMethodUsBankAccount").finish_non_exhaustive()
2452    }
2453}
2454impl CreatePaymentMethodUsBankAccount {
2455    pub fn new() -> Self {
2456        Self {
2457            account_holder_type: None,
2458            account_number: None,
2459            account_type: None,
2460            financial_connections_account: None,
2461            routing_number: None,
2462        }
2463    }
2464}
2465impl Default for CreatePaymentMethodUsBankAccount {
2466    fn default() -> Self {
2467        Self::new()
2468    }
2469}
2470/// Account holder type: individual or company.
2471#[derive(Clone, Eq, PartialEq)]
2472#[non_exhaustive]
2473pub enum CreatePaymentMethodUsBankAccountAccountHolderType {
2474    Company,
2475    Individual,
2476    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2477    Unknown(String),
2478}
2479impl CreatePaymentMethodUsBankAccountAccountHolderType {
2480    pub fn as_str(&self) -> &str {
2481        use CreatePaymentMethodUsBankAccountAccountHolderType::*;
2482        match self {
2483            Company => "company",
2484            Individual => "individual",
2485            Unknown(v) => v,
2486        }
2487    }
2488}
2489
2490impl std::str::FromStr for CreatePaymentMethodUsBankAccountAccountHolderType {
2491    type Err = std::convert::Infallible;
2492    fn from_str(s: &str) -> Result<Self, Self::Err> {
2493        use CreatePaymentMethodUsBankAccountAccountHolderType::*;
2494        match s {
2495            "company" => Ok(Company),
2496            "individual" => Ok(Individual),
2497            v => {
2498                tracing::warn!(
2499                    "Unknown value '{}' for enum '{}'",
2500                    v,
2501                    "CreatePaymentMethodUsBankAccountAccountHolderType"
2502                );
2503                Ok(Unknown(v.to_owned()))
2504            }
2505        }
2506    }
2507}
2508impl std::fmt::Display for CreatePaymentMethodUsBankAccountAccountHolderType {
2509    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2510        f.write_str(self.as_str())
2511    }
2512}
2513
2514#[cfg(not(feature = "redact-generated-debug"))]
2515impl std::fmt::Debug for CreatePaymentMethodUsBankAccountAccountHolderType {
2516    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2517        f.write_str(self.as_str())
2518    }
2519}
2520#[cfg(feature = "redact-generated-debug")]
2521impl std::fmt::Debug for CreatePaymentMethodUsBankAccountAccountHolderType {
2522    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2523        f.debug_struct(stringify!(CreatePaymentMethodUsBankAccountAccountHolderType))
2524            .finish_non_exhaustive()
2525    }
2526}
2527impl serde::Serialize for CreatePaymentMethodUsBankAccountAccountHolderType {
2528    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2529    where
2530        S: serde::Serializer,
2531    {
2532        serializer.serialize_str(self.as_str())
2533    }
2534}
2535#[cfg(feature = "deserialize")]
2536impl<'de> serde::Deserialize<'de> for CreatePaymentMethodUsBankAccountAccountHolderType {
2537    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2538        use std::str::FromStr;
2539        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2540        Ok(Self::from_str(&s).expect("infallible"))
2541    }
2542}
2543/// Account type: checkings or savings. Defaults to checking if omitted.
2544#[derive(Clone, Eq, PartialEq)]
2545#[non_exhaustive]
2546pub enum CreatePaymentMethodUsBankAccountAccountType {
2547    Checking,
2548    Savings,
2549    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2550    Unknown(String),
2551}
2552impl CreatePaymentMethodUsBankAccountAccountType {
2553    pub fn as_str(&self) -> &str {
2554        use CreatePaymentMethodUsBankAccountAccountType::*;
2555        match self {
2556            Checking => "checking",
2557            Savings => "savings",
2558            Unknown(v) => v,
2559        }
2560    }
2561}
2562
2563impl std::str::FromStr for CreatePaymentMethodUsBankAccountAccountType {
2564    type Err = std::convert::Infallible;
2565    fn from_str(s: &str) -> Result<Self, Self::Err> {
2566        use CreatePaymentMethodUsBankAccountAccountType::*;
2567        match s {
2568            "checking" => Ok(Checking),
2569            "savings" => Ok(Savings),
2570            v => {
2571                tracing::warn!(
2572                    "Unknown value '{}' for enum '{}'",
2573                    v,
2574                    "CreatePaymentMethodUsBankAccountAccountType"
2575                );
2576                Ok(Unknown(v.to_owned()))
2577            }
2578        }
2579    }
2580}
2581impl std::fmt::Display for CreatePaymentMethodUsBankAccountAccountType {
2582    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2583        f.write_str(self.as_str())
2584    }
2585}
2586
2587#[cfg(not(feature = "redact-generated-debug"))]
2588impl std::fmt::Debug for CreatePaymentMethodUsBankAccountAccountType {
2589    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2590        f.write_str(self.as_str())
2591    }
2592}
2593#[cfg(feature = "redact-generated-debug")]
2594impl std::fmt::Debug for CreatePaymentMethodUsBankAccountAccountType {
2595    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2596        f.debug_struct(stringify!(CreatePaymentMethodUsBankAccountAccountType))
2597            .finish_non_exhaustive()
2598    }
2599}
2600impl serde::Serialize for CreatePaymentMethodUsBankAccountAccountType {
2601    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2602    where
2603        S: serde::Serializer,
2604    {
2605        serializer.serialize_str(self.as_str())
2606    }
2607}
2608#[cfg(feature = "deserialize")]
2609impl<'de> serde::Deserialize<'de> for CreatePaymentMethodUsBankAccountAccountType {
2610    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2611        use std::str::FromStr;
2612        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2613        Ok(Self::from_str(&s).expect("infallible"))
2614    }
2615}
2616/// Creates a PaymentMethod object.
2617/// Read the [Stripe.js reference](https://stripe.com/docs/stripe-js/reference#stripe-create-payment-method) to learn how to create PaymentMethods via Stripe.js.
2618///
2619/// Instead of creating a PaymentMethod directly, we recommend using the [PaymentIntents](https://stripe.com/docs/payments/accept-a-payment) API to accept a payment immediately or the [SetupIntent](https://stripe.com/docs/payments/save-and-reuse) API to collect payment method details ahead of a future payment.
2620#[derive(Clone)]
2621#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
2622#[derive(serde::Serialize)]
2623pub struct CreatePaymentMethod {
2624    inner: CreatePaymentMethodBuilder,
2625}
2626#[cfg(feature = "redact-generated-debug")]
2627impl std::fmt::Debug for CreatePaymentMethod {
2628    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2629        f.debug_struct("CreatePaymentMethod").finish_non_exhaustive()
2630    }
2631}
2632impl CreatePaymentMethod {
2633    /// Construct a new `CreatePaymentMethod`.
2634    pub fn new() -> Self {
2635        Self { inner: CreatePaymentMethodBuilder::new() }
2636    }
2637    /// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
2638    pub fn acss_debit(mut self, acss_debit: impl Into<CreatePaymentMethodAcssDebit>) -> Self {
2639        self.inner.acss_debit = Some(acss_debit.into());
2640        self
2641    }
2642    /// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method.
2643    pub fn affirm(mut self, affirm: impl Into<miniserde::json::Value>) -> Self {
2644        self.inner.affirm = Some(affirm.into());
2645        self
2646    }
2647    /// If this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.
2648    pub fn afterpay_clearpay(
2649        mut self,
2650        afterpay_clearpay: impl Into<miniserde::json::Value>,
2651    ) -> Self {
2652        self.inner.afterpay_clearpay = Some(afterpay_clearpay.into());
2653        self
2654    }
2655    /// If this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.
2656    pub fn alipay(mut self, alipay: impl Into<miniserde::json::Value>) -> Self {
2657        self.inner.alipay = Some(alipay.into());
2658        self
2659    }
2660    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
2661    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
2662    /// The field defaults to `unspecified`.
2663    pub fn allow_redisplay(
2664        mut self,
2665        allow_redisplay: impl Into<stripe_shared::PaymentMethodAllowRedisplay>,
2666    ) -> Self {
2667        self.inner.allow_redisplay = Some(allow_redisplay.into());
2668        self
2669    }
2670    /// If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.
2671    pub fn alma(mut self, alma: impl Into<miniserde::json::Value>) -> Self {
2672        self.inner.alma = Some(alma.into());
2673        self
2674    }
2675    /// If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
2676    pub fn amazon_pay(mut self, amazon_pay: impl Into<miniserde::json::Value>) -> Self {
2677        self.inner.amazon_pay = Some(amazon_pay.into());
2678        self
2679    }
2680    /// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
2681    pub fn au_becs_debit(
2682        mut self,
2683        au_becs_debit: impl Into<CreatePaymentMethodAuBecsDebit>,
2684    ) -> Self {
2685        self.inner.au_becs_debit = Some(au_becs_debit.into());
2686        self
2687    }
2688    /// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
2689    pub fn bacs_debit(mut self, bacs_debit: impl Into<CreatePaymentMethodBacsDebit>) -> Self {
2690        self.inner.bacs_debit = Some(bacs_debit.into());
2691        self
2692    }
2693    /// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.
2694    pub fn bancontact(mut self, bancontact: impl Into<miniserde::json::Value>) -> Self {
2695        self.inner.bancontact = Some(bancontact.into());
2696        self
2697    }
2698    /// If this is a `billie` PaymentMethod, this hash contains details about the Billie payment method.
2699    pub fn billie(mut self, billie: impl Into<miniserde::json::Value>) -> Self {
2700        self.inner.billie = Some(billie.into());
2701        self
2702    }
2703    /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
2704    pub fn billing_details(
2705        mut self,
2706        billing_details: impl Into<BillingDetailsInnerParams>,
2707    ) -> Self {
2708        self.inner.billing_details = Some(billing_details.into());
2709        self
2710    }
2711    /// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method.
2712    pub fn blik(mut self, blik: impl Into<miniserde::json::Value>) -> Self {
2713        self.inner.blik = Some(blik.into());
2714        self
2715    }
2716    /// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
2717    pub fn boleto(mut self, boleto: impl Into<CreatePaymentMethodBoleto>) -> Self {
2718        self.inner.boleto = Some(boleto.into());
2719        self
2720    }
2721    /// If this is a `card` PaymentMethod, this hash contains the user's card details.
2722    /// For backwards compatibility, you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format `card: {token: "tok_visa"}`.
2723    /// When providing a card number, you must meet the requirements for [PCI compliance](https://stripe.com/docs/security#validating-pci-compliance).
2724    /// We strongly recommend using Stripe.js instead of interacting with this API directly.
2725    pub fn card(mut self, card: impl Into<CreatePaymentMethodCard>) -> Self {
2726        self.inner.card = Some(card.into());
2727        self
2728    }
2729    /// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
2730    pub fn cashapp(mut self, cashapp: impl Into<miniserde::json::Value>) -> Self {
2731        self.inner.cashapp = Some(cashapp.into());
2732        self
2733    }
2734    /// If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
2735    pub fn crypto(mut self, crypto: impl Into<miniserde::json::Value>) -> Self {
2736        self.inner.crypto = Some(crypto.into());
2737        self
2738    }
2739    /// If this is a `custom` PaymentMethod, this hash contains details about the Custom payment method.
2740    pub fn custom(mut self, custom: impl Into<CreatePaymentMethodCustom>) -> Self {
2741        self.inner.custom = Some(custom.into());
2742        self
2743    }
2744    /// The `Customer` to whom the original PaymentMethod is attached.
2745    pub fn customer(mut self, customer: impl Into<String>) -> Self {
2746        self.inner.customer = Some(customer.into());
2747        self
2748    }
2749    /// If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
2750    pub fn customer_balance(mut self, customer_balance: impl Into<miniserde::json::Value>) -> Self {
2751        self.inner.customer_balance = Some(customer_balance.into());
2752        self
2753    }
2754    /// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
2755    pub fn eps(mut self, eps: impl Into<CreatePaymentMethodEps>) -> Self {
2756        self.inner.eps = Some(eps.into());
2757        self
2758    }
2759    /// Specifies which fields in the response should be expanded.
2760    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2761        self.inner.expand = Some(expand.into());
2762        self
2763    }
2764    /// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
2765    pub fn fpx(mut self, fpx: impl Into<CreatePaymentMethodFpx>) -> Self {
2766        self.inner.fpx = Some(fpx.into());
2767        self
2768    }
2769    /// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.
2770    pub fn giropay(mut self, giropay: impl Into<miniserde::json::Value>) -> Self {
2771        self.inner.giropay = Some(giropay.into());
2772        self
2773    }
2774    /// If this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.
2775    pub fn grabpay(mut self, grabpay: impl Into<miniserde::json::Value>) -> Self {
2776        self.inner.grabpay = Some(grabpay.into());
2777        self
2778    }
2779    /// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
2780    pub fn ideal(mut self, ideal: impl Into<CreatePaymentMethodIdeal>) -> Self {
2781        self.inner.ideal = Some(ideal.into());
2782        self
2783    }
2784    /// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
2785    pub fn interac_present(mut self, interac_present: impl Into<miniserde::json::Value>) -> Self {
2786        self.inner.interac_present = Some(interac_present.into());
2787        self
2788    }
2789    /// If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method.
2790    pub fn kakao_pay(mut self, kakao_pay: impl Into<miniserde::json::Value>) -> Self {
2791        self.inner.kakao_pay = Some(kakao_pay.into());
2792        self
2793    }
2794    /// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
2795    pub fn klarna(mut self, klarna: impl Into<CreatePaymentMethodKlarna>) -> Self {
2796        self.inner.klarna = Some(klarna.into());
2797        self
2798    }
2799    /// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method.
2800    pub fn konbini(mut self, konbini: impl Into<miniserde::json::Value>) -> Self {
2801        self.inner.konbini = Some(konbini.into());
2802        self
2803    }
2804    /// If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method.
2805    pub fn kr_card(mut self, kr_card: impl Into<miniserde::json::Value>) -> Self {
2806        self.inner.kr_card = Some(kr_card.into());
2807        self
2808    }
2809    /// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method.
2810    pub fn link(mut self, link: impl Into<miniserde::json::Value>) -> Self {
2811        self.inner.link = Some(link.into());
2812        self
2813    }
2814    /// If this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.
2815    pub fn mb_way(mut self, mb_way: impl Into<miniserde::json::Value>) -> Self {
2816        self.inner.mb_way = Some(mb_way.into());
2817        self
2818    }
2819    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
2820    /// This can be useful for storing additional information about the object in a structured format.
2821    /// Individual keys can be unset by posting an empty value to them.
2822    /// All keys can be unset by posting an empty value to `metadata`.
2823    pub fn metadata(
2824        mut self,
2825        metadata: impl Into<std::collections::HashMap<String, String>>,
2826    ) -> Self {
2827        self.inner.metadata = Some(metadata.into());
2828        self
2829    }
2830    /// If this is a `mobilepay` PaymentMethod, this hash contains details about the MobilePay payment method.
2831    pub fn mobilepay(mut self, mobilepay: impl Into<miniserde::json::Value>) -> Self {
2832        self.inner.mobilepay = Some(mobilepay.into());
2833        self
2834    }
2835    /// If this is a `multibanco` PaymentMethod, this hash contains details about the Multibanco payment method.
2836    pub fn multibanco(mut self, multibanco: impl Into<miniserde::json::Value>) -> Self {
2837        self.inner.multibanco = Some(multibanco.into());
2838        self
2839    }
2840    /// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
2841    pub fn naver_pay(mut self, naver_pay: impl Into<CreatePaymentMethodNaverPay>) -> Self {
2842        self.inner.naver_pay = Some(naver_pay.into());
2843        self
2844    }
2845    /// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
2846    pub fn nz_bank_account(
2847        mut self,
2848        nz_bank_account: impl Into<CreatePaymentMethodNzBankAccount>,
2849    ) -> Self {
2850        self.inner.nz_bank_account = Some(nz_bank_account.into());
2851        self
2852    }
2853    /// If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.
2854    pub fn oxxo(mut self, oxxo: impl Into<miniserde::json::Value>) -> Self {
2855        self.inner.oxxo = Some(oxxo.into());
2856        self
2857    }
2858    /// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
2859    pub fn p24(mut self, p24: impl Into<CreatePaymentMethodP24>) -> Self {
2860        self.inner.p24 = Some(p24.into());
2861        self
2862    }
2863    /// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method.
2864    pub fn pay_by_bank(mut self, pay_by_bank: impl Into<miniserde::json::Value>) -> Self {
2865        self.inner.pay_by_bank = Some(pay_by_bank.into());
2866        self
2867    }
2868    /// If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method.
2869    pub fn payco(mut self, payco: impl Into<miniserde::json::Value>) -> Self {
2870        self.inner.payco = Some(payco.into());
2871        self
2872    }
2873    /// The PaymentMethod to share.
2874    pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
2875        self.inner.payment_method = Some(payment_method.into());
2876        self
2877    }
2878    /// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method.
2879    pub fn paynow(mut self, paynow: impl Into<miniserde::json::Value>) -> Self {
2880        self.inner.paynow = Some(paynow.into());
2881        self
2882    }
2883    /// If this is a `paypal` PaymentMethod, this hash contains details about the PayPal payment method.
2884    pub fn paypal(mut self, paypal: impl Into<miniserde::json::Value>) -> Self {
2885        self.inner.paypal = Some(paypal.into());
2886        self
2887    }
2888    /// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
2889    pub fn payto(mut self, payto: impl Into<CreatePaymentMethodPayto>) -> Self {
2890        self.inner.payto = Some(payto.into());
2891        self
2892    }
2893    /// If this is a `pix` PaymentMethod, this hash contains details about the Pix payment method.
2894    pub fn pix(mut self, pix: impl Into<miniserde::json::Value>) -> Self {
2895        self.inner.pix = Some(pix.into());
2896        self
2897    }
2898    /// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method.
2899    pub fn promptpay(mut self, promptpay: impl Into<miniserde::json::Value>) -> Self {
2900        self.inner.promptpay = Some(promptpay.into());
2901        self
2902    }
2903    /// Options to configure Radar.
2904    /// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
2905    pub fn radar_options(
2906        mut self,
2907        radar_options: impl Into<CreatePaymentMethodRadarOptions>,
2908    ) -> Self {
2909        self.inner.radar_options = Some(radar_options.into());
2910        self
2911    }
2912    /// If this is a `revolut_pay` PaymentMethod, this hash contains details about the Revolut Pay payment method.
2913    pub fn revolut_pay(mut self, revolut_pay: impl Into<miniserde::json::Value>) -> Self {
2914        self.inner.revolut_pay = Some(revolut_pay.into());
2915        self
2916    }
2917    /// If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method.
2918    pub fn samsung_pay(mut self, samsung_pay: impl Into<miniserde::json::Value>) -> Self {
2919        self.inner.samsung_pay = Some(samsung_pay.into());
2920        self
2921    }
2922    /// If this is a `satispay` PaymentMethod, this hash contains details about the Satispay payment method.
2923    pub fn satispay(mut self, satispay: impl Into<miniserde::json::Value>) -> Self {
2924        self.inner.satispay = Some(satispay.into());
2925        self
2926    }
2927    /// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
2928    pub fn sepa_debit(mut self, sepa_debit: impl Into<CreatePaymentMethodSepaDebit>) -> Self {
2929        self.inner.sepa_debit = Some(sepa_debit.into());
2930        self
2931    }
2932    /// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
2933    pub fn sofort(mut self, sofort: impl Into<CreatePaymentMethodSofort>) -> Self {
2934        self.inner.sofort = Some(sofort.into());
2935        self
2936    }
2937    /// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method.
2938    pub fn swish(mut self, swish: impl Into<miniserde::json::Value>) -> Self {
2939        self.inner.swish = Some(swish.into());
2940        self
2941    }
2942    /// If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
2943    pub fn twint(mut self, twint: impl Into<miniserde::json::Value>) -> Self {
2944        self.inner.twint = Some(twint.into());
2945        self
2946    }
2947    /// The type of the PaymentMethod.
2948    /// An additional hash is included on the PaymentMethod with a name matching this value.
2949    /// It contains additional information specific to the PaymentMethod type.
2950    pub fn type_(mut self, type_: impl Into<CreatePaymentMethodType>) -> Self {
2951        self.inner.type_ = Some(type_.into());
2952        self
2953    }
2954    /// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
2955    pub fn upi(mut self, upi: impl Into<CreatePaymentMethodUpi>) -> Self {
2956        self.inner.upi = Some(upi.into());
2957        self
2958    }
2959    /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
2960    pub fn us_bank_account(
2961        mut self,
2962        us_bank_account: impl Into<CreatePaymentMethodUsBankAccount>,
2963    ) -> Self {
2964        self.inner.us_bank_account = Some(us_bank_account.into());
2965        self
2966    }
2967    /// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.
2968    pub fn wechat_pay(mut self, wechat_pay: impl Into<miniserde::json::Value>) -> Self {
2969        self.inner.wechat_pay = Some(wechat_pay.into());
2970        self
2971    }
2972    /// If this is a `zip` PaymentMethod, this hash contains details about the Zip payment method.
2973    pub fn zip(mut self, zip: impl Into<miniserde::json::Value>) -> Self {
2974        self.inner.zip = Some(zip.into());
2975        self
2976    }
2977}
2978impl Default for CreatePaymentMethod {
2979    fn default() -> Self {
2980        Self::new()
2981    }
2982}
2983impl CreatePaymentMethod {
2984    /// Send the request and return the deserialized response.
2985    pub async fn send<C: StripeClient>(
2986        &self,
2987        client: &C,
2988    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2989        self.customize().send(client).await
2990    }
2991
2992    /// Send the request and return the deserialized response, blocking until completion.
2993    pub fn send_blocking<C: StripeBlockingClient>(
2994        &self,
2995        client: &C,
2996    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2997        self.customize().send_blocking(client)
2998    }
2999}
3000
3001impl StripeRequest for CreatePaymentMethod {
3002    type Output = stripe_shared::PaymentMethod;
3003
3004    fn build(&self) -> RequestBuilder {
3005        RequestBuilder::new(StripeMethod::Post, "/payment_methods").form(&self.inner)
3006    }
3007}
3008#[derive(Clone)]
3009#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3010#[derive(serde::Serialize)]
3011struct UpdatePaymentMethodBuilder {
3012    #[serde(skip_serializing_if = "Option::is_none")]
3013    allow_redisplay: Option<stripe_shared::PaymentMethodAllowRedisplay>,
3014    #[serde(skip_serializing_if = "Option::is_none")]
3015    billing_details: Option<BillingDetailsInnerParams>,
3016    #[serde(skip_serializing_if = "Option::is_none")]
3017    card: Option<UpdatePaymentMethodCard>,
3018    #[serde(skip_serializing_if = "Option::is_none")]
3019    expand: Option<Vec<String>>,
3020    #[serde(skip_serializing_if = "Option::is_none")]
3021    metadata: Option<std::collections::HashMap<String, String>>,
3022    #[serde(skip_serializing_if = "Option::is_none")]
3023    payto: Option<UpdatePaymentMethodPayto>,
3024    #[serde(skip_serializing_if = "Option::is_none")]
3025    us_bank_account: Option<UpdatePaymentMethodUsBankAccount>,
3026}
3027#[cfg(feature = "redact-generated-debug")]
3028impl std::fmt::Debug for UpdatePaymentMethodBuilder {
3029    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3030        f.debug_struct("UpdatePaymentMethodBuilder").finish_non_exhaustive()
3031    }
3032}
3033impl UpdatePaymentMethodBuilder {
3034    fn new() -> Self {
3035        Self {
3036            allow_redisplay: None,
3037            billing_details: None,
3038            card: None,
3039            expand: None,
3040            metadata: None,
3041            payto: None,
3042            us_bank_account: None,
3043        }
3044    }
3045}
3046/// If this is a `card` PaymentMethod, this hash contains the user's card details.
3047#[derive(Clone, Eq, PartialEq)]
3048#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3049#[derive(serde::Serialize)]
3050pub struct UpdatePaymentMethodCard {
3051    /// Two-digit number representing the card's expiration month.
3052    #[serde(skip_serializing_if = "Option::is_none")]
3053    pub exp_month: Option<i64>,
3054    /// Four-digit number representing the card's expiration year.
3055    #[serde(skip_serializing_if = "Option::is_none")]
3056    pub exp_year: Option<i64>,
3057    /// Contains information about card networks used to process the payment.
3058    #[serde(skip_serializing_if = "Option::is_none")]
3059    pub networks: Option<UpdatePaymentMethodCardNetworks>,
3060}
3061#[cfg(feature = "redact-generated-debug")]
3062impl std::fmt::Debug for UpdatePaymentMethodCard {
3063    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3064        f.debug_struct("UpdatePaymentMethodCard").finish_non_exhaustive()
3065    }
3066}
3067impl UpdatePaymentMethodCard {
3068    pub fn new() -> Self {
3069        Self { exp_month: None, exp_year: None, networks: None }
3070    }
3071}
3072impl Default for UpdatePaymentMethodCard {
3073    fn default() -> Self {
3074        Self::new()
3075    }
3076}
3077/// Contains information about card networks used to process the payment.
3078#[derive(Clone, Eq, PartialEq)]
3079#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3080#[derive(serde::Serialize)]
3081pub struct UpdatePaymentMethodCardNetworks {
3082    /// The customer's preferred card network for co-branded cards.
3083    /// Supports `cartes_bancaires`, `mastercard`, or `visa`.
3084    /// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
3085    #[serde(skip_serializing_if = "Option::is_none")]
3086    pub preferred: Option<UpdatePaymentMethodCardNetworksPreferred>,
3087}
3088#[cfg(feature = "redact-generated-debug")]
3089impl std::fmt::Debug for UpdatePaymentMethodCardNetworks {
3090    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3091        f.debug_struct("UpdatePaymentMethodCardNetworks").finish_non_exhaustive()
3092    }
3093}
3094impl UpdatePaymentMethodCardNetworks {
3095    pub fn new() -> Self {
3096        Self { preferred: None }
3097    }
3098}
3099impl Default for UpdatePaymentMethodCardNetworks {
3100    fn default() -> Self {
3101        Self::new()
3102    }
3103}
3104/// The customer's preferred card network for co-branded cards.
3105/// Supports `cartes_bancaires`, `mastercard`, or `visa`.
3106/// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
3107#[derive(Clone, Eq, PartialEq)]
3108#[non_exhaustive]
3109pub enum UpdatePaymentMethodCardNetworksPreferred {
3110    CartesBancaires,
3111    Mastercard,
3112    Visa,
3113    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3114    Unknown(String),
3115}
3116impl UpdatePaymentMethodCardNetworksPreferred {
3117    pub fn as_str(&self) -> &str {
3118        use UpdatePaymentMethodCardNetworksPreferred::*;
3119        match self {
3120            CartesBancaires => "cartes_bancaires",
3121            Mastercard => "mastercard",
3122            Visa => "visa",
3123            Unknown(v) => v,
3124        }
3125    }
3126}
3127
3128impl std::str::FromStr for UpdatePaymentMethodCardNetworksPreferred {
3129    type Err = std::convert::Infallible;
3130    fn from_str(s: &str) -> Result<Self, Self::Err> {
3131        use UpdatePaymentMethodCardNetworksPreferred::*;
3132        match s {
3133            "cartes_bancaires" => Ok(CartesBancaires),
3134            "mastercard" => Ok(Mastercard),
3135            "visa" => Ok(Visa),
3136            v => {
3137                tracing::warn!(
3138                    "Unknown value '{}' for enum '{}'",
3139                    v,
3140                    "UpdatePaymentMethodCardNetworksPreferred"
3141                );
3142                Ok(Unknown(v.to_owned()))
3143            }
3144        }
3145    }
3146}
3147impl std::fmt::Display for UpdatePaymentMethodCardNetworksPreferred {
3148    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3149        f.write_str(self.as_str())
3150    }
3151}
3152
3153#[cfg(not(feature = "redact-generated-debug"))]
3154impl std::fmt::Debug for UpdatePaymentMethodCardNetworksPreferred {
3155    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3156        f.write_str(self.as_str())
3157    }
3158}
3159#[cfg(feature = "redact-generated-debug")]
3160impl std::fmt::Debug for UpdatePaymentMethodCardNetworksPreferred {
3161    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3162        f.debug_struct(stringify!(UpdatePaymentMethodCardNetworksPreferred)).finish_non_exhaustive()
3163    }
3164}
3165impl serde::Serialize for UpdatePaymentMethodCardNetworksPreferred {
3166    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3167    where
3168        S: serde::Serializer,
3169    {
3170        serializer.serialize_str(self.as_str())
3171    }
3172}
3173#[cfg(feature = "deserialize")]
3174impl<'de> serde::Deserialize<'de> for UpdatePaymentMethodCardNetworksPreferred {
3175    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3176        use std::str::FromStr;
3177        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3178        Ok(Self::from_str(&s).expect("infallible"))
3179    }
3180}
3181/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
3182#[derive(Clone, Eq, PartialEq)]
3183#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3184#[derive(serde::Serialize)]
3185pub struct UpdatePaymentMethodPayto {
3186    /// The account number for the bank account.
3187    #[serde(skip_serializing_if = "Option::is_none")]
3188    pub account_number: Option<String>,
3189    /// Bank-State-Branch number of the bank account.
3190    #[serde(skip_serializing_if = "Option::is_none")]
3191    pub bsb_number: Option<String>,
3192    /// The PayID alias for the bank account.
3193    #[serde(skip_serializing_if = "Option::is_none")]
3194    pub pay_id: Option<String>,
3195}
3196#[cfg(feature = "redact-generated-debug")]
3197impl std::fmt::Debug for UpdatePaymentMethodPayto {
3198    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3199        f.debug_struct("UpdatePaymentMethodPayto").finish_non_exhaustive()
3200    }
3201}
3202impl UpdatePaymentMethodPayto {
3203    pub fn new() -> Self {
3204        Self { account_number: None, bsb_number: None, pay_id: None }
3205    }
3206}
3207impl Default for UpdatePaymentMethodPayto {
3208    fn default() -> Self {
3209        Self::new()
3210    }
3211}
3212/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
3213#[derive(Clone, Eq, PartialEq)]
3214#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3215#[derive(serde::Serialize)]
3216pub struct UpdatePaymentMethodUsBankAccount {
3217    /// Bank account holder type.
3218    #[serde(skip_serializing_if = "Option::is_none")]
3219    pub account_holder_type: Option<UpdatePaymentMethodUsBankAccountAccountHolderType>,
3220    /// Bank account type.
3221    #[serde(skip_serializing_if = "Option::is_none")]
3222    pub account_type: Option<UpdatePaymentMethodUsBankAccountAccountType>,
3223}
3224#[cfg(feature = "redact-generated-debug")]
3225impl std::fmt::Debug for UpdatePaymentMethodUsBankAccount {
3226    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3227        f.debug_struct("UpdatePaymentMethodUsBankAccount").finish_non_exhaustive()
3228    }
3229}
3230impl UpdatePaymentMethodUsBankAccount {
3231    pub fn new() -> Self {
3232        Self { account_holder_type: None, account_type: None }
3233    }
3234}
3235impl Default for UpdatePaymentMethodUsBankAccount {
3236    fn default() -> Self {
3237        Self::new()
3238    }
3239}
3240/// Bank account holder type.
3241#[derive(Clone, Eq, PartialEq)]
3242#[non_exhaustive]
3243pub enum UpdatePaymentMethodUsBankAccountAccountHolderType {
3244    Company,
3245    Individual,
3246    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3247    Unknown(String),
3248}
3249impl UpdatePaymentMethodUsBankAccountAccountHolderType {
3250    pub fn as_str(&self) -> &str {
3251        use UpdatePaymentMethodUsBankAccountAccountHolderType::*;
3252        match self {
3253            Company => "company",
3254            Individual => "individual",
3255            Unknown(v) => v,
3256        }
3257    }
3258}
3259
3260impl std::str::FromStr for UpdatePaymentMethodUsBankAccountAccountHolderType {
3261    type Err = std::convert::Infallible;
3262    fn from_str(s: &str) -> Result<Self, Self::Err> {
3263        use UpdatePaymentMethodUsBankAccountAccountHolderType::*;
3264        match s {
3265            "company" => Ok(Company),
3266            "individual" => Ok(Individual),
3267            v => {
3268                tracing::warn!(
3269                    "Unknown value '{}' for enum '{}'",
3270                    v,
3271                    "UpdatePaymentMethodUsBankAccountAccountHolderType"
3272                );
3273                Ok(Unknown(v.to_owned()))
3274            }
3275        }
3276    }
3277}
3278impl std::fmt::Display for UpdatePaymentMethodUsBankAccountAccountHolderType {
3279    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3280        f.write_str(self.as_str())
3281    }
3282}
3283
3284#[cfg(not(feature = "redact-generated-debug"))]
3285impl std::fmt::Debug for UpdatePaymentMethodUsBankAccountAccountHolderType {
3286    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3287        f.write_str(self.as_str())
3288    }
3289}
3290#[cfg(feature = "redact-generated-debug")]
3291impl std::fmt::Debug for UpdatePaymentMethodUsBankAccountAccountHolderType {
3292    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3293        f.debug_struct(stringify!(UpdatePaymentMethodUsBankAccountAccountHolderType))
3294            .finish_non_exhaustive()
3295    }
3296}
3297impl serde::Serialize for UpdatePaymentMethodUsBankAccountAccountHolderType {
3298    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3299    where
3300        S: serde::Serializer,
3301    {
3302        serializer.serialize_str(self.as_str())
3303    }
3304}
3305#[cfg(feature = "deserialize")]
3306impl<'de> serde::Deserialize<'de> for UpdatePaymentMethodUsBankAccountAccountHolderType {
3307    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3308        use std::str::FromStr;
3309        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3310        Ok(Self::from_str(&s).expect("infallible"))
3311    }
3312}
3313/// Bank account type.
3314#[derive(Clone, Eq, PartialEq)]
3315#[non_exhaustive]
3316pub enum UpdatePaymentMethodUsBankAccountAccountType {
3317    Checking,
3318    Savings,
3319    /// An unrecognized value from Stripe. Should not be used as a request parameter.
3320    Unknown(String),
3321}
3322impl UpdatePaymentMethodUsBankAccountAccountType {
3323    pub fn as_str(&self) -> &str {
3324        use UpdatePaymentMethodUsBankAccountAccountType::*;
3325        match self {
3326            Checking => "checking",
3327            Savings => "savings",
3328            Unknown(v) => v,
3329        }
3330    }
3331}
3332
3333impl std::str::FromStr for UpdatePaymentMethodUsBankAccountAccountType {
3334    type Err = std::convert::Infallible;
3335    fn from_str(s: &str) -> Result<Self, Self::Err> {
3336        use UpdatePaymentMethodUsBankAccountAccountType::*;
3337        match s {
3338            "checking" => Ok(Checking),
3339            "savings" => Ok(Savings),
3340            v => {
3341                tracing::warn!(
3342                    "Unknown value '{}' for enum '{}'",
3343                    v,
3344                    "UpdatePaymentMethodUsBankAccountAccountType"
3345                );
3346                Ok(Unknown(v.to_owned()))
3347            }
3348        }
3349    }
3350}
3351impl std::fmt::Display for UpdatePaymentMethodUsBankAccountAccountType {
3352    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3353        f.write_str(self.as_str())
3354    }
3355}
3356
3357#[cfg(not(feature = "redact-generated-debug"))]
3358impl std::fmt::Debug for UpdatePaymentMethodUsBankAccountAccountType {
3359    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3360        f.write_str(self.as_str())
3361    }
3362}
3363#[cfg(feature = "redact-generated-debug")]
3364impl std::fmt::Debug for UpdatePaymentMethodUsBankAccountAccountType {
3365    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3366        f.debug_struct(stringify!(UpdatePaymentMethodUsBankAccountAccountType))
3367            .finish_non_exhaustive()
3368    }
3369}
3370impl serde::Serialize for UpdatePaymentMethodUsBankAccountAccountType {
3371    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
3372    where
3373        S: serde::Serializer,
3374    {
3375        serializer.serialize_str(self.as_str())
3376    }
3377}
3378#[cfg(feature = "deserialize")]
3379impl<'de> serde::Deserialize<'de> for UpdatePaymentMethodUsBankAccountAccountType {
3380    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
3381        use std::str::FromStr;
3382        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
3383        Ok(Self::from_str(&s).expect("infallible"))
3384    }
3385}
3386/// Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated.
3387#[derive(Clone)]
3388#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3389#[derive(serde::Serialize)]
3390pub struct UpdatePaymentMethod {
3391    inner: UpdatePaymentMethodBuilder,
3392    payment_method: stripe_shared::PaymentMethodId,
3393}
3394#[cfg(feature = "redact-generated-debug")]
3395impl std::fmt::Debug for UpdatePaymentMethod {
3396    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3397        f.debug_struct("UpdatePaymentMethod").finish_non_exhaustive()
3398    }
3399}
3400impl UpdatePaymentMethod {
3401    /// Construct a new `UpdatePaymentMethod`.
3402    pub fn new(payment_method: impl Into<stripe_shared::PaymentMethodId>) -> Self {
3403        Self { payment_method: payment_method.into(), inner: UpdatePaymentMethodBuilder::new() }
3404    }
3405    /// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
3406    /// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
3407    /// The field defaults to `unspecified`.
3408    pub fn allow_redisplay(
3409        mut self,
3410        allow_redisplay: impl Into<stripe_shared::PaymentMethodAllowRedisplay>,
3411    ) -> Self {
3412        self.inner.allow_redisplay = Some(allow_redisplay.into());
3413        self
3414    }
3415    /// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
3416    pub fn billing_details(
3417        mut self,
3418        billing_details: impl Into<BillingDetailsInnerParams>,
3419    ) -> Self {
3420        self.inner.billing_details = Some(billing_details.into());
3421        self
3422    }
3423    /// If this is a `card` PaymentMethod, this hash contains the user's card details.
3424    pub fn card(mut self, card: impl Into<UpdatePaymentMethodCard>) -> Self {
3425        self.inner.card = Some(card.into());
3426        self
3427    }
3428    /// Specifies which fields in the response should be expanded.
3429    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
3430        self.inner.expand = Some(expand.into());
3431        self
3432    }
3433    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
3434    /// This can be useful for storing additional information about the object in a structured format.
3435    /// Individual keys can be unset by posting an empty value to them.
3436    /// All keys can be unset by posting an empty value to `metadata`.
3437    pub fn metadata(
3438        mut self,
3439        metadata: impl Into<std::collections::HashMap<String, String>>,
3440    ) -> Self {
3441        self.inner.metadata = Some(metadata.into());
3442        self
3443    }
3444    /// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
3445    pub fn payto(mut self, payto: impl Into<UpdatePaymentMethodPayto>) -> Self {
3446        self.inner.payto = Some(payto.into());
3447        self
3448    }
3449    /// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
3450    pub fn us_bank_account(
3451        mut self,
3452        us_bank_account: impl Into<UpdatePaymentMethodUsBankAccount>,
3453    ) -> Self {
3454        self.inner.us_bank_account = Some(us_bank_account.into());
3455        self
3456    }
3457}
3458impl UpdatePaymentMethod {
3459    /// Send the request and return the deserialized response.
3460    pub async fn send<C: StripeClient>(
3461        &self,
3462        client: &C,
3463    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3464        self.customize().send(client).await
3465    }
3466
3467    /// Send the request and return the deserialized response, blocking until completion.
3468    pub fn send_blocking<C: StripeBlockingClient>(
3469        &self,
3470        client: &C,
3471    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3472        self.customize().send_blocking(client)
3473    }
3474}
3475
3476impl StripeRequest for UpdatePaymentMethod {
3477    type Output = stripe_shared::PaymentMethod;
3478
3479    fn build(&self) -> RequestBuilder {
3480        let payment_method = &self.payment_method;
3481        RequestBuilder::new(StripeMethod::Post, format!("/payment_methods/{payment_method}"))
3482            .form(&self.inner)
3483    }
3484}
3485#[derive(Clone, Eq, PartialEq)]
3486#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3487#[derive(serde::Serialize)]
3488struct AttachPaymentMethodBuilder {
3489    #[serde(skip_serializing_if = "Option::is_none")]
3490    customer: Option<String>,
3491    #[serde(skip_serializing_if = "Option::is_none")]
3492    customer_account: Option<String>,
3493    #[serde(skip_serializing_if = "Option::is_none")]
3494    expand: Option<Vec<String>>,
3495}
3496#[cfg(feature = "redact-generated-debug")]
3497impl std::fmt::Debug for AttachPaymentMethodBuilder {
3498    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3499        f.debug_struct("AttachPaymentMethodBuilder").finish_non_exhaustive()
3500    }
3501}
3502impl AttachPaymentMethodBuilder {
3503    fn new() -> Self {
3504        Self { customer: None, customer_account: None, expand: None }
3505    }
3506}
3507/// Attaches a PaymentMethod object to a Customer.
3508///
3509/// To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents).
3510/// or a PaymentIntent with [setup_future_usage](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-setup_future_usage).
3511/// These approaches will perform any necessary steps to set up the PaymentMethod for future payments.
3512/// Using the `/v1/payment_methods/:id/attach`.
3513/// endpoint without first using a SetupIntent or PaymentIntent with `setup_future_usage` does not optimize the PaymentMethod for.
3514/// future use, which makes later declines and payment friction more likely.
3515/// See [Optimizing cards for future payments](https://stripe.com/docs/payments/payment-intents#future-usage) for more information about setting up.
3516/// future payments.
3517///
3518/// To use this PaymentMethod as the default for invoice or subscription payments,
3519/// set <a href="/docs/api/customers/update#update_customer-invoice_settings-default_payment_method">`invoice_settings.default_payment_method`</a>,.
3520/// on the Customer to the PaymentMethod’s ID.
3521#[derive(Clone)]
3522#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3523#[derive(serde::Serialize)]
3524pub struct AttachPaymentMethod {
3525    inner: AttachPaymentMethodBuilder,
3526    payment_method: stripe_shared::PaymentMethodId,
3527}
3528#[cfg(feature = "redact-generated-debug")]
3529impl std::fmt::Debug for AttachPaymentMethod {
3530    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3531        f.debug_struct("AttachPaymentMethod").finish_non_exhaustive()
3532    }
3533}
3534impl AttachPaymentMethod {
3535    /// Construct a new `AttachPaymentMethod`.
3536    pub fn new(payment_method: impl Into<stripe_shared::PaymentMethodId>) -> Self {
3537        Self { payment_method: payment_method.into(), inner: AttachPaymentMethodBuilder::new() }
3538    }
3539    /// The ID of the customer to which to attach the PaymentMethod.
3540    pub fn customer(mut self, customer: impl Into<String>) -> Self {
3541        self.inner.customer = Some(customer.into());
3542        self
3543    }
3544    /// The ID of the Account representing the customer to which to attach the PaymentMethod.
3545    pub fn customer_account(mut self, customer_account: impl Into<String>) -> Self {
3546        self.inner.customer_account = Some(customer_account.into());
3547        self
3548    }
3549    /// Specifies which fields in the response should be expanded.
3550    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
3551        self.inner.expand = Some(expand.into());
3552        self
3553    }
3554}
3555impl AttachPaymentMethod {
3556    /// Send the request and return the deserialized response.
3557    pub async fn send<C: StripeClient>(
3558        &self,
3559        client: &C,
3560    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3561        self.customize().send(client).await
3562    }
3563
3564    /// Send the request and return the deserialized response, blocking until completion.
3565    pub fn send_blocking<C: StripeBlockingClient>(
3566        &self,
3567        client: &C,
3568    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3569        self.customize().send_blocking(client)
3570    }
3571}
3572
3573impl StripeRequest for AttachPaymentMethod {
3574    type Output = stripe_shared::PaymentMethod;
3575
3576    fn build(&self) -> RequestBuilder {
3577        let payment_method = &self.payment_method;
3578        RequestBuilder::new(StripeMethod::Post, format!("/payment_methods/{payment_method}/attach"))
3579            .form(&self.inner)
3580    }
3581}
3582#[derive(Clone, Eq, PartialEq)]
3583#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3584#[derive(serde::Serialize)]
3585struct DetachPaymentMethodBuilder {
3586    #[serde(skip_serializing_if = "Option::is_none")]
3587    expand: Option<Vec<String>>,
3588}
3589#[cfg(feature = "redact-generated-debug")]
3590impl std::fmt::Debug for DetachPaymentMethodBuilder {
3591    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3592        f.debug_struct("DetachPaymentMethodBuilder").finish_non_exhaustive()
3593    }
3594}
3595impl DetachPaymentMethodBuilder {
3596    fn new() -> Self {
3597        Self { expand: None }
3598    }
3599}
3600/// Detaches a PaymentMethod object from a Customer.
3601/// After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.
3602#[derive(Clone)]
3603#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3604#[derive(serde::Serialize)]
3605pub struct DetachPaymentMethod {
3606    inner: DetachPaymentMethodBuilder,
3607    payment_method: stripe_shared::PaymentMethodId,
3608}
3609#[cfg(feature = "redact-generated-debug")]
3610impl std::fmt::Debug for DetachPaymentMethod {
3611    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3612        f.debug_struct("DetachPaymentMethod").finish_non_exhaustive()
3613    }
3614}
3615impl DetachPaymentMethod {
3616    /// Construct a new `DetachPaymentMethod`.
3617    pub fn new(payment_method: impl Into<stripe_shared::PaymentMethodId>) -> Self {
3618        Self { payment_method: payment_method.into(), inner: DetachPaymentMethodBuilder::new() }
3619    }
3620    /// Specifies which fields in the response should be expanded.
3621    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
3622        self.inner.expand = Some(expand.into());
3623        self
3624    }
3625}
3626impl DetachPaymentMethod {
3627    /// Send the request and return the deserialized response.
3628    pub async fn send<C: StripeClient>(
3629        &self,
3630        client: &C,
3631    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3632        self.customize().send(client).await
3633    }
3634
3635    /// Send the request and return the deserialized response, blocking until completion.
3636    pub fn send_blocking<C: StripeBlockingClient>(
3637        &self,
3638        client: &C,
3639    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
3640        self.customize().send_blocking(client)
3641    }
3642}
3643
3644impl StripeRequest for DetachPaymentMethod {
3645    type Output = stripe_shared::PaymentMethod;
3646
3647    fn build(&self) -> RequestBuilder {
3648        let payment_method = &self.payment_method;
3649        RequestBuilder::new(StripeMethod::Post, format!("/payment_methods/{payment_method}/detach"))
3650            .form(&self.inner)
3651    }
3652}
3653
3654#[derive(Clone, Eq, PartialEq)]
3655#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3656#[derive(serde::Serialize)]
3657pub struct BillingDetailsAddress {
3658    /// City, district, suburb, town, or village.
3659    #[serde(skip_serializing_if = "Option::is_none")]
3660    pub city: Option<String>,
3661    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
3662    #[serde(skip_serializing_if = "Option::is_none")]
3663    pub country: Option<String>,
3664    /// Address line 1, such as the street, PO Box, or company name.
3665    #[serde(skip_serializing_if = "Option::is_none")]
3666    pub line1: Option<String>,
3667    /// Address line 2, such as the apartment, suite, unit, or building.
3668    #[serde(skip_serializing_if = "Option::is_none")]
3669    pub line2: Option<String>,
3670    /// ZIP or postal code.
3671    #[serde(skip_serializing_if = "Option::is_none")]
3672    pub postal_code: Option<String>,
3673    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
3674    #[serde(skip_serializing_if = "Option::is_none")]
3675    pub state: Option<String>,
3676}
3677#[cfg(feature = "redact-generated-debug")]
3678impl std::fmt::Debug for BillingDetailsAddress {
3679    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3680        f.debug_struct("BillingDetailsAddress").finish_non_exhaustive()
3681    }
3682}
3683impl BillingDetailsAddress {
3684    pub fn new() -> Self {
3685        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
3686    }
3687}
3688impl Default for BillingDetailsAddress {
3689    fn default() -> Self {
3690        Self::new()
3691    }
3692}
3693#[derive(Clone, Eq, PartialEq)]
3694#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
3695#[derive(serde::Serialize)]
3696pub struct BillingDetailsInnerParams {
3697    /// Billing address.
3698    #[serde(skip_serializing_if = "Option::is_none")]
3699    pub address: Option<BillingDetailsAddress>,
3700    /// Email address.
3701    #[serde(skip_serializing_if = "Option::is_none")]
3702    pub email: Option<String>,
3703    /// Full name.
3704    #[serde(skip_serializing_if = "Option::is_none")]
3705    pub name: Option<String>,
3706    /// Billing phone number (including extension).
3707    #[serde(skip_serializing_if = "Option::is_none")]
3708    pub phone: Option<String>,
3709    /// Taxpayer identification number.
3710    /// Used only for transactions between LATAM buyers and non-LATAM sellers.
3711    #[serde(skip_serializing_if = "Option::is_none")]
3712    pub tax_id: Option<String>,
3713}
3714#[cfg(feature = "redact-generated-debug")]
3715impl std::fmt::Debug for BillingDetailsInnerParams {
3716    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3717        f.debug_struct("BillingDetailsInnerParams").finish_non_exhaustive()
3718    }
3719}
3720impl BillingDetailsInnerParams {
3721    pub fn new() -> Self {
3722        Self { address: None, email: None, name: None, phone: None, tax_id: None }
3723    }
3724}
3725impl Default for BillingDetailsInnerParams {
3726    fn default() -> Self {
3727        Self::new()
3728    }
3729}