stripe_core/token/
requests.rs

1use stripe_client_core::{
2    RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
3};
4
5#[derive(Clone, Debug, serde::Serialize)]
6struct RetrieveTokenBuilder {
7    #[serde(skip_serializing_if = "Option::is_none")]
8    expand: Option<Vec<String>>,
9}
10impl RetrieveTokenBuilder {
11    fn new() -> Self {
12        Self { expand: None }
13    }
14}
15/// Retrieves the token with the given ID.
16#[derive(Clone, Debug, serde::Serialize)]
17pub struct RetrieveToken {
18    inner: RetrieveTokenBuilder,
19    token: stripe_core::TokenId,
20}
21impl RetrieveToken {
22    /// Construct a new `RetrieveToken`.
23    pub fn new(token: impl Into<stripe_core::TokenId>) -> Self {
24        Self { token: token.into(), inner: RetrieveTokenBuilder::new() }
25    }
26    /// Specifies which fields in the response should be expanded.
27    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
28        self.inner.expand = Some(expand.into());
29        self
30    }
31}
32impl RetrieveToken {
33    /// Send the request and return the deserialized response.
34    pub async fn send<C: StripeClient>(
35        &self,
36        client: &C,
37    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
38        self.customize().send(client).await
39    }
40
41    /// Send the request and return the deserialized response, blocking until completion.
42    pub fn send_blocking<C: StripeBlockingClient>(
43        &self,
44        client: &C,
45    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
46        self.customize().send_blocking(client)
47    }
48}
49
50impl StripeRequest for RetrieveToken {
51    type Output = stripe_core::Token;
52
53    fn build(&self) -> RequestBuilder {
54        let token = &self.token;
55        RequestBuilder::new(StripeMethod::Get, format!("/tokens/{token}")).query(&self.inner)
56    }
57}
58#[derive(Clone, Debug, serde::Serialize)]
59struct CreateTokenBuilder {
60    #[serde(skip_serializing_if = "Option::is_none")]
61    account: Option<CreateTokenAccount>,
62    #[serde(skip_serializing_if = "Option::is_none")]
63    bank_account: Option<CreateTokenBankAccount>,
64    #[serde(skip_serializing_if = "Option::is_none")]
65    card: Option<CreateTokenCard>,
66    #[serde(skip_serializing_if = "Option::is_none")]
67    customer: Option<String>,
68    #[serde(skip_serializing_if = "Option::is_none")]
69    cvc_update: Option<CreateTokenCvcUpdate>,
70    #[serde(skip_serializing_if = "Option::is_none")]
71    expand: Option<Vec<String>>,
72    #[serde(skip_serializing_if = "Option::is_none")]
73    person: Option<CreateTokenPerson>,
74    #[serde(skip_serializing_if = "Option::is_none")]
75    pii: Option<CreateTokenPii>,
76}
77impl CreateTokenBuilder {
78    fn new() -> Self {
79        Self {
80            account: None,
81            bank_account: None,
82            card: None,
83            customer: None,
84            cvc_update: None,
85            expand: None,
86            person: None,
87            pii: None,
88        }
89    }
90}
91/// Information for the account this token represents.
92#[derive(Clone, Debug, serde::Serialize)]
93pub struct CreateTokenAccount {
94    /// The business type.
95    #[serde(skip_serializing_if = "Option::is_none")]
96    pub business_type: Option<CreateTokenAccountBusinessType>,
97    /// Information about the company or business.
98    #[serde(skip_serializing_if = "Option::is_none")]
99    pub company: Option<CreateTokenAccountCompany>,
100    /// Information about the person represented by the account.
101    #[serde(skip_serializing_if = "Option::is_none")]
102    pub individual: Option<CreateTokenAccountIndividual>,
103    /// Whether the user described by the data in the token has been shown [the Stripe Connected Account Agreement](/connect/account-tokens#stripe-connected-account-agreement).
104    /// When creating an account token to create a new Connect account, this value must be `true`.
105    #[serde(skip_serializing_if = "Option::is_none")]
106    pub tos_shown_and_accepted: Option<bool>,
107}
108impl CreateTokenAccount {
109    pub fn new() -> Self {
110        Self { business_type: None, company: None, individual: None, tos_shown_and_accepted: None }
111    }
112}
113impl Default for CreateTokenAccount {
114    fn default() -> Self {
115        Self::new()
116    }
117}
118/// The business type.
119#[derive(Clone, Eq, PartialEq)]
120#[non_exhaustive]
121pub enum CreateTokenAccountBusinessType {
122    Company,
123    GovernmentEntity,
124    Individual,
125    NonProfit,
126    /// An unrecognized value from Stripe. Should not be used as a request parameter.
127    Unknown(String),
128}
129impl CreateTokenAccountBusinessType {
130    pub fn as_str(&self) -> &str {
131        use CreateTokenAccountBusinessType::*;
132        match self {
133            Company => "company",
134            GovernmentEntity => "government_entity",
135            Individual => "individual",
136            NonProfit => "non_profit",
137            Unknown(v) => v,
138        }
139    }
140}
141
142impl std::str::FromStr for CreateTokenAccountBusinessType {
143    type Err = std::convert::Infallible;
144    fn from_str(s: &str) -> Result<Self, Self::Err> {
145        use CreateTokenAccountBusinessType::*;
146        match s {
147            "company" => Ok(Company),
148            "government_entity" => Ok(GovernmentEntity),
149            "individual" => Ok(Individual),
150            "non_profit" => Ok(NonProfit),
151            v => {
152                tracing::warn!(
153                    "Unknown value '{}' for enum '{}'",
154                    v,
155                    "CreateTokenAccountBusinessType"
156                );
157                Ok(Unknown(v.to_owned()))
158            }
159        }
160    }
161}
162impl std::fmt::Display for CreateTokenAccountBusinessType {
163    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
164        f.write_str(self.as_str())
165    }
166}
167
168impl std::fmt::Debug for CreateTokenAccountBusinessType {
169    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
170        f.write_str(self.as_str())
171    }
172}
173impl serde::Serialize for CreateTokenAccountBusinessType {
174    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
175    where
176        S: serde::Serializer,
177    {
178        serializer.serialize_str(self.as_str())
179    }
180}
181#[cfg(feature = "deserialize")]
182impl<'de> serde::Deserialize<'de> for CreateTokenAccountBusinessType {
183    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
184        use std::str::FromStr;
185        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
186        Ok(Self::from_str(&s).expect("infallible"))
187    }
188}
189/// Information about the company or business.
190#[derive(Clone, Debug, serde::Serialize)]
191pub struct CreateTokenAccountCompany {
192    /// The company's primary address.
193    #[serde(skip_serializing_if = "Option::is_none")]
194    pub address: Option<CreateTokenAccountCompanyAddress>,
195    /// The Kana variation of the company's primary address (Japan only).
196    #[serde(skip_serializing_if = "Option::is_none")]
197    pub address_kana: Option<CreateTokenAccountCompanyAddressKana>,
198    /// The Kanji variation of the company's primary address (Japan only).
199    #[serde(skip_serializing_if = "Option::is_none")]
200    pub address_kanji: Option<CreateTokenAccountCompanyAddressKanji>,
201    /// Whether the company's directors have been provided.
202    /// Set this Boolean to `true` after creating all the company's directors with [the Persons API](/api/persons) for accounts with a `relationship.director` requirement.
203    /// This value is not automatically set to `true` after creating directors, so it needs to be updated to indicate all directors have been provided.
204    #[serde(skip_serializing_if = "Option::is_none")]
205    pub directors_provided: Option<bool>,
206    /// This hash is used to attest that the directors information provided to Stripe is both current and correct.
207    #[serde(skip_serializing_if = "Option::is_none")]
208    pub directorship_declaration: Option<CreateTokenAccountCompanyDirectorshipDeclaration>,
209    /// Whether the company's executives have been provided.
210    /// Set this Boolean to `true` after creating all the company's executives with [the Persons API](/api/persons) for accounts with a `relationship.executive` requirement.
211    #[serde(skip_serializing_if = "Option::is_none")]
212    pub executives_provided: Option<bool>,
213    /// The export license ID number of the company, also referred as Import Export Code (India only).
214    #[serde(skip_serializing_if = "Option::is_none")]
215    pub export_license_id: Option<String>,
216    /// The purpose code to use for export transactions (India only).
217    #[serde(skip_serializing_if = "Option::is_none")]
218    pub export_purpose_code: Option<String>,
219    /// The company's legal name.
220    #[serde(skip_serializing_if = "Option::is_none")]
221    pub name: Option<String>,
222    /// The Kana variation of the company's legal name (Japan only).
223    #[serde(skip_serializing_if = "Option::is_none")]
224    pub name_kana: Option<String>,
225    /// The Kanji variation of the company's legal name (Japan only).
226    #[serde(skip_serializing_if = "Option::is_none")]
227    pub name_kanji: Option<String>,
228    /// Whether the company's owners have been provided.
229    /// Set this Boolean to `true` after creating all the company's owners with [the Persons API](/api/persons) for accounts with a `relationship.owner` requirement.
230    #[serde(skip_serializing_if = "Option::is_none")]
231    pub owners_provided: Option<bool>,
232    /// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
233    #[serde(skip_serializing_if = "Option::is_none")]
234    pub ownership_declaration: Option<CreateTokenAccountCompanyOwnershipDeclaration>,
235    /// Whether the user described by the data in the token has been shown the Ownership Declaration and indicated that it is correct.
236    #[serde(skip_serializing_if = "Option::is_none")]
237    pub ownership_declaration_shown_and_signed: Option<bool>,
238    /// This value is used to determine if a business is exempt from providing ultimate beneficial owners.
239    /// See [this support article](https://support.stripe.com/questions/exemption-from-providing-ownership-details) and [changelog](https://docs.stripe.com/changelog/acacia/2025-01-27/ownership-exemption-reason-accounts-api) for more details.
240    #[serde(skip_serializing_if = "Option::is_none")]
241    pub ownership_exemption_reason: Option<CreateTokenAccountCompanyOwnershipExemptionReason>,
242    /// The company's phone number (used for verification).
243    #[serde(skip_serializing_if = "Option::is_none")]
244    pub phone: Option<String>,
245    /// When the business was incorporated or registered.
246    #[serde(skip_serializing_if = "Option::is_none")]
247    pub registration_date: Option<CreateTokenAccountCompanyRegistrationDate>,
248    /// The identification number given to a company when it is registered or incorporated, if distinct from the identification number used for filing taxes.
249    /// (Examples are the CIN for companies and LLP IN for partnerships in India, and the Company Registration Number in Hong Kong).
250    #[serde(skip_serializing_if = "Option::is_none")]
251    pub registration_number: Option<String>,
252    /// This hash is used to attest that the representative is authorized to act as the representative of their legal entity.
253    #[serde(skip_serializing_if = "Option::is_none")]
254    pub representative_declaration: Option<CreateTokenAccountCompanyRepresentativeDeclaration>,
255    /// The category identifying the legal structure of the company or legal entity.
256    /// See [Business structure](/connect/identity-verification#business-structure) for more details.
257    /// Pass an empty string to unset this value.
258    #[serde(skip_serializing_if = "Option::is_none")]
259    pub structure: Option<CreateTokenAccountCompanyStructure>,
260    /// The business ID number of the company, as appropriate for the company’s country.
261    /// (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.).
262    #[serde(skip_serializing_if = "Option::is_none")]
263    pub tax_id: Option<String>,
264    /// The jurisdiction in which the `tax_id` is registered (Germany-based companies only).
265    #[serde(skip_serializing_if = "Option::is_none")]
266    pub tax_id_registrar: Option<String>,
267    /// The VAT number of the company.
268    #[serde(skip_serializing_if = "Option::is_none")]
269    pub vat_id: Option<String>,
270    /// Information on the verification state of the company.
271    #[serde(skip_serializing_if = "Option::is_none")]
272    pub verification: Option<CreateTokenAccountCompanyVerification>,
273}
274impl CreateTokenAccountCompany {
275    pub fn new() -> Self {
276        Self {
277            address: None,
278            address_kana: None,
279            address_kanji: None,
280            directors_provided: None,
281            directorship_declaration: None,
282            executives_provided: None,
283            export_license_id: None,
284            export_purpose_code: None,
285            name: None,
286            name_kana: None,
287            name_kanji: None,
288            owners_provided: None,
289            ownership_declaration: None,
290            ownership_declaration_shown_and_signed: None,
291            ownership_exemption_reason: None,
292            phone: None,
293            registration_date: None,
294            registration_number: None,
295            representative_declaration: None,
296            structure: None,
297            tax_id: None,
298            tax_id_registrar: None,
299            vat_id: None,
300            verification: None,
301        }
302    }
303}
304impl Default for CreateTokenAccountCompany {
305    fn default() -> Self {
306        Self::new()
307    }
308}
309/// The company's primary address.
310#[derive(Clone, Debug, serde::Serialize)]
311pub struct CreateTokenAccountCompanyAddress {
312    /// City, district, suburb, town, or village.
313    #[serde(skip_serializing_if = "Option::is_none")]
314    pub city: Option<String>,
315    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
316    #[serde(skip_serializing_if = "Option::is_none")]
317    pub country: Option<String>,
318    /// Address line 1, such as the street, PO Box, or company name.
319    #[serde(skip_serializing_if = "Option::is_none")]
320    pub line1: Option<String>,
321    /// Address line 2, such as the apartment, suite, unit, or building.
322    #[serde(skip_serializing_if = "Option::is_none")]
323    pub line2: Option<String>,
324    /// ZIP or postal code.
325    #[serde(skip_serializing_if = "Option::is_none")]
326    pub postal_code: Option<String>,
327    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
328    #[serde(skip_serializing_if = "Option::is_none")]
329    pub state: Option<String>,
330}
331impl CreateTokenAccountCompanyAddress {
332    pub fn new() -> Self {
333        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
334    }
335}
336impl Default for CreateTokenAccountCompanyAddress {
337    fn default() -> Self {
338        Self::new()
339    }
340}
341/// The Kana variation of the company's primary address (Japan only).
342#[derive(Clone, Debug, serde::Serialize)]
343pub struct CreateTokenAccountCompanyAddressKana {
344    /// City or ward.
345    #[serde(skip_serializing_if = "Option::is_none")]
346    pub city: Option<String>,
347    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
348    #[serde(skip_serializing_if = "Option::is_none")]
349    pub country: Option<String>,
350    /// Block or building number.
351    #[serde(skip_serializing_if = "Option::is_none")]
352    pub line1: Option<String>,
353    /// Building details.
354    #[serde(skip_serializing_if = "Option::is_none")]
355    pub line2: Option<String>,
356    /// Postal code.
357    #[serde(skip_serializing_if = "Option::is_none")]
358    pub postal_code: Option<String>,
359    /// Prefecture.
360    #[serde(skip_serializing_if = "Option::is_none")]
361    pub state: Option<String>,
362    /// Town or cho-me.
363    #[serde(skip_serializing_if = "Option::is_none")]
364    pub town: Option<String>,
365}
366impl CreateTokenAccountCompanyAddressKana {
367    pub fn new() -> Self {
368        Self {
369            city: None,
370            country: None,
371            line1: None,
372            line2: None,
373            postal_code: None,
374            state: None,
375            town: None,
376        }
377    }
378}
379impl Default for CreateTokenAccountCompanyAddressKana {
380    fn default() -> Self {
381        Self::new()
382    }
383}
384/// The Kanji variation of the company's primary address (Japan only).
385#[derive(Clone, Debug, serde::Serialize)]
386pub struct CreateTokenAccountCompanyAddressKanji {
387    /// City or ward.
388    #[serde(skip_serializing_if = "Option::is_none")]
389    pub city: Option<String>,
390    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
391    #[serde(skip_serializing_if = "Option::is_none")]
392    pub country: Option<String>,
393    /// Block or building number.
394    #[serde(skip_serializing_if = "Option::is_none")]
395    pub line1: Option<String>,
396    /// Building details.
397    #[serde(skip_serializing_if = "Option::is_none")]
398    pub line2: Option<String>,
399    /// Postal code.
400    #[serde(skip_serializing_if = "Option::is_none")]
401    pub postal_code: Option<String>,
402    /// Prefecture.
403    #[serde(skip_serializing_if = "Option::is_none")]
404    pub state: Option<String>,
405    /// Town or cho-me.
406    #[serde(skip_serializing_if = "Option::is_none")]
407    pub town: Option<String>,
408}
409impl CreateTokenAccountCompanyAddressKanji {
410    pub fn new() -> Self {
411        Self {
412            city: None,
413            country: None,
414            line1: None,
415            line2: None,
416            postal_code: None,
417            state: None,
418            town: None,
419        }
420    }
421}
422impl Default for CreateTokenAccountCompanyAddressKanji {
423    fn default() -> Self {
424        Self::new()
425    }
426}
427/// This hash is used to attest that the directors information provided to Stripe is both current and correct.
428#[derive(Clone, Debug, serde::Serialize)]
429pub struct CreateTokenAccountCompanyDirectorshipDeclaration {
430    /// The Unix timestamp marking when the directorship declaration attestation was made.
431    #[serde(skip_serializing_if = "Option::is_none")]
432    pub date: Option<stripe_types::Timestamp>,
433    /// The IP address from which the directorship declaration attestation was made.
434    #[serde(skip_serializing_if = "Option::is_none")]
435    pub ip: Option<String>,
436    /// The user agent of the browser from which the directorship declaration attestation was made.
437    #[serde(skip_serializing_if = "Option::is_none")]
438    pub user_agent: Option<String>,
439}
440impl CreateTokenAccountCompanyDirectorshipDeclaration {
441    pub fn new() -> Self {
442        Self { date: None, ip: None, user_agent: None }
443    }
444}
445impl Default for CreateTokenAccountCompanyDirectorshipDeclaration {
446    fn default() -> Self {
447        Self::new()
448    }
449}
450/// This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.
451#[derive(Clone, Debug, serde::Serialize)]
452pub struct CreateTokenAccountCompanyOwnershipDeclaration {
453    /// The Unix timestamp marking when the beneficial owner attestation was made.
454    #[serde(skip_serializing_if = "Option::is_none")]
455    pub date: Option<stripe_types::Timestamp>,
456    /// The IP address from which the beneficial owner attestation was made.
457    #[serde(skip_serializing_if = "Option::is_none")]
458    pub ip: Option<String>,
459    /// The user agent of the browser from which the beneficial owner attestation was made.
460    #[serde(skip_serializing_if = "Option::is_none")]
461    pub user_agent: Option<String>,
462}
463impl CreateTokenAccountCompanyOwnershipDeclaration {
464    pub fn new() -> Self {
465        Self { date: None, ip: None, user_agent: None }
466    }
467}
468impl Default for CreateTokenAccountCompanyOwnershipDeclaration {
469    fn default() -> Self {
470        Self::new()
471    }
472}
473/// This value is used to determine if a business is exempt from providing ultimate beneficial owners.
474/// See [this support article](https://support.stripe.com/questions/exemption-from-providing-ownership-details) and [changelog](https://docs.stripe.com/changelog/acacia/2025-01-27/ownership-exemption-reason-accounts-api) for more details.
475#[derive(Clone, Eq, PartialEq)]
476#[non_exhaustive]
477pub enum CreateTokenAccountCompanyOwnershipExemptionReason {
478    QualifiedEntityExceedsOwnershipThreshold,
479    QualifiesAsFinancialInstitution,
480    /// An unrecognized value from Stripe. Should not be used as a request parameter.
481    Unknown(String),
482}
483impl CreateTokenAccountCompanyOwnershipExemptionReason {
484    pub fn as_str(&self) -> &str {
485        use CreateTokenAccountCompanyOwnershipExemptionReason::*;
486        match self {
487            QualifiedEntityExceedsOwnershipThreshold => {
488                "qualified_entity_exceeds_ownership_threshold"
489            }
490            QualifiesAsFinancialInstitution => "qualifies_as_financial_institution",
491            Unknown(v) => v,
492        }
493    }
494}
495
496impl std::str::FromStr for CreateTokenAccountCompanyOwnershipExemptionReason {
497    type Err = std::convert::Infallible;
498    fn from_str(s: &str) -> Result<Self, Self::Err> {
499        use CreateTokenAccountCompanyOwnershipExemptionReason::*;
500        match s {
501            "qualified_entity_exceeds_ownership_threshold" => {
502                Ok(QualifiedEntityExceedsOwnershipThreshold)
503            }
504            "qualifies_as_financial_institution" => Ok(QualifiesAsFinancialInstitution),
505            v => {
506                tracing::warn!(
507                    "Unknown value '{}' for enum '{}'",
508                    v,
509                    "CreateTokenAccountCompanyOwnershipExemptionReason"
510                );
511                Ok(Unknown(v.to_owned()))
512            }
513        }
514    }
515}
516impl std::fmt::Display for CreateTokenAccountCompanyOwnershipExemptionReason {
517    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
518        f.write_str(self.as_str())
519    }
520}
521
522impl std::fmt::Debug for CreateTokenAccountCompanyOwnershipExemptionReason {
523    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
524        f.write_str(self.as_str())
525    }
526}
527impl serde::Serialize for CreateTokenAccountCompanyOwnershipExemptionReason {
528    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
529    where
530        S: serde::Serializer,
531    {
532        serializer.serialize_str(self.as_str())
533    }
534}
535#[cfg(feature = "deserialize")]
536impl<'de> serde::Deserialize<'de> for CreateTokenAccountCompanyOwnershipExemptionReason {
537    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
538        use std::str::FromStr;
539        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
540        Ok(Self::from_str(&s).expect("infallible"))
541    }
542}
543/// When the business was incorporated or registered.
544#[derive(Copy, Clone, Debug, serde::Serialize)]
545pub struct CreateTokenAccountCompanyRegistrationDate {
546    /// The day of registration, between 1 and 31.
547    pub day: i64,
548    /// The month of registration, between 1 and 12.
549    pub month: i64,
550    /// The four-digit year of registration.
551    pub year: i64,
552}
553impl CreateTokenAccountCompanyRegistrationDate {
554    pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
555        Self { day: day.into(), month: month.into(), year: year.into() }
556    }
557}
558/// This hash is used to attest that the representative is authorized to act as the representative of their legal entity.
559#[derive(Clone, Debug, serde::Serialize)]
560pub struct CreateTokenAccountCompanyRepresentativeDeclaration {
561    /// The Unix timestamp marking when the representative declaration attestation was made.
562    #[serde(skip_serializing_if = "Option::is_none")]
563    pub date: Option<stripe_types::Timestamp>,
564    /// The IP address from which the representative declaration attestation was made.
565    #[serde(skip_serializing_if = "Option::is_none")]
566    pub ip: Option<String>,
567    /// The user agent of the browser from which the representative declaration attestation was made.
568    #[serde(skip_serializing_if = "Option::is_none")]
569    pub user_agent: Option<String>,
570}
571impl CreateTokenAccountCompanyRepresentativeDeclaration {
572    pub fn new() -> Self {
573        Self { date: None, ip: None, user_agent: None }
574    }
575}
576impl Default for CreateTokenAccountCompanyRepresentativeDeclaration {
577    fn default() -> Self {
578        Self::new()
579    }
580}
581/// The category identifying the legal structure of the company or legal entity.
582/// See [Business structure](/connect/identity-verification#business-structure) for more details.
583/// Pass an empty string to unset this value.
584#[derive(Clone, Eq, PartialEq)]
585#[non_exhaustive]
586pub enum CreateTokenAccountCompanyStructure {
587    FreeZoneEstablishment,
588    FreeZoneLlc,
589    GovernmentInstrumentality,
590    GovernmentalUnit,
591    IncorporatedNonProfit,
592    IncorporatedPartnership,
593    LimitedLiabilityPartnership,
594    Llc,
595    MultiMemberLlc,
596    PrivateCompany,
597    PrivateCorporation,
598    PrivatePartnership,
599    PublicCompany,
600    PublicCorporation,
601    PublicPartnership,
602    RegisteredCharity,
603    SingleMemberLlc,
604    SoleEstablishment,
605    SoleProprietorship,
606    TaxExemptGovernmentInstrumentality,
607    UnincorporatedAssociation,
608    UnincorporatedNonProfit,
609    UnincorporatedPartnership,
610    /// An unrecognized value from Stripe. Should not be used as a request parameter.
611    Unknown(String),
612}
613impl CreateTokenAccountCompanyStructure {
614    pub fn as_str(&self) -> &str {
615        use CreateTokenAccountCompanyStructure::*;
616        match self {
617            FreeZoneEstablishment => "free_zone_establishment",
618            FreeZoneLlc => "free_zone_llc",
619            GovernmentInstrumentality => "government_instrumentality",
620            GovernmentalUnit => "governmental_unit",
621            IncorporatedNonProfit => "incorporated_non_profit",
622            IncorporatedPartnership => "incorporated_partnership",
623            LimitedLiabilityPartnership => "limited_liability_partnership",
624            Llc => "llc",
625            MultiMemberLlc => "multi_member_llc",
626            PrivateCompany => "private_company",
627            PrivateCorporation => "private_corporation",
628            PrivatePartnership => "private_partnership",
629            PublicCompany => "public_company",
630            PublicCorporation => "public_corporation",
631            PublicPartnership => "public_partnership",
632            RegisteredCharity => "registered_charity",
633            SingleMemberLlc => "single_member_llc",
634            SoleEstablishment => "sole_establishment",
635            SoleProprietorship => "sole_proprietorship",
636            TaxExemptGovernmentInstrumentality => "tax_exempt_government_instrumentality",
637            UnincorporatedAssociation => "unincorporated_association",
638            UnincorporatedNonProfit => "unincorporated_non_profit",
639            UnincorporatedPartnership => "unincorporated_partnership",
640            Unknown(v) => v,
641        }
642    }
643}
644
645impl std::str::FromStr for CreateTokenAccountCompanyStructure {
646    type Err = std::convert::Infallible;
647    fn from_str(s: &str) -> Result<Self, Self::Err> {
648        use CreateTokenAccountCompanyStructure::*;
649        match s {
650            "free_zone_establishment" => Ok(FreeZoneEstablishment),
651            "free_zone_llc" => Ok(FreeZoneLlc),
652            "government_instrumentality" => Ok(GovernmentInstrumentality),
653            "governmental_unit" => Ok(GovernmentalUnit),
654            "incorporated_non_profit" => Ok(IncorporatedNonProfit),
655            "incorporated_partnership" => Ok(IncorporatedPartnership),
656            "limited_liability_partnership" => Ok(LimitedLiabilityPartnership),
657            "llc" => Ok(Llc),
658            "multi_member_llc" => Ok(MultiMemberLlc),
659            "private_company" => Ok(PrivateCompany),
660            "private_corporation" => Ok(PrivateCorporation),
661            "private_partnership" => Ok(PrivatePartnership),
662            "public_company" => Ok(PublicCompany),
663            "public_corporation" => Ok(PublicCorporation),
664            "public_partnership" => Ok(PublicPartnership),
665            "registered_charity" => Ok(RegisteredCharity),
666            "single_member_llc" => Ok(SingleMemberLlc),
667            "sole_establishment" => Ok(SoleEstablishment),
668            "sole_proprietorship" => Ok(SoleProprietorship),
669            "tax_exempt_government_instrumentality" => Ok(TaxExemptGovernmentInstrumentality),
670            "unincorporated_association" => Ok(UnincorporatedAssociation),
671            "unincorporated_non_profit" => Ok(UnincorporatedNonProfit),
672            "unincorporated_partnership" => Ok(UnincorporatedPartnership),
673            v => {
674                tracing::warn!(
675                    "Unknown value '{}' for enum '{}'",
676                    v,
677                    "CreateTokenAccountCompanyStructure"
678                );
679                Ok(Unknown(v.to_owned()))
680            }
681        }
682    }
683}
684impl std::fmt::Display for CreateTokenAccountCompanyStructure {
685    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
686        f.write_str(self.as_str())
687    }
688}
689
690impl std::fmt::Debug for CreateTokenAccountCompanyStructure {
691    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
692        f.write_str(self.as_str())
693    }
694}
695impl serde::Serialize for CreateTokenAccountCompanyStructure {
696    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
697    where
698        S: serde::Serializer,
699    {
700        serializer.serialize_str(self.as_str())
701    }
702}
703#[cfg(feature = "deserialize")]
704impl<'de> serde::Deserialize<'de> for CreateTokenAccountCompanyStructure {
705    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
706        use std::str::FromStr;
707        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
708        Ok(Self::from_str(&s).expect("infallible"))
709    }
710}
711/// Information on the verification state of the company.
712#[derive(Clone, Debug, serde::Serialize)]
713pub struct CreateTokenAccountCompanyVerification {
714    /// A document verifying the business.
715    #[serde(skip_serializing_if = "Option::is_none")]
716    pub document: Option<CreateTokenAccountCompanyVerificationDocument>,
717}
718impl CreateTokenAccountCompanyVerification {
719    pub fn new() -> Self {
720        Self { document: None }
721    }
722}
723impl Default for CreateTokenAccountCompanyVerification {
724    fn default() -> Self {
725        Self::new()
726    }
727}
728/// A document verifying the business.
729#[derive(Clone, Debug, serde::Serialize)]
730pub struct CreateTokenAccountCompanyVerificationDocument {
731    /// The back of a document returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `additional_verification`.
732    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
733    #[serde(skip_serializing_if = "Option::is_none")]
734    pub back: Option<String>,
735    /// The front of a document returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `additional_verification`.
736    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
737    #[serde(skip_serializing_if = "Option::is_none")]
738    pub front: Option<String>,
739}
740impl CreateTokenAccountCompanyVerificationDocument {
741    pub fn new() -> Self {
742        Self { back: None, front: None }
743    }
744}
745impl Default for CreateTokenAccountCompanyVerificationDocument {
746    fn default() -> Self {
747        Self::new()
748    }
749}
750/// Information about the person represented by the account.
751#[derive(Clone, Debug, serde::Serialize)]
752pub struct CreateTokenAccountIndividual {
753    /// The individual's primary address.
754    #[serde(skip_serializing_if = "Option::is_none")]
755    pub address: Option<CreateTokenAccountIndividualAddress>,
756    /// The Kana variation of the individual's primary address (Japan only).
757    #[serde(skip_serializing_if = "Option::is_none")]
758    pub address_kana: Option<CreateTokenAccountIndividualAddressKana>,
759    /// The Kanji variation of the individual's primary address (Japan only).
760    #[serde(skip_serializing_if = "Option::is_none")]
761    pub address_kanji: Option<CreateTokenAccountIndividualAddressKanji>,
762    /// The individual's date of birth.
763    #[serde(skip_serializing_if = "Option::is_none")]
764    pub dob: Option<DateOfBirthSpecs>,
765    /// The individual's email address.
766    #[serde(skip_serializing_if = "Option::is_none")]
767    pub email: Option<String>,
768    /// The individual's first name.
769    #[serde(skip_serializing_if = "Option::is_none")]
770    pub first_name: Option<String>,
771    /// The Kana variation of the individual's first name (Japan only).
772    #[serde(skip_serializing_if = "Option::is_none")]
773    pub first_name_kana: Option<String>,
774    /// The Kanji variation of the individual's first name (Japan only).
775    #[serde(skip_serializing_if = "Option::is_none")]
776    pub first_name_kanji: Option<String>,
777    /// A list of alternate names or aliases that the individual is known by.
778    #[serde(skip_serializing_if = "Option::is_none")]
779    pub full_name_aliases: Option<Vec<String>>,
780    /// The individual's gender
781    #[serde(skip_serializing_if = "Option::is_none")]
782    pub gender: Option<String>,
783    /// The government-issued ID number of the individual, as appropriate for the representative's country.
784    /// (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada).
785    /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](/js/tokens/create_token?type=pii).
786    #[serde(skip_serializing_if = "Option::is_none")]
787    pub id_number: Option<String>,
788    /// The government-issued secondary ID number of the individual, as appropriate for the representative's country, will be used for enhanced verification checks.
789    /// In Thailand, this would be the laser code found on the back of an ID card.
790    /// Instead of the number itself, you can also provide a [PII token created with Stripe.js](/js/tokens/create_token?type=pii).
791    #[serde(skip_serializing_if = "Option::is_none")]
792    pub id_number_secondary: Option<String>,
793    /// The individual's last name.
794    #[serde(skip_serializing_if = "Option::is_none")]
795    pub last_name: Option<String>,
796    /// The Kana variation of the individual's last name (Japan only).
797    #[serde(skip_serializing_if = "Option::is_none")]
798    pub last_name_kana: Option<String>,
799    /// The Kanji variation of the individual's last name (Japan only).
800    #[serde(skip_serializing_if = "Option::is_none")]
801    pub last_name_kanji: Option<String>,
802    /// The individual's maiden name.
803    #[serde(skip_serializing_if = "Option::is_none")]
804    pub maiden_name: Option<String>,
805    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
806    /// This can be useful for storing additional information about the object in a structured format.
807    /// Individual keys can be unset by posting an empty value to them.
808    /// All keys can be unset by posting an empty value to `metadata`.
809    #[serde(skip_serializing_if = "Option::is_none")]
810    pub metadata: Option<std::collections::HashMap<String, String>>,
811    /// The individual's phone number.
812    #[serde(skip_serializing_if = "Option::is_none")]
813    pub phone: Option<String>,
814    /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
815    #[serde(skip_serializing_if = "Option::is_none")]
816    pub political_exposure: Option<CreateTokenAccountIndividualPoliticalExposure>,
817    /// The individual's registered address.
818    #[serde(skip_serializing_if = "Option::is_none")]
819    pub registered_address: Option<CreateTokenAccountIndividualRegisteredAddress>,
820    /// Describes the person’s relationship to the account.
821    #[serde(skip_serializing_if = "Option::is_none")]
822    pub relationship: Option<CreateTokenAccountIndividualRelationship>,
823    /// The last four digits of the individual's Social Security Number (U.S. only).
824    #[serde(skip_serializing_if = "Option::is_none")]
825    pub ssn_last_4: Option<String>,
826    /// The individual's verification document information.
827    #[serde(skip_serializing_if = "Option::is_none")]
828    pub verification: Option<PersonVerificationSpecs>,
829}
830impl CreateTokenAccountIndividual {
831    pub fn new() -> Self {
832        Self {
833            address: None,
834            address_kana: None,
835            address_kanji: None,
836            dob: None,
837            email: None,
838            first_name: None,
839            first_name_kana: None,
840            first_name_kanji: None,
841            full_name_aliases: None,
842            gender: None,
843            id_number: None,
844            id_number_secondary: None,
845            last_name: None,
846            last_name_kana: None,
847            last_name_kanji: None,
848            maiden_name: None,
849            metadata: None,
850            phone: None,
851            political_exposure: None,
852            registered_address: None,
853            relationship: None,
854            ssn_last_4: None,
855            verification: None,
856        }
857    }
858}
859impl Default for CreateTokenAccountIndividual {
860    fn default() -> Self {
861        Self::new()
862    }
863}
864/// The individual's primary address.
865#[derive(Clone, Debug, serde::Serialize)]
866pub struct CreateTokenAccountIndividualAddress {
867    /// City, district, suburb, town, or village.
868    #[serde(skip_serializing_if = "Option::is_none")]
869    pub city: Option<String>,
870    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
871    #[serde(skip_serializing_if = "Option::is_none")]
872    pub country: Option<String>,
873    /// Address line 1, such as the street, PO Box, or company name.
874    #[serde(skip_serializing_if = "Option::is_none")]
875    pub line1: Option<String>,
876    /// Address line 2, such as the apartment, suite, unit, or building.
877    #[serde(skip_serializing_if = "Option::is_none")]
878    pub line2: Option<String>,
879    /// ZIP or postal code.
880    #[serde(skip_serializing_if = "Option::is_none")]
881    pub postal_code: Option<String>,
882    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
883    #[serde(skip_serializing_if = "Option::is_none")]
884    pub state: Option<String>,
885}
886impl CreateTokenAccountIndividualAddress {
887    pub fn new() -> Self {
888        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
889    }
890}
891impl Default for CreateTokenAccountIndividualAddress {
892    fn default() -> Self {
893        Self::new()
894    }
895}
896/// The Kana variation of the individual's primary address (Japan only).
897#[derive(Clone, Debug, serde::Serialize)]
898pub struct CreateTokenAccountIndividualAddressKana {
899    /// City or ward.
900    #[serde(skip_serializing_if = "Option::is_none")]
901    pub city: Option<String>,
902    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
903    #[serde(skip_serializing_if = "Option::is_none")]
904    pub country: Option<String>,
905    /// Block or building number.
906    #[serde(skip_serializing_if = "Option::is_none")]
907    pub line1: Option<String>,
908    /// Building details.
909    #[serde(skip_serializing_if = "Option::is_none")]
910    pub line2: Option<String>,
911    /// Postal code.
912    #[serde(skip_serializing_if = "Option::is_none")]
913    pub postal_code: Option<String>,
914    /// Prefecture.
915    #[serde(skip_serializing_if = "Option::is_none")]
916    pub state: Option<String>,
917    /// Town or cho-me.
918    #[serde(skip_serializing_if = "Option::is_none")]
919    pub town: Option<String>,
920}
921impl CreateTokenAccountIndividualAddressKana {
922    pub fn new() -> Self {
923        Self {
924            city: None,
925            country: None,
926            line1: None,
927            line2: None,
928            postal_code: None,
929            state: None,
930            town: None,
931        }
932    }
933}
934impl Default for CreateTokenAccountIndividualAddressKana {
935    fn default() -> Self {
936        Self::new()
937    }
938}
939/// The Kanji variation of the individual's primary address (Japan only).
940#[derive(Clone, Debug, serde::Serialize)]
941pub struct CreateTokenAccountIndividualAddressKanji {
942    /// City or ward.
943    #[serde(skip_serializing_if = "Option::is_none")]
944    pub city: Option<String>,
945    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
946    #[serde(skip_serializing_if = "Option::is_none")]
947    pub country: Option<String>,
948    /// Block or building number.
949    #[serde(skip_serializing_if = "Option::is_none")]
950    pub line1: Option<String>,
951    /// Building details.
952    #[serde(skip_serializing_if = "Option::is_none")]
953    pub line2: Option<String>,
954    /// Postal code.
955    #[serde(skip_serializing_if = "Option::is_none")]
956    pub postal_code: Option<String>,
957    /// Prefecture.
958    #[serde(skip_serializing_if = "Option::is_none")]
959    pub state: Option<String>,
960    /// Town or cho-me.
961    #[serde(skip_serializing_if = "Option::is_none")]
962    pub town: Option<String>,
963}
964impl CreateTokenAccountIndividualAddressKanji {
965    pub fn new() -> Self {
966        Self {
967            city: None,
968            country: None,
969            line1: None,
970            line2: None,
971            postal_code: None,
972            state: None,
973            town: None,
974        }
975    }
976}
977impl Default for CreateTokenAccountIndividualAddressKanji {
978    fn default() -> Self {
979        Self::new()
980    }
981}
982/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
983#[derive(Clone, Eq, PartialEq)]
984#[non_exhaustive]
985pub enum CreateTokenAccountIndividualPoliticalExposure {
986    Existing,
987    None,
988    /// An unrecognized value from Stripe. Should not be used as a request parameter.
989    Unknown(String),
990}
991impl CreateTokenAccountIndividualPoliticalExposure {
992    pub fn as_str(&self) -> &str {
993        use CreateTokenAccountIndividualPoliticalExposure::*;
994        match self {
995            Existing => "existing",
996            None => "none",
997            Unknown(v) => v,
998        }
999    }
1000}
1001
1002impl std::str::FromStr for CreateTokenAccountIndividualPoliticalExposure {
1003    type Err = std::convert::Infallible;
1004    fn from_str(s: &str) -> Result<Self, Self::Err> {
1005        use CreateTokenAccountIndividualPoliticalExposure::*;
1006        match s {
1007            "existing" => Ok(Existing),
1008            "none" => Ok(None),
1009            v => {
1010                tracing::warn!(
1011                    "Unknown value '{}' for enum '{}'",
1012                    v,
1013                    "CreateTokenAccountIndividualPoliticalExposure"
1014                );
1015                Ok(Unknown(v.to_owned()))
1016            }
1017        }
1018    }
1019}
1020impl std::fmt::Display for CreateTokenAccountIndividualPoliticalExposure {
1021    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1022        f.write_str(self.as_str())
1023    }
1024}
1025
1026impl std::fmt::Debug for CreateTokenAccountIndividualPoliticalExposure {
1027    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1028        f.write_str(self.as_str())
1029    }
1030}
1031impl serde::Serialize for CreateTokenAccountIndividualPoliticalExposure {
1032    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1033    where
1034        S: serde::Serializer,
1035    {
1036        serializer.serialize_str(self.as_str())
1037    }
1038}
1039#[cfg(feature = "deserialize")]
1040impl<'de> serde::Deserialize<'de> for CreateTokenAccountIndividualPoliticalExposure {
1041    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1042        use std::str::FromStr;
1043        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1044        Ok(Self::from_str(&s).expect("infallible"))
1045    }
1046}
1047/// The individual's registered address.
1048#[derive(Clone, Debug, serde::Serialize)]
1049pub struct CreateTokenAccountIndividualRegisteredAddress {
1050    /// City, district, suburb, town, or village.
1051    #[serde(skip_serializing_if = "Option::is_none")]
1052    pub city: Option<String>,
1053    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1054    #[serde(skip_serializing_if = "Option::is_none")]
1055    pub country: Option<String>,
1056    /// Address line 1, such as the street, PO Box, or company name.
1057    #[serde(skip_serializing_if = "Option::is_none")]
1058    pub line1: Option<String>,
1059    /// Address line 2, such as the apartment, suite, unit, or building.
1060    #[serde(skip_serializing_if = "Option::is_none")]
1061    pub line2: Option<String>,
1062    /// ZIP or postal code.
1063    #[serde(skip_serializing_if = "Option::is_none")]
1064    pub postal_code: Option<String>,
1065    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
1066    #[serde(skip_serializing_if = "Option::is_none")]
1067    pub state: Option<String>,
1068}
1069impl CreateTokenAccountIndividualRegisteredAddress {
1070    pub fn new() -> Self {
1071        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
1072    }
1073}
1074impl Default for CreateTokenAccountIndividualRegisteredAddress {
1075    fn default() -> Self {
1076        Self::new()
1077    }
1078}
1079/// Describes the person’s relationship to the account.
1080#[derive(Clone, Debug, serde::Serialize)]
1081pub struct CreateTokenAccountIndividualRelationship {
1082    /// Whether the person is a director of the account's legal entity.
1083    /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations.
1084    #[serde(skip_serializing_if = "Option::is_none")]
1085    pub director: Option<bool>,
1086    /// Whether the person has significant responsibility to control, manage, or direct the organization.
1087    #[serde(skip_serializing_if = "Option::is_none")]
1088    pub executive: Option<bool>,
1089    /// Whether the person is an owner of the account’s legal entity.
1090    #[serde(skip_serializing_if = "Option::is_none")]
1091    pub owner: Option<bool>,
1092    /// The percent owned by the person of the account's legal entity.
1093    #[serde(skip_serializing_if = "Option::is_none")]
1094    pub percent_ownership: Option<f64>,
1095    /// The person's title (e.g., CEO, Support Engineer).
1096    #[serde(skip_serializing_if = "Option::is_none")]
1097    pub title: Option<String>,
1098}
1099impl CreateTokenAccountIndividualRelationship {
1100    pub fn new() -> Self {
1101        Self { director: None, executive: None, owner: None, percent_ownership: None, title: None }
1102    }
1103}
1104impl Default for CreateTokenAccountIndividualRelationship {
1105    fn default() -> Self {
1106        Self::new()
1107    }
1108}
1109/// The bank account this token will represent.
1110#[derive(Clone, Debug, serde::Serialize)]
1111pub struct CreateTokenBankAccount {
1112    /// The name of the person or business that owns the bank account.
1113    /// This field is required when attaching the bank account to a `Customer` object.
1114    #[serde(skip_serializing_if = "Option::is_none")]
1115    pub account_holder_name: Option<String>,
1116    /// The type of entity that holds the account.
1117    /// It can be `company` or `individual`.
1118    /// This field is required when attaching the bank account to a `Customer` object.
1119    #[serde(skip_serializing_if = "Option::is_none")]
1120    pub account_holder_type: Option<CreateTokenBankAccountAccountHolderType>,
1121    /// The account number for the bank account, in string form. Must be a checking account.
1122    pub account_number: String,
1123    /// The bank account type.
1124    /// This can only be `checking` or `savings` in most countries.
1125    /// In Japan, this can only be `futsu` or `toza`.
1126    #[serde(skip_serializing_if = "Option::is_none")]
1127    pub account_type: Option<CreateTokenBankAccountAccountType>,
1128    /// The country in which the bank account is located.
1129    pub country: String,
1130    /// The currency the bank account is in.
1131    /// This must be a country/currency pairing that [Stripe supports.](https://docs.stripe.com/payouts).
1132    #[serde(skip_serializing_if = "Option::is_none")]
1133    pub currency: Option<stripe_types::Currency>,
1134    /// The ID of a Payment Method with a `type` of `us_bank_account`.
1135    /// The Payment Method's bank account information will be copied and returned as a Bank Account Token.
1136    /// This parameter is exclusive with respect to all other parameters in the `bank_account` hash.
1137    /// You must include the top-level `customer` parameter if the Payment Method is attached to a `Customer` object.
1138    /// If the Payment Method is not attached to a `Customer` object, it will be consumed and cannot be used again.
1139    /// You may not use Payment Methods which were created by a Setup Intent with `attach_to_self=true`.
1140    #[serde(skip_serializing_if = "Option::is_none")]
1141    pub payment_method: Option<String>,
1142    /// The routing number, sort code, or other country-appropriate institution number for the bank account.
1143    /// For US bank accounts, this is required and should be the ACH routing number, not the wire routing number.
1144    /// If you are providing an IBAN for `account_number`, this field is not required.
1145    #[serde(skip_serializing_if = "Option::is_none")]
1146    pub routing_number: Option<String>,
1147}
1148impl CreateTokenBankAccount {
1149    pub fn new(account_number: impl Into<String>, country: impl Into<String>) -> Self {
1150        Self {
1151            account_holder_name: None,
1152            account_holder_type: None,
1153            account_number: account_number.into(),
1154            account_type: None,
1155            country: country.into(),
1156            currency: None,
1157            payment_method: None,
1158            routing_number: None,
1159        }
1160    }
1161}
1162/// The type of entity that holds the account.
1163/// It can be `company` or `individual`.
1164/// This field is required when attaching the bank account to a `Customer` object.
1165#[derive(Clone, Eq, PartialEq)]
1166#[non_exhaustive]
1167pub enum CreateTokenBankAccountAccountHolderType {
1168    Company,
1169    Individual,
1170    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1171    Unknown(String),
1172}
1173impl CreateTokenBankAccountAccountHolderType {
1174    pub fn as_str(&self) -> &str {
1175        use CreateTokenBankAccountAccountHolderType::*;
1176        match self {
1177            Company => "company",
1178            Individual => "individual",
1179            Unknown(v) => v,
1180        }
1181    }
1182}
1183
1184impl std::str::FromStr for CreateTokenBankAccountAccountHolderType {
1185    type Err = std::convert::Infallible;
1186    fn from_str(s: &str) -> Result<Self, Self::Err> {
1187        use CreateTokenBankAccountAccountHolderType::*;
1188        match s {
1189            "company" => Ok(Company),
1190            "individual" => Ok(Individual),
1191            v => {
1192                tracing::warn!(
1193                    "Unknown value '{}' for enum '{}'",
1194                    v,
1195                    "CreateTokenBankAccountAccountHolderType"
1196                );
1197                Ok(Unknown(v.to_owned()))
1198            }
1199        }
1200    }
1201}
1202impl std::fmt::Display for CreateTokenBankAccountAccountHolderType {
1203    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1204        f.write_str(self.as_str())
1205    }
1206}
1207
1208impl std::fmt::Debug for CreateTokenBankAccountAccountHolderType {
1209    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1210        f.write_str(self.as_str())
1211    }
1212}
1213impl serde::Serialize for CreateTokenBankAccountAccountHolderType {
1214    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1215    where
1216        S: serde::Serializer,
1217    {
1218        serializer.serialize_str(self.as_str())
1219    }
1220}
1221#[cfg(feature = "deserialize")]
1222impl<'de> serde::Deserialize<'de> for CreateTokenBankAccountAccountHolderType {
1223    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1224        use std::str::FromStr;
1225        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1226        Ok(Self::from_str(&s).expect("infallible"))
1227    }
1228}
1229/// The bank account type.
1230/// This can only be `checking` or `savings` in most countries.
1231/// In Japan, this can only be `futsu` or `toza`.
1232#[derive(Clone, Eq, PartialEq)]
1233#[non_exhaustive]
1234pub enum CreateTokenBankAccountAccountType {
1235    Checking,
1236    Futsu,
1237    Savings,
1238    Toza,
1239    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1240    Unknown(String),
1241}
1242impl CreateTokenBankAccountAccountType {
1243    pub fn as_str(&self) -> &str {
1244        use CreateTokenBankAccountAccountType::*;
1245        match self {
1246            Checking => "checking",
1247            Futsu => "futsu",
1248            Savings => "savings",
1249            Toza => "toza",
1250            Unknown(v) => v,
1251        }
1252    }
1253}
1254
1255impl std::str::FromStr for CreateTokenBankAccountAccountType {
1256    type Err = std::convert::Infallible;
1257    fn from_str(s: &str) -> Result<Self, Self::Err> {
1258        use CreateTokenBankAccountAccountType::*;
1259        match s {
1260            "checking" => Ok(Checking),
1261            "futsu" => Ok(Futsu),
1262            "savings" => Ok(Savings),
1263            "toza" => Ok(Toza),
1264            v => {
1265                tracing::warn!(
1266                    "Unknown value '{}' for enum '{}'",
1267                    v,
1268                    "CreateTokenBankAccountAccountType"
1269                );
1270                Ok(Unknown(v.to_owned()))
1271            }
1272        }
1273    }
1274}
1275impl std::fmt::Display for CreateTokenBankAccountAccountType {
1276    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1277        f.write_str(self.as_str())
1278    }
1279}
1280
1281impl std::fmt::Debug for CreateTokenBankAccountAccountType {
1282    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1283        f.write_str(self.as_str())
1284    }
1285}
1286impl serde::Serialize for CreateTokenBankAccountAccountType {
1287    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1288    where
1289        S: serde::Serializer,
1290    {
1291        serializer.serialize_str(self.as_str())
1292    }
1293}
1294#[cfg(feature = "deserialize")]
1295impl<'de> serde::Deserialize<'de> for CreateTokenBankAccountAccountType {
1296    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1297        use std::str::FromStr;
1298        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1299        Ok(Self::from_str(&s).expect("infallible"))
1300    }
1301}
1302/// The card this token will represent.
1303/// If you also pass in a customer, the card must be the ID of a card belonging to the customer.
1304/// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
1305#[derive(Clone, Debug, serde::Serialize)]
1306#[serde(rename_all = "snake_case")]
1307pub enum CreateTokenCard {
1308    #[serde(untagged)]
1309    CreditCardSpecs(CreateTokenCreditCardSpecs),
1310    #[serde(untagged)]
1311    String(String),
1312}
1313/// The card this token will represent.
1314/// If you also pass in a customer, the card must be the ID of a card belonging to the customer.
1315/// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
1316#[derive(Clone, Debug, serde::Serialize)]
1317pub struct CreateTokenCreditCardSpecs {
1318    /// City / District / Suburb / Town / Village.
1319    #[serde(skip_serializing_if = "Option::is_none")]
1320    pub address_city: Option<String>,
1321    /// Billing address country, if provided.
1322    #[serde(skip_serializing_if = "Option::is_none")]
1323    pub address_country: Option<String>,
1324    /// Address line 1 (Street address / PO Box / Company name).
1325    #[serde(skip_serializing_if = "Option::is_none")]
1326    pub address_line1: Option<String>,
1327    /// Address line 2 (Apartment / Suite / Unit / Building).
1328    #[serde(skip_serializing_if = "Option::is_none")]
1329    pub address_line2: Option<String>,
1330    /// State / County / Province / Region.
1331    #[serde(skip_serializing_if = "Option::is_none")]
1332    pub address_state: Option<String>,
1333    /// ZIP or postal code.
1334    #[serde(skip_serializing_if = "Option::is_none")]
1335    pub address_zip: Option<String>,
1336    /// Required in order to add the card to an account; in all other cases, this parameter is not used.
1337    /// When added to an account, the card (which must be a debit card) can be used as a transfer destination for funds in this currency.
1338    #[serde(skip_serializing_if = "Option::is_none")]
1339    pub currency: Option<stripe_types::Currency>,
1340    /// Card security code. Highly recommended to always include this value.
1341    #[serde(skip_serializing_if = "Option::is_none")]
1342    pub cvc: Option<String>,
1343    /// Two-digit number representing the card's expiration month.
1344    pub exp_month: String,
1345    /// Two- or four-digit number representing the card's expiration year.
1346    pub exp_year: String,
1347    /// Cardholder's full name.
1348    #[serde(skip_serializing_if = "Option::is_none")]
1349    pub name: Option<String>,
1350    /// Contains information about card networks used to process the payment.
1351    #[serde(skip_serializing_if = "Option::is_none")]
1352    pub networks: Option<CreateTokenCreditCardSpecsNetworks>,
1353    /// The card number, as a string without any separators.
1354    pub number: String,
1355}
1356impl CreateTokenCreditCardSpecs {
1357    pub fn new(
1358        exp_month: impl Into<String>,
1359        exp_year: impl Into<String>,
1360        number: impl Into<String>,
1361    ) -> Self {
1362        Self {
1363            address_city: None,
1364            address_country: None,
1365            address_line1: None,
1366            address_line2: None,
1367            address_state: None,
1368            address_zip: None,
1369            currency: None,
1370            cvc: None,
1371            exp_month: exp_month.into(),
1372            exp_year: exp_year.into(),
1373            name: None,
1374            networks: None,
1375            number: number.into(),
1376        }
1377    }
1378}
1379/// Contains information about card networks used to process the payment.
1380#[derive(Clone, Debug, serde::Serialize)]
1381pub struct CreateTokenCreditCardSpecsNetworks {
1382    /// The customer's preferred card network for co-branded cards.
1383    /// Supports `cartes_bancaires`, `mastercard`, or `visa`.
1384    /// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
1385    #[serde(skip_serializing_if = "Option::is_none")]
1386    pub preferred: Option<CreateTokenCreditCardSpecsNetworksPreferred>,
1387}
1388impl CreateTokenCreditCardSpecsNetworks {
1389    pub fn new() -> Self {
1390        Self { preferred: None }
1391    }
1392}
1393impl Default for CreateTokenCreditCardSpecsNetworks {
1394    fn default() -> Self {
1395        Self::new()
1396    }
1397}
1398/// The customer's preferred card network for co-branded cards.
1399/// Supports `cartes_bancaires`, `mastercard`, or `visa`.
1400/// Selection of a network that does not apply to the card will be stored as `invalid_preference` on the card.
1401#[derive(Clone, Eq, PartialEq)]
1402#[non_exhaustive]
1403pub enum CreateTokenCreditCardSpecsNetworksPreferred {
1404    CartesBancaires,
1405    Mastercard,
1406    Visa,
1407    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1408    Unknown(String),
1409}
1410impl CreateTokenCreditCardSpecsNetworksPreferred {
1411    pub fn as_str(&self) -> &str {
1412        use CreateTokenCreditCardSpecsNetworksPreferred::*;
1413        match self {
1414            CartesBancaires => "cartes_bancaires",
1415            Mastercard => "mastercard",
1416            Visa => "visa",
1417            Unknown(v) => v,
1418        }
1419    }
1420}
1421
1422impl std::str::FromStr for CreateTokenCreditCardSpecsNetworksPreferred {
1423    type Err = std::convert::Infallible;
1424    fn from_str(s: &str) -> Result<Self, Self::Err> {
1425        use CreateTokenCreditCardSpecsNetworksPreferred::*;
1426        match s {
1427            "cartes_bancaires" => Ok(CartesBancaires),
1428            "mastercard" => Ok(Mastercard),
1429            "visa" => Ok(Visa),
1430            v => {
1431                tracing::warn!(
1432                    "Unknown value '{}' for enum '{}'",
1433                    v,
1434                    "CreateTokenCreditCardSpecsNetworksPreferred"
1435                );
1436                Ok(Unknown(v.to_owned()))
1437            }
1438        }
1439    }
1440}
1441impl std::fmt::Display for CreateTokenCreditCardSpecsNetworksPreferred {
1442    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1443        f.write_str(self.as_str())
1444    }
1445}
1446
1447impl std::fmt::Debug for CreateTokenCreditCardSpecsNetworksPreferred {
1448    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1449        f.write_str(self.as_str())
1450    }
1451}
1452impl serde::Serialize for CreateTokenCreditCardSpecsNetworksPreferred {
1453    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1454    where
1455        S: serde::Serializer,
1456    {
1457        serializer.serialize_str(self.as_str())
1458    }
1459}
1460#[cfg(feature = "deserialize")]
1461impl<'de> serde::Deserialize<'de> for CreateTokenCreditCardSpecsNetworksPreferred {
1462    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1463        use std::str::FromStr;
1464        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1465        Ok(Self::from_str(&s).expect("infallible"))
1466    }
1467}
1468/// The updated CVC value this token represents.
1469#[derive(Clone, Debug, serde::Serialize)]
1470pub struct CreateTokenCvcUpdate {
1471    /// The CVC value, in string form.
1472    pub cvc: String,
1473}
1474impl CreateTokenCvcUpdate {
1475    pub fn new(cvc: impl Into<String>) -> Self {
1476        Self { cvc: cvc.into() }
1477    }
1478}
1479/// Information for the person this token represents.
1480#[derive(Clone, Debug, serde::Serialize)]
1481pub struct CreateTokenPerson {
1482    /// Details on the legal guardian's or authorizer's acceptance of the required Stripe agreements.
1483    #[serde(skip_serializing_if = "Option::is_none")]
1484    pub additional_tos_acceptances: Option<CreateTokenPersonAdditionalTosAcceptances>,
1485    /// The person's address.
1486    #[serde(skip_serializing_if = "Option::is_none")]
1487    pub address: Option<CreateTokenPersonAddress>,
1488    /// The Kana variation of the person's address (Japan only).
1489    #[serde(skip_serializing_if = "Option::is_none")]
1490    pub address_kana: Option<CreateTokenPersonAddressKana>,
1491    /// The Kanji variation of the person's address (Japan only).
1492    #[serde(skip_serializing_if = "Option::is_none")]
1493    pub address_kanji: Option<CreateTokenPersonAddressKanji>,
1494    /// The person's date of birth.
1495    #[serde(skip_serializing_if = "Option::is_none")]
1496    pub dob: Option<DateOfBirthSpecs>,
1497    /// Documents that may be submitted to satisfy various informational requests.
1498    #[serde(skip_serializing_if = "Option::is_none")]
1499    pub documents: Option<CreateTokenPersonDocuments>,
1500    /// The person's email address.
1501    #[serde(skip_serializing_if = "Option::is_none")]
1502    pub email: Option<String>,
1503    /// The person's first name.
1504    #[serde(skip_serializing_if = "Option::is_none")]
1505    pub first_name: Option<String>,
1506    /// The Kana variation of the person's first name (Japan only).
1507    #[serde(skip_serializing_if = "Option::is_none")]
1508    pub first_name_kana: Option<String>,
1509    /// The Kanji variation of the person's first name (Japan only).
1510    #[serde(skip_serializing_if = "Option::is_none")]
1511    pub first_name_kanji: Option<String>,
1512    /// A list of alternate names or aliases that the person is known by.
1513    #[serde(skip_serializing_if = "Option::is_none")]
1514    pub full_name_aliases: Option<Vec<String>>,
1515    /// The person's gender (International regulations require either "male" or "female").
1516    #[serde(skip_serializing_if = "Option::is_none")]
1517    pub gender: Option<String>,
1518    /// The person's ID number, as appropriate for their country.
1519    /// For example, a social security number in the U.S., social insurance number in Canada, etc.
1520    /// Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://docs.stripe.com/js/tokens/create_token?type=pii).
1521    #[serde(skip_serializing_if = "Option::is_none")]
1522    pub id_number: Option<String>,
1523    /// The person's secondary ID number, as appropriate for their country, will be used for enhanced verification checks.
1524    /// In Thailand, this would be the laser code found on the back of an ID card.
1525    /// Instead of the number itself, you can also provide a [PII token provided by Stripe.js](https://docs.stripe.com/js/tokens/create_token?type=pii).
1526    #[serde(skip_serializing_if = "Option::is_none")]
1527    pub id_number_secondary: Option<String>,
1528    /// The person's last name.
1529    #[serde(skip_serializing_if = "Option::is_none")]
1530    pub last_name: Option<String>,
1531    /// The Kana variation of the person's last name (Japan only).
1532    #[serde(skip_serializing_if = "Option::is_none")]
1533    pub last_name_kana: Option<String>,
1534    /// The Kanji variation of the person's last name (Japan only).
1535    #[serde(skip_serializing_if = "Option::is_none")]
1536    pub last_name_kanji: Option<String>,
1537    /// The person's maiden name.
1538    #[serde(skip_serializing_if = "Option::is_none")]
1539    pub maiden_name: Option<String>,
1540    /// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
1541    /// This can be useful for storing additional information about the object in a structured format.
1542    /// Individual keys can be unset by posting an empty value to them.
1543    /// All keys can be unset by posting an empty value to `metadata`.
1544    #[serde(skip_serializing_if = "Option::is_none")]
1545    pub metadata: Option<std::collections::HashMap<String, String>>,
1546    /// The country where the person is a national.
1547    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)), or "XX" if unavailable.
1548    #[serde(skip_serializing_if = "Option::is_none")]
1549    pub nationality: Option<String>,
1550    /// The person's phone number.
1551    #[serde(skip_serializing_if = "Option::is_none")]
1552    pub phone: Option<String>,
1553    /// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
1554    #[serde(skip_serializing_if = "Option::is_none")]
1555    pub political_exposure: Option<CreateTokenPersonPoliticalExposure>,
1556    /// The person's registered address.
1557    #[serde(skip_serializing_if = "Option::is_none")]
1558    pub registered_address: Option<CreateTokenPersonRegisteredAddress>,
1559    /// The relationship that this person has with the account's legal entity.
1560    #[serde(skip_serializing_if = "Option::is_none")]
1561    pub relationship: Option<CreateTokenPersonRelationship>,
1562    /// The last four digits of the person's Social Security number (U.S. only).
1563    #[serde(skip_serializing_if = "Option::is_none")]
1564    pub ssn_last_4: Option<String>,
1565    /// Demographic data related to the person.
1566    #[serde(skip_serializing_if = "Option::is_none")]
1567    pub us_cfpb_data: Option<CreateTokenPersonUsCfpbData>,
1568    /// The person's verification status.
1569    #[serde(skip_serializing_if = "Option::is_none")]
1570    pub verification: Option<PersonVerificationSpecs>,
1571}
1572impl CreateTokenPerson {
1573    pub fn new() -> Self {
1574        Self {
1575            additional_tos_acceptances: None,
1576            address: None,
1577            address_kana: None,
1578            address_kanji: None,
1579            dob: None,
1580            documents: None,
1581            email: None,
1582            first_name: None,
1583            first_name_kana: None,
1584            first_name_kanji: None,
1585            full_name_aliases: None,
1586            gender: None,
1587            id_number: None,
1588            id_number_secondary: None,
1589            last_name: None,
1590            last_name_kana: None,
1591            last_name_kanji: None,
1592            maiden_name: None,
1593            metadata: None,
1594            nationality: None,
1595            phone: None,
1596            political_exposure: None,
1597            registered_address: None,
1598            relationship: None,
1599            ssn_last_4: None,
1600            us_cfpb_data: None,
1601            verification: None,
1602        }
1603    }
1604}
1605impl Default for CreateTokenPerson {
1606    fn default() -> Self {
1607        Self::new()
1608    }
1609}
1610/// Details on the legal guardian's or authorizer's acceptance of the required Stripe agreements.
1611#[derive(Clone, Debug, serde::Serialize)]
1612pub struct CreateTokenPersonAdditionalTosAcceptances {
1613    /// Details on the legal guardian's acceptance of the main Stripe service agreement.
1614    #[serde(skip_serializing_if = "Option::is_none")]
1615    pub account: Option<CreateTokenPersonAdditionalTosAcceptancesAccount>,
1616}
1617impl CreateTokenPersonAdditionalTosAcceptances {
1618    pub fn new() -> Self {
1619        Self { account: None }
1620    }
1621}
1622impl Default for CreateTokenPersonAdditionalTosAcceptances {
1623    fn default() -> Self {
1624        Self::new()
1625    }
1626}
1627/// Details on the legal guardian's acceptance of the main Stripe service agreement.
1628#[derive(Clone, Debug, serde::Serialize)]
1629pub struct CreateTokenPersonAdditionalTosAcceptancesAccount {
1630    /// The Unix timestamp marking when the account representative accepted the service agreement.
1631    #[serde(skip_serializing_if = "Option::is_none")]
1632    pub date: Option<stripe_types::Timestamp>,
1633    /// The IP address from which the account representative accepted the service agreement.
1634    #[serde(skip_serializing_if = "Option::is_none")]
1635    pub ip: Option<String>,
1636    /// The user agent of the browser from which the account representative accepted the service agreement.
1637    #[serde(skip_serializing_if = "Option::is_none")]
1638    pub user_agent: Option<String>,
1639}
1640impl CreateTokenPersonAdditionalTosAcceptancesAccount {
1641    pub fn new() -> Self {
1642        Self { date: None, ip: None, user_agent: None }
1643    }
1644}
1645impl Default for CreateTokenPersonAdditionalTosAcceptancesAccount {
1646    fn default() -> Self {
1647        Self::new()
1648    }
1649}
1650/// The person's address.
1651#[derive(Clone, Debug, serde::Serialize)]
1652pub struct CreateTokenPersonAddress {
1653    /// City, district, suburb, town, or village.
1654    #[serde(skip_serializing_if = "Option::is_none")]
1655    pub city: Option<String>,
1656    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1657    #[serde(skip_serializing_if = "Option::is_none")]
1658    pub country: Option<String>,
1659    /// Address line 1, such as the street, PO Box, or company name.
1660    #[serde(skip_serializing_if = "Option::is_none")]
1661    pub line1: Option<String>,
1662    /// Address line 2, such as the apartment, suite, unit, or building.
1663    #[serde(skip_serializing_if = "Option::is_none")]
1664    pub line2: Option<String>,
1665    /// ZIP or postal code.
1666    #[serde(skip_serializing_if = "Option::is_none")]
1667    pub postal_code: Option<String>,
1668    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
1669    #[serde(skip_serializing_if = "Option::is_none")]
1670    pub state: Option<String>,
1671}
1672impl CreateTokenPersonAddress {
1673    pub fn new() -> Self {
1674        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
1675    }
1676}
1677impl Default for CreateTokenPersonAddress {
1678    fn default() -> Self {
1679        Self::new()
1680    }
1681}
1682/// The Kana variation of the person's address (Japan only).
1683#[derive(Clone, Debug, serde::Serialize)]
1684pub struct CreateTokenPersonAddressKana {
1685    /// City or ward.
1686    #[serde(skip_serializing_if = "Option::is_none")]
1687    pub city: Option<String>,
1688    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1689    #[serde(skip_serializing_if = "Option::is_none")]
1690    pub country: Option<String>,
1691    /// Block or building number.
1692    #[serde(skip_serializing_if = "Option::is_none")]
1693    pub line1: Option<String>,
1694    /// Building details.
1695    #[serde(skip_serializing_if = "Option::is_none")]
1696    pub line2: Option<String>,
1697    /// Postal code.
1698    #[serde(skip_serializing_if = "Option::is_none")]
1699    pub postal_code: Option<String>,
1700    /// Prefecture.
1701    #[serde(skip_serializing_if = "Option::is_none")]
1702    pub state: Option<String>,
1703    /// Town or cho-me.
1704    #[serde(skip_serializing_if = "Option::is_none")]
1705    pub town: Option<String>,
1706}
1707impl CreateTokenPersonAddressKana {
1708    pub fn new() -> Self {
1709        Self {
1710            city: None,
1711            country: None,
1712            line1: None,
1713            line2: None,
1714            postal_code: None,
1715            state: None,
1716            town: None,
1717        }
1718    }
1719}
1720impl Default for CreateTokenPersonAddressKana {
1721    fn default() -> Self {
1722        Self::new()
1723    }
1724}
1725/// The Kanji variation of the person's address (Japan only).
1726#[derive(Clone, Debug, serde::Serialize)]
1727pub struct CreateTokenPersonAddressKanji {
1728    /// City or ward.
1729    #[serde(skip_serializing_if = "Option::is_none")]
1730    pub city: Option<String>,
1731    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1732    #[serde(skip_serializing_if = "Option::is_none")]
1733    pub country: Option<String>,
1734    /// Block or building number.
1735    #[serde(skip_serializing_if = "Option::is_none")]
1736    pub line1: Option<String>,
1737    /// Building details.
1738    #[serde(skip_serializing_if = "Option::is_none")]
1739    pub line2: Option<String>,
1740    /// Postal code.
1741    #[serde(skip_serializing_if = "Option::is_none")]
1742    pub postal_code: Option<String>,
1743    /// Prefecture.
1744    #[serde(skip_serializing_if = "Option::is_none")]
1745    pub state: Option<String>,
1746    /// Town or cho-me.
1747    #[serde(skip_serializing_if = "Option::is_none")]
1748    pub town: Option<String>,
1749}
1750impl CreateTokenPersonAddressKanji {
1751    pub fn new() -> Self {
1752        Self {
1753            city: None,
1754            country: None,
1755            line1: None,
1756            line2: None,
1757            postal_code: None,
1758            state: None,
1759            town: None,
1760        }
1761    }
1762}
1763impl Default for CreateTokenPersonAddressKanji {
1764    fn default() -> Self {
1765        Self::new()
1766    }
1767}
1768/// Documents that may be submitted to satisfy various informational requests.
1769#[derive(Clone, Debug, serde::Serialize)]
1770pub struct CreateTokenPersonDocuments {
1771    /// One or more documents that demonstrate proof that this person is authorized to represent the company.
1772    #[serde(skip_serializing_if = "Option::is_none")]
1773    pub company_authorization: Option<DocumentsParam>,
1774    /// One or more documents showing the person's passport page with photo and personal data.
1775    #[serde(skip_serializing_if = "Option::is_none")]
1776    pub passport: Option<DocumentsParam>,
1777    /// One or more documents showing the person's visa required for living in the country where they are residing.
1778    #[serde(skip_serializing_if = "Option::is_none")]
1779    pub visa: Option<DocumentsParam>,
1780}
1781impl CreateTokenPersonDocuments {
1782    pub fn new() -> Self {
1783        Self { company_authorization: None, passport: None, visa: None }
1784    }
1785}
1786impl Default for CreateTokenPersonDocuments {
1787    fn default() -> Self {
1788        Self::new()
1789    }
1790}
1791/// Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
1792#[derive(Clone, Eq, PartialEq)]
1793#[non_exhaustive]
1794pub enum CreateTokenPersonPoliticalExposure {
1795    Existing,
1796    None,
1797    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1798    Unknown(String),
1799}
1800impl CreateTokenPersonPoliticalExposure {
1801    pub fn as_str(&self) -> &str {
1802        use CreateTokenPersonPoliticalExposure::*;
1803        match self {
1804            Existing => "existing",
1805            None => "none",
1806            Unknown(v) => v,
1807        }
1808    }
1809}
1810
1811impl std::str::FromStr for CreateTokenPersonPoliticalExposure {
1812    type Err = std::convert::Infallible;
1813    fn from_str(s: &str) -> Result<Self, Self::Err> {
1814        use CreateTokenPersonPoliticalExposure::*;
1815        match s {
1816            "existing" => Ok(Existing),
1817            "none" => Ok(None),
1818            v => {
1819                tracing::warn!(
1820                    "Unknown value '{}' for enum '{}'",
1821                    v,
1822                    "CreateTokenPersonPoliticalExposure"
1823                );
1824                Ok(Unknown(v.to_owned()))
1825            }
1826        }
1827    }
1828}
1829impl std::fmt::Display for CreateTokenPersonPoliticalExposure {
1830    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1831        f.write_str(self.as_str())
1832    }
1833}
1834
1835impl std::fmt::Debug for CreateTokenPersonPoliticalExposure {
1836    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1837        f.write_str(self.as_str())
1838    }
1839}
1840impl serde::Serialize for CreateTokenPersonPoliticalExposure {
1841    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1842    where
1843        S: serde::Serializer,
1844    {
1845        serializer.serialize_str(self.as_str())
1846    }
1847}
1848#[cfg(feature = "deserialize")]
1849impl<'de> serde::Deserialize<'de> for CreateTokenPersonPoliticalExposure {
1850    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1851        use std::str::FromStr;
1852        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1853        Ok(Self::from_str(&s).expect("infallible"))
1854    }
1855}
1856/// The person's registered address.
1857#[derive(Clone, Debug, serde::Serialize)]
1858pub struct CreateTokenPersonRegisteredAddress {
1859    /// City, district, suburb, town, or village.
1860    #[serde(skip_serializing_if = "Option::is_none")]
1861    pub city: Option<String>,
1862    /// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
1863    #[serde(skip_serializing_if = "Option::is_none")]
1864    pub country: Option<String>,
1865    /// Address line 1, such as the street, PO Box, or company name.
1866    #[serde(skip_serializing_if = "Option::is_none")]
1867    pub line1: Option<String>,
1868    /// Address line 2, such as the apartment, suite, unit, or building.
1869    #[serde(skip_serializing_if = "Option::is_none")]
1870    pub line2: Option<String>,
1871    /// ZIP or postal code.
1872    #[serde(skip_serializing_if = "Option::is_none")]
1873    pub postal_code: Option<String>,
1874    /// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
1875    #[serde(skip_serializing_if = "Option::is_none")]
1876    pub state: Option<String>,
1877}
1878impl CreateTokenPersonRegisteredAddress {
1879    pub fn new() -> Self {
1880        Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
1881    }
1882}
1883impl Default for CreateTokenPersonRegisteredAddress {
1884    fn default() -> Self {
1885        Self::new()
1886    }
1887}
1888/// The relationship that this person has with the account's legal entity.
1889#[derive(Clone, Debug, serde::Serialize)]
1890pub struct CreateTokenPersonRelationship {
1891    /// Whether the person is the authorizer of the account's representative.
1892    #[serde(skip_serializing_if = "Option::is_none")]
1893    pub authorizer: Option<bool>,
1894    /// Whether the person is a director of the account's legal entity.
1895    /// Directors are typically members of the governing board of the company, or responsible for ensuring the company meets its regulatory obligations.
1896    #[serde(skip_serializing_if = "Option::is_none")]
1897    pub director: Option<bool>,
1898    /// Whether the person has significant responsibility to control, manage, or direct the organization.
1899    #[serde(skip_serializing_if = "Option::is_none")]
1900    pub executive: Option<bool>,
1901    /// Whether the person is the legal guardian of the account's representative.
1902    #[serde(skip_serializing_if = "Option::is_none")]
1903    pub legal_guardian: Option<bool>,
1904    /// Whether the person is an owner of the account’s legal entity.
1905    #[serde(skip_serializing_if = "Option::is_none")]
1906    pub owner: Option<bool>,
1907    /// The percent owned by the person of the account's legal entity.
1908    #[serde(skip_serializing_if = "Option::is_none")]
1909    pub percent_ownership: Option<f64>,
1910    /// Whether the person is authorized as the primary representative of the account.
1911    /// This is the person nominated by the business to provide information about themselves, and general information about the account.
1912    /// There can only be one representative at any given time.
1913    /// At the time the account is created, this person should be set to the person responsible for opening the account.
1914    #[serde(skip_serializing_if = "Option::is_none")]
1915    pub representative: Option<bool>,
1916    /// The person's title (e.g., CEO, Support Engineer).
1917    #[serde(skip_serializing_if = "Option::is_none")]
1918    pub title: Option<String>,
1919}
1920impl CreateTokenPersonRelationship {
1921    pub fn new() -> Self {
1922        Self {
1923            authorizer: None,
1924            director: None,
1925            executive: None,
1926            legal_guardian: None,
1927            owner: None,
1928            percent_ownership: None,
1929            representative: None,
1930            title: None,
1931        }
1932    }
1933}
1934impl Default for CreateTokenPersonRelationship {
1935    fn default() -> Self {
1936        Self::new()
1937    }
1938}
1939/// Demographic data related to the person.
1940#[derive(Clone, Debug, serde::Serialize)]
1941pub struct CreateTokenPersonUsCfpbData {
1942    /// The persons ethnicity details
1943    #[serde(skip_serializing_if = "Option::is_none")]
1944    pub ethnicity_details: Option<CreateTokenPersonUsCfpbDataEthnicityDetails>,
1945    /// The persons race details
1946    #[serde(skip_serializing_if = "Option::is_none")]
1947    pub race_details: Option<CreateTokenPersonUsCfpbDataRaceDetails>,
1948    /// The persons self-identified gender
1949    #[serde(skip_serializing_if = "Option::is_none")]
1950    pub self_identified_gender: Option<String>,
1951}
1952impl CreateTokenPersonUsCfpbData {
1953    pub fn new() -> Self {
1954        Self { ethnicity_details: None, race_details: None, self_identified_gender: None }
1955    }
1956}
1957impl Default for CreateTokenPersonUsCfpbData {
1958    fn default() -> Self {
1959        Self::new()
1960    }
1961}
1962/// The persons ethnicity details
1963#[derive(Clone, Debug, serde::Serialize)]
1964pub struct CreateTokenPersonUsCfpbDataEthnicityDetails {
1965    /// The persons ethnicity
1966    #[serde(skip_serializing_if = "Option::is_none")]
1967    pub ethnicity: Option<Vec<CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity>>,
1968    /// Please specify your origin, when other is selected.
1969    #[serde(skip_serializing_if = "Option::is_none")]
1970    pub ethnicity_other: Option<String>,
1971}
1972impl CreateTokenPersonUsCfpbDataEthnicityDetails {
1973    pub fn new() -> Self {
1974        Self { ethnicity: None, ethnicity_other: None }
1975    }
1976}
1977impl Default for CreateTokenPersonUsCfpbDataEthnicityDetails {
1978    fn default() -> Self {
1979        Self::new()
1980    }
1981}
1982/// The persons ethnicity
1983#[derive(Clone, Eq, PartialEq)]
1984#[non_exhaustive]
1985pub enum CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
1986    Cuban,
1987    HispanicOrLatino,
1988    Mexican,
1989    NotHispanicOrLatino,
1990    OtherHispanicOrLatino,
1991    PreferNotToAnswer,
1992    PuertoRican,
1993    /// An unrecognized value from Stripe. Should not be used as a request parameter.
1994    Unknown(String),
1995}
1996impl CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
1997    pub fn as_str(&self) -> &str {
1998        use CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity::*;
1999        match self {
2000            Cuban => "cuban",
2001            HispanicOrLatino => "hispanic_or_latino",
2002            Mexican => "mexican",
2003            NotHispanicOrLatino => "not_hispanic_or_latino",
2004            OtherHispanicOrLatino => "other_hispanic_or_latino",
2005            PreferNotToAnswer => "prefer_not_to_answer",
2006            PuertoRican => "puerto_rican",
2007            Unknown(v) => v,
2008        }
2009    }
2010}
2011
2012impl std::str::FromStr for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2013    type Err = std::convert::Infallible;
2014    fn from_str(s: &str) -> Result<Self, Self::Err> {
2015        use CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity::*;
2016        match s {
2017            "cuban" => Ok(Cuban),
2018            "hispanic_or_latino" => Ok(HispanicOrLatino),
2019            "mexican" => Ok(Mexican),
2020            "not_hispanic_or_latino" => Ok(NotHispanicOrLatino),
2021            "other_hispanic_or_latino" => Ok(OtherHispanicOrLatino),
2022            "prefer_not_to_answer" => Ok(PreferNotToAnswer),
2023            "puerto_rican" => Ok(PuertoRican),
2024            v => {
2025                tracing::warn!(
2026                    "Unknown value '{}' for enum '{}'",
2027                    v,
2028                    "CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity"
2029                );
2030                Ok(Unknown(v.to_owned()))
2031            }
2032        }
2033    }
2034}
2035impl std::fmt::Display for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2036    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2037        f.write_str(self.as_str())
2038    }
2039}
2040
2041impl std::fmt::Debug for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2042    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2043        f.write_str(self.as_str())
2044    }
2045}
2046impl serde::Serialize for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2047    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2048    where
2049        S: serde::Serializer,
2050    {
2051        serializer.serialize_str(self.as_str())
2052    }
2053}
2054#[cfg(feature = "deserialize")]
2055impl<'de> serde::Deserialize<'de> for CreateTokenPersonUsCfpbDataEthnicityDetailsEthnicity {
2056    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2057        use std::str::FromStr;
2058        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2059        Ok(Self::from_str(&s).expect("infallible"))
2060    }
2061}
2062/// The persons race details
2063#[derive(Clone, Debug, serde::Serialize)]
2064pub struct CreateTokenPersonUsCfpbDataRaceDetails {
2065    /// The persons race.
2066    #[serde(skip_serializing_if = "Option::is_none")]
2067    pub race: Option<Vec<CreateTokenPersonUsCfpbDataRaceDetailsRace>>,
2068    /// Please specify your race, when other is selected.
2069    #[serde(skip_serializing_if = "Option::is_none")]
2070    pub race_other: Option<String>,
2071}
2072impl CreateTokenPersonUsCfpbDataRaceDetails {
2073    pub fn new() -> Self {
2074        Self { race: None, race_other: None }
2075    }
2076}
2077impl Default for CreateTokenPersonUsCfpbDataRaceDetails {
2078    fn default() -> Self {
2079        Self::new()
2080    }
2081}
2082/// The persons race.
2083#[derive(Clone, Eq, PartialEq)]
2084#[non_exhaustive]
2085pub enum CreateTokenPersonUsCfpbDataRaceDetailsRace {
2086    AfricanAmerican,
2087    AmericanIndianOrAlaskaNative,
2088    Asian,
2089    AsianIndian,
2090    BlackOrAfricanAmerican,
2091    Chinese,
2092    Ethiopian,
2093    Filipino,
2094    GuamanianOrChamorro,
2095    Haitian,
2096    Jamaican,
2097    Japanese,
2098    Korean,
2099    NativeHawaiian,
2100    NativeHawaiianOrOtherPacificIslander,
2101    Nigerian,
2102    OtherAsian,
2103    OtherBlackOrAfricanAmerican,
2104    OtherPacificIslander,
2105    PreferNotToAnswer,
2106    Samoan,
2107    Somali,
2108    Vietnamese,
2109    White,
2110    /// An unrecognized value from Stripe. Should not be used as a request parameter.
2111    Unknown(String),
2112}
2113impl CreateTokenPersonUsCfpbDataRaceDetailsRace {
2114    pub fn as_str(&self) -> &str {
2115        use CreateTokenPersonUsCfpbDataRaceDetailsRace::*;
2116        match self {
2117            AfricanAmerican => "african_american",
2118            AmericanIndianOrAlaskaNative => "american_indian_or_alaska_native",
2119            Asian => "asian",
2120            AsianIndian => "asian_indian",
2121            BlackOrAfricanAmerican => "black_or_african_american",
2122            Chinese => "chinese",
2123            Ethiopian => "ethiopian",
2124            Filipino => "filipino",
2125            GuamanianOrChamorro => "guamanian_or_chamorro",
2126            Haitian => "haitian",
2127            Jamaican => "jamaican",
2128            Japanese => "japanese",
2129            Korean => "korean",
2130            NativeHawaiian => "native_hawaiian",
2131            NativeHawaiianOrOtherPacificIslander => "native_hawaiian_or_other_pacific_islander",
2132            Nigerian => "nigerian",
2133            OtherAsian => "other_asian",
2134            OtherBlackOrAfricanAmerican => "other_black_or_african_american",
2135            OtherPacificIslander => "other_pacific_islander",
2136            PreferNotToAnswer => "prefer_not_to_answer",
2137            Samoan => "samoan",
2138            Somali => "somali",
2139            Vietnamese => "vietnamese",
2140            White => "white",
2141            Unknown(v) => v,
2142        }
2143    }
2144}
2145
2146impl std::str::FromStr for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2147    type Err = std::convert::Infallible;
2148    fn from_str(s: &str) -> Result<Self, Self::Err> {
2149        use CreateTokenPersonUsCfpbDataRaceDetailsRace::*;
2150        match s {
2151            "african_american" => Ok(AfricanAmerican),
2152            "american_indian_or_alaska_native" => Ok(AmericanIndianOrAlaskaNative),
2153            "asian" => Ok(Asian),
2154            "asian_indian" => Ok(AsianIndian),
2155            "black_or_african_american" => Ok(BlackOrAfricanAmerican),
2156            "chinese" => Ok(Chinese),
2157            "ethiopian" => Ok(Ethiopian),
2158            "filipino" => Ok(Filipino),
2159            "guamanian_or_chamorro" => Ok(GuamanianOrChamorro),
2160            "haitian" => Ok(Haitian),
2161            "jamaican" => Ok(Jamaican),
2162            "japanese" => Ok(Japanese),
2163            "korean" => Ok(Korean),
2164            "native_hawaiian" => Ok(NativeHawaiian),
2165            "native_hawaiian_or_other_pacific_islander" => Ok(NativeHawaiianOrOtherPacificIslander),
2166            "nigerian" => Ok(Nigerian),
2167            "other_asian" => Ok(OtherAsian),
2168            "other_black_or_african_american" => Ok(OtherBlackOrAfricanAmerican),
2169            "other_pacific_islander" => Ok(OtherPacificIslander),
2170            "prefer_not_to_answer" => Ok(PreferNotToAnswer),
2171            "samoan" => Ok(Samoan),
2172            "somali" => Ok(Somali),
2173            "vietnamese" => Ok(Vietnamese),
2174            "white" => Ok(White),
2175            v => {
2176                tracing::warn!(
2177                    "Unknown value '{}' for enum '{}'",
2178                    v,
2179                    "CreateTokenPersonUsCfpbDataRaceDetailsRace"
2180                );
2181                Ok(Unknown(v.to_owned()))
2182            }
2183        }
2184    }
2185}
2186impl std::fmt::Display for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2187    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2188        f.write_str(self.as_str())
2189    }
2190}
2191
2192impl std::fmt::Debug for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2193    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2194        f.write_str(self.as_str())
2195    }
2196}
2197impl serde::Serialize for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2198    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
2199    where
2200        S: serde::Serializer,
2201    {
2202        serializer.serialize_str(self.as_str())
2203    }
2204}
2205#[cfg(feature = "deserialize")]
2206impl<'de> serde::Deserialize<'de> for CreateTokenPersonUsCfpbDataRaceDetailsRace {
2207    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
2208        use std::str::FromStr;
2209        let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
2210        Ok(Self::from_str(&s).expect("infallible"))
2211    }
2212}
2213/// The PII this token represents.
2214#[derive(Clone, Debug, serde::Serialize)]
2215pub struct CreateTokenPii {
2216    /// The `id_number` for the PII, in string form.
2217    #[serde(skip_serializing_if = "Option::is_none")]
2218    pub id_number: Option<String>,
2219}
2220impl CreateTokenPii {
2221    pub fn new() -> Self {
2222        Self { id_number: None }
2223    }
2224}
2225impl Default for CreateTokenPii {
2226    fn default() -> Self {
2227        Self::new()
2228    }
2229}
2230/// Creates a single-use token that represents a bank account’s details.
2231/// You can use this token with any v1 API method in place of a bank account dictionary.
2232/// You can only use this token once.
2233/// To do so, attach it to a [connected account](https://stripe.com/docs/api#accounts) where <a href="/api/accounts/object#account_object-controller-requirement_collection">controller.requirement_collection</a> is `application`, which includes Custom accounts.
2234#[derive(Clone, Debug, serde::Serialize)]
2235pub struct CreateToken {
2236    inner: CreateTokenBuilder,
2237}
2238impl CreateToken {
2239    /// Construct a new `CreateToken`.
2240    pub fn new() -> Self {
2241        Self { inner: CreateTokenBuilder::new() }
2242    }
2243    /// Information for the account this token represents.
2244    pub fn account(mut self, account: impl Into<CreateTokenAccount>) -> Self {
2245        self.inner.account = Some(account.into());
2246        self
2247    }
2248    /// The bank account this token will represent.
2249    pub fn bank_account(mut self, bank_account: impl Into<CreateTokenBankAccount>) -> Self {
2250        self.inner.bank_account = Some(bank_account.into());
2251        self
2252    }
2253    /// The card this token will represent.
2254    /// If you also pass in a customer, the card must be the ID of a card belonging to the customer.
2255    /// Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
2256    pub fn card(mut self, card: impl Into<CreateTokenCard>) -> Self {
2257        self.inner.card = Some(card.into());
2258        self
2259    }
2260    /// Create a token for the customer, which is owned by the application's account.
2261    /// You can only use this with an [OAuth access token](https://docs.stripe.com/connect/standard-accounts) or [Stripe-Account header](https://docs.stripe.com/connect/authentication).
2262    /// Learn more about [cloning saved payment methods](https://docs.stripe.com/connect/cloning-saved-payment-methods).
2263    pub fn customer(mut self, customer: impl Into<String>) -> Self {
2264        self.inner.customer = Some(customer.into());
2265        self
2266    }
2267    /// The updated CVC value this token represents.
2268    pub fn cvc_update(mut self, cvc_update: impl Into<CreateTokenCvcUpdate>) -> Self {
2269        self.inner.cvc_update = Some(cvc_update.into());
2270        self
2271    }
2272    /// Specifies which fields in the response should be expanded.
2273    pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
2274        self.inner.expand = Some(expand.into());
2275        self
2276    }
2277    /// Information for the person this token represents.
2278    pub fn person(mut self, person: impl Into<CreateTokenPerson>) -> Self {
2279        self.inner.person = Some(person.into());
2280        self
2281    }
2282    /// The PII this token represents.
2283    pub fn pii(mut self, pii: impl Into<CreateTokenPii>) -> Self {
2284        self.inner.pii = Some(pii.into());
2285        self
2286    }
2287}
2288impl Default for CreateToken {
2289    fn default() -> Self {
2290        Self::new()
2291    }
2292}
2293impl CreateToken {
2294    /// Send the request and return the deserialized response.
2295    pub async fn send<C: StripeClient>(
2296        &self,
2297        client: &C,
2298    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2299        self.customize().send(client).await
2300    }
2301
2302    /// Send the request and return the deserialized response, blocking until completion.
2303    pub fn send_blocking<C: StripeBlockingClient>(
2304        &self,
2305        client: &C,
2306    ) -> Result<<Self as StripeRequest>::Output, C::Err> {
2307        self.customize().send_blocking(client)
2308    }
2309}
2310
2311impl StripeRequest for CreateToken {
2312    type Output = stripe_core::Token;
2313
2314    fn build(&self) -> RequestBuilder {
2315        RequestBuilder::new(StripeMethod::Post, "/tokens").form(&self.inner)
2316    }
2317}
2318
2319#[derive(Copy, Clone, Debug, serde::Serialize)]
2320pub struct DateOfBirthSpecs {
2321    /// The day of birth, between 1 and 31.
2322    pub day: i64,
2323    /// The month of birth, between 1 and 12.
2324    pub month: i64,
2325    /// The four-digit year of birth.
2326    pub year: i64,
2327}
2328impl DateOfBirthSpecs {
2329    pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
2330        Self { day: day.into(), month: month.into(), year: year.into() }
2331    }
2332}
2333#[derive(Clone, Debug, serde::Serialize)]
2334pub struct PersonVerificationDocumentSpecs {
2335    /// The back of an ID returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `identity_document`.
2336    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
2337    #[serde(skip_serializing_if = "Option::is_none")]
2338    pub back: Option<String>,
2339    /// The front of an ID returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `identity_document`.
2340    /// The uploaded file needs to be a color image (smaller than 8,000px by 8,000px), in JPG, PNG, or PDF format, and less than 10 MB in size.
2341    #[serde(skip_serializing_if = "Option::is_none")]
2342    pub front: Option<String>,
2343}
2344impl PersonVerificationDocumentSpecs {
2345    pub fn new() -> Self {
2346        Self { back: None, front: None }
2347    }
2348}
2349impl Default for PersonVerificationDocumentSpecs {
2350    fn default() -> Self {
2351        Self::new()
2352    }
2353}
2354#[derive(Clone, Debug, serde::Serialize)]
2355pub struct DocumentsParam {
2356    /// One or more document ids returned by a [file upload](https://api.stripe.com#create_file) with a `purpose` value of `account_requirement`.
2357    #[serde(skip_serializing_if = "Option::is_none")]
2358    pub files: Option<Vec<String>>,
2359}
2360impl DocumentsParam {
2361    pub fn new() -> Self {
2362        Self { files: None }
2363    }
2364}
2365impl Default for DocumentsParam {
2366    fn default() -> Self {
2367        Self::new()
2368    }
2369}
2370#[derive(Clone, Debug, serde::Serialize)]
2371pub struct PersonVerificationSpecs {
2372    /// A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.
2373    #[serde(skip_serializing_if = "Option::is_none")]
2374    pub additional_document: Option<PersonVerificationDocumentSpecs>,
2375    /// An identifying document, either a passport or local ID card.
2376    #[serde(skip_serializing_if = "Option::is_none")]
2377    pub document: Option<PersonVerificationDocumentSpecs>,
2378}
2379impl PersonVerificationSpecs {
2380    pub fn new() -> Self {
2381        Self { additional_document: None, document: None }
2382    }
2383}
2384impl Default for PersonVerificationSpecs {
2385    fn default() -> Self {
2386        Self::new()
2387    }
2388}