1#[derive(Clone, Debug)]
18#[cfg_attr(feature = "deserialize", derive(serde::Deserialize))]
19pub struct CheckoutSession {
20 pub adaptive_pricing: Option<stripe_shared::PaymentPagesCheckoutSessionAdaptivePricing>,
22 pub after_expiration: Option<stripe_shared::PaymentPagesCheckoutSessionAfterExpiration>,
24 pub allow_promotion_codes: Option<bool>,
26 pub amount_subtotal: Option<i64>,
28 pub amount_total: Option<i64>,
30 pub automatic_tax: stripe_shared::PaymentPagesCheckoutSessionAutomaticTax,
31 pub billing_address_collection: Option<stripe_shared::CheckoutSessionBillingAddressCollection>,
33 pub branding_settings: Option<stripe_shared::PaymentPagesCheckoutSessionBrandingSettings>,
34 pub cancel_url: Option<String>,
36 pub client_reference_id: Option<String>,
40 pub client_secret: Option<String>,
45 pub collected_information:
47 Option<stripe_shared::PaymentPagesCheckoutSessionCollectedInformation>,
48 pub consent: Option<stripe_shared::PaymentPagesCheckoutSessionConsent>,
50 pub consent_collection: Option<stripe_shared::PaymentPagesCheckoutSessionConsentCollection>,
52 pub created: stripe_types::Timestamp,
54 pub currency: Option<stripe_types::Currency>,
57 pub currency_conversion: Option<stripe_shared::PaymentPagesCheckoutSessionCurrencyConversion>,
59 pub custom_fields: Vec<stripe_shared::PaymentPagesCheckoutSessionCustomFields>,
62 pub custom_text: stripe_shared::PaymentPagesCheckoutSessionCustomText,
63 pub customer: Option<stripe_types::Expandable<stripe_shared::Customer>>,
69 pub customer_creation: Option<CheckoutSessionCustomerCreation>,
71 pub customer_details: Option<stripe_shared::PaymentPagesCheckoutSessionCustomerDetails>,
74 pub customer_email: Option<String>,
80 pub discounts: Option<Vec<stripe_shared::PaymentPagesCheckoutSessionDiscount>>,
82 pub excluded_payment_method_types: Option<Vec<String>>,
85 pub expires_at: stripe_types::Timestamp,
87 pub id: stripe_shared::CheckoutSessionId,
89 pub invoice: Option<stripe_types::Expandable<stripe_shared::Invoice>>,
91 pub invoice_creation: Option<stripe_shared::PaymentPagesCheckoutSessionInvoiceCreation>,
93 pub line_items: Option<stripe_types::List<stripe_shared::CheckoutSessionItem>>,
95 pub livemode: bool,
97 pub locale: Option<stripe_shared::CheckoutSessionLocale>,
100 pub metadata: Option<std::collections::HashMap<String, String>>,
103 pub mode: stripe_shared::CheckoutSessionMode,
105 pub name_collection: Option<stripe_shared::PaymentPagesCheckoutSessionNameCollection>,
106 pub optional_items: Option<Vec<stripe_shared::PaymentPagesCheckoutSessionOptionalItem>>,
108 pub origin_context: Option<stripe_shared::CheckoutSessionOriginContext>,
110 pub payment_intent: Option<stripe_types::Expandable<stripe_shared::PaymentIntent>>,
114 pub payment_link: Option<stripe_types::Expandable<stripe_shared::PaymentLink>>,
116 pub payment_method_collection: Option<CheckoutSessionPaymentMethodCollection>,
118 pub payment_method_configuration_details:
120 Option<stripe_shared::PaymentMethodConfigBizPaymentMethodConfigurationDetails>,
121 pub payment_method_options: Option<stripe_shared::CheckoutSessionPaymentMethodOptions>,
123 pub payment_method_types: Vec<String>,
126 pub payment_status: CheckoutSessionPaymentStatus,
129 pub permissions: Option<stripe_shared::PaymentPagesCheckoutSessionPermissions>,
133 pub phone_number_collection:
134 Option<stripe_shared::PaymentPagesCheckoutSessionPhoneNumberCollection>,
135 pub presentment_details: Option<stripe_shared::PaymentFlowsPaymentIntentPresentmentDetails>,
136 pub recovered_from: Option<String>,
138 pub redirect_on_completion: Option<stripe_shared::CheckoutSessionRedirectOnCompletion>,
142 pub return_url: Option<String>,
145 pub saved_payment_method_options:
148 Option<stripe_shared::PaymentPagesCheckoutSessionSavedPaymentMethodOptions>,
149 pub setup_intent: Option<stripe_types::Expandable<stripe_shared::SetupIntent>>,
153 pub shipping_address_collection:
155 Option<stripe_shared::PaymentPagesCheckoutSessionShippingAddressCollection>,
156 pub shipping_cost: Option<stripe_shared::PaymentPagesCheckoutSessionShippingCost>,
158 pub shipping_options: Vec<stripe_shared::PaymentPagesCheckoutSessionShippingOption>,
160 pub status: Option<stripe_shared::CheckoutSessionStatus>,
162 pub submit_type: Option<stripe_shared::CheckoutSessionSubmitType>,
166 pub subscription: Option<stripe_types::Expandable<stripe_shared::Subscription>>,
168 pub success_url: Option<String>,
171 pub tax_id_collection: Option<stripe_shared::PaymentPagesCheckoutSessionTaxIdCollection>,
172 pub total_details: Option<stripe_shared::PaymentPagesCheckoutSessionTotalDetails>,
174 pub ui_mode: Option<stripe_shared::CheckoutSessionUiMode>,
176 pub url: Option<String>,
183 pub wallet_options: Option<stripe_shared::CheckoutSessionWalletOptions>,
185}
186#[doc(hidden)]
187pub struct CheckoutSessionBuilder {
188 adaptive_pricing: Option<Option<stripe_shared::PaymentPagesCheckoutSessionAdaptivePricing>>,
189 after_expiration: Option<Option<stripe_shared::PaymentPagesCheckoutSessionAfterExpiration>>,
190 allow_promotion_codes: Option<Option<bool>>,
191 amount_subtotal: Option<Option<i64>>,
192 amount_total: Option<Option<i64>>,
193 automatic_tax: Option<stripe_shared::PaymentPagesCheckoutSessionAutomaticTax>,
194 billing_address_collection:
195 Option<Option<stripe_shared::CheckoutSessionBillingAddressCollection>>,
196 branding_settings: Option<Option<stripe_shared::PaymentPagesCheckoutSessionBrandingSettings>>,
197 cancel_url: Option<Option<String>>,
198 client_reference_id: Option<Option<String>>,
199 client_secret: Option<Option<String>>,
200 collected_information:
201 Option<Option<stripe_shared::PaymentPagesCheckoutSessionCollectedInformation>>,
202 consent: Option<Option<stripe_shared::PaymentPagesCheckoutSessionConsent>>,
203 consent_collection: Option<Option<stripe_shared::PaymentPagesCheckoutSessionConsentCollection>>,
204 created: Option<stripe_types::Timestamp>,
205 currency: Option<Option<stripe_types::Currency>>,
206 currency_conversion:
207 Option<Option<stripe_shared::PaymentPagesCheckoutSessionCurrencyConversion>>,
208 custom_fields: Option<Vec<stripe_shared::PaymentPagesCheckoutSessionCustomFields>>,
209 custom_text: Option<stripe_shared::PaymentPagesCheckoutSessionCustomText>,
210 customer: Option<Option<stripe_types::Expandable<stripe_shared::Customer>>>,
211 customer_creation: Option<Option<CheckoutSessionCustomerCreation>>,
212 customer_details: Option<Option<stripe_shared::PaymentPagesCheckoutSessionCustomerDetails>>,
213 customer_email: Option<Option<String>>,
214 discounts: Option<Option<Vec<stripe_shared::PaymentPagesCheckoutSessionDiscount>>>,
215 excluded_payment_method_types: Option<Option<Vec<String>>>,
216 expires_at: Option<stripe_types::Timestamp>,
217 id: Option<stripe_shared::CheckoutSessionId>,
218 invoice: Option<Option<stripe_types::Expandable<stripe_shared::Invoice>>>,
219 invoice_creation: Option<Option<stripe_shared::PaymentPagesCheckoutSessionInvoiceCreation>>,
220 line_items: Option<Option<stripe_types::List<stripe_shared::CheckoutSessionItem>>>,
221 livemode: Option<bool>,
222 locale: Option<Option<stripe_shared::CheckoutSessionLocale>>,
223 metadata: Option<Option<std::collections::HashMap<String, String>>>,
224 mode: Option<stripe_shared::CheckoutSessionMode>,
225 name_collection: Option<Option<stripe_shared::PaymentPagesCheckoutSessionNameCollection>>,
226 optional_items: Option<Option<Vec<stripe_shared::PaymentPagesCheckoutSessionOptionalItem>>>,
227 origin_context: Option<Option<stripe_shared::CheckoutSessionOriginContext>>,
228 payment_intent: Option<Option<stripe_types::Expandable<stripe_shared::PaymentIntent>>>,
229 payment_link: Option<Option<stripe_types::Expandable<stripe_shared::PaymentLink>>>,
230 payment_method_collection: Option<Option<CheckoutSessionPaymentMethodCollection>>,
231 payment_method_configuration_details:
232 Option<Option<stripe_shared::PaymentMethodConfigBizPaymentMethodConfigurationDetails>>,
233 payment_method_options: Option<Option<stripe_shared::CheckoutSessionPaymentMethodOptions>>,
234 payment_method_types: Option<Vec<String>>,
235 payment_status: Option<CheckoutSessionPaymentStatus>,
236 permissions: Option<Option<stripe_shared::PaymentPagesCheckoutSessionPermissions>>,
237 phone_number_collection:
238 Option<Option<stripe_shared::PaymentPagesCheckoutSessionPhoneNumberCollection>>,
239 presentment_details: Option<Option<stripe_shared::PaymentFlowsPaymentIntentPresentmentDetails>>,
240 recovered_from: Option<Option<String>>,
241 redirect_on_completion: Option<Option<stripe_shared::CheckoutSessionRedirectOnCompletion>>,
242 return_url: Option<Option<String>>,
243 saved_payment_method_options:
244 Option<Option<stripe_shared::PaymentPagesCheckoutSessionSavedPaymentMethodOptions>>,
245 setup_intent: Option<Option<stripe_types::Expandable<stripe_shared::SetupIntent>>>,
246 shipping_address_collection:
247 Option<Option<stripe_shared::PaymentPagesCheckoutSessionShippingAddressCollection>>,
248 shipping_cost: Option<Option<stripe_shared::PaymentPagesCheckoutSessionShippingCost>>,
249 shipping_options: Option<Vec<stripe_shared::PaymentPagesCheckoutSessionShippingOption>>,
250 status: Option<Option<stripe_shared::CheckoutSessionStatus>>,
251 submit_type: Option<Option<stripe_shared::CheckoutSessionSubmitType>>,
252 subscription: Option<Option<stripe_types::Expandable<stripe_shared::Subscription>>>,
253 success_url: Option<Option<String>>,
254 tax_id_collection: Option<Option<stripe_shared::PaymentPagesCheckoutSessionTaxIdCollection>>,
255 total_details: Option<Option<stripe_shared::PaymentPagesCheckoutSessionTotalDetails>>,
256 ui_mode: Option<Option<stripe_shared::CheckoutSessionUiMode>>,
257 url: Option<Option<String>>,
258 wallet_options: Option<Option<stripe_shared::CheckoutSessionWalletOptions>>,
259}
260
261#[allow(
262 unused_variables,
263 irrefutable_let_patterns,
264 clippy::let_unit_value,
265 clippy::match_single_binding,
266 clippy::single_match
267)]
268const _: () = {
269 use miniserde::de::{Map, Visitor};
270 use miniserde::json::Value;
271 use miniserde::{Deserialize, Result, make_place};
272 use stripe_types::miniserde_helpers::FromValueOpt;
273 use stripe_types::{MapBuilder, ObjectDeser};
274
275 make_place!(Place);
276
277 impl Deserialize for CheckoutSession {
278 fn begin(out: &mut Option<Self>) -> &mut dyn Visitor {
279 Place::new(out)
280 }
281 }
282
283 struct Builder<'a> {
284 out: &'a mut Option<CheckoutSession>,
285 builder: CheckoutSessionBuilder,
286 }
287
288 impl Visitor for Place<CheckoutSession> {
289 fn map(&mut self) -> Result<Box<dyn Map + '_>> {
290 Ok(Box::new(Builder {
291 out: &mut self.out,
292 builder: CheckoutSessionBuilder::deser_default(),
293 }))
294 }
295 }
296
297 impl MapBuilder for CheckoutSessionBuilder {
298 type Out = CheckoutSession;
299 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
300 Ok(match k {
301 "adaptive_pricing" => Deserialize::begin(&mut self.adaptive_pricing),
302 "after_expiration" => Deserialize::begin(&mut self.after_expiration),
303 "allow_promotion_codes" => Deserialize::begin(&mut self.allow_promotion_codes),
304 "amount_subtotal" => Deserialize::begin(&mut self.amount_subtotal),
305 "amount_total" => Deserialize::begin(&mut self.amount_total),
306 "automatic_tax" => Deserialize::begin(&mut self.automatic_tax),
307 "billing_address_collection" => {
308 Deserialize::begin(&mut self.billing_address_collection)
309 }
310 "branding_settings" => Deserialize::begin(&mut self.branding_settings),
311 "cancel_url" => Deserialize::begin(&mut self.cancel_url),
312 "client_reference_id" => Deserialize::begin(&mut self.client_reference_id),
313 "client_secret" => Deserialize::begin(&mut self.client_secret),
314 "collected_information" => Deserialize::begin(&mut self.collected_information),
315 "consent" => Deserialize::begin(&mut self.consent),
316 "consent_collection" => Deserialize::begin(&mut self.consent_collection),
317 "created" => Deserialize::begin(&mut self.created),
318 "currency" => Deserialize::begin(&mut self.currency),
319 "currency_conversion" => Deserialize::begin(&mut self.currency_conversion),
320 "custom_fields" => Deserialize::begin(&mut self.custom_fields),
321 "custom_text" => Deserialize::begin(&mut self.custom_text),
322 "customer" => Deserialize::begin(&mut self.customer),
323 "customer_creation" => Deserialize::begin(&mut self.customer_creation),
324 "customer_details" => Deserialize::begin(&mut self.customer_details),
325 "customer_email" => Deserialize::begin(&mut self.customer_email),
326 "discounts" => Deserialize::begin(&mut self.discounts),
327 "excluded_payment_method_types" => {
328 Deserialize::begin(&mut self.excluded_payment_method_types)
329 }
330 "expires_at" => Deserialize::begin(&mut self.expires_at),
331 "id" => Deserialize::begin(&mut self.id),
332 "invoice" => Deserialize::begin(&mut self.invoice),
333 "invoice_creation" => Deserialize::begin(&mut self.invoice_creation),
334 "line_items" => Deserialize::begin(&mut self.line_items),
335 "livemode" => Deserialize::begin(&mut self.livemode),
336 "locale" => Deserialize::begin(&mut self.locale),
337 "metadata" => Deserialize::begin(&mut self.metadata),
338 "mode" => Deserialize::begin(&mut self.mode),
339 "name_collection" => Deserialize::begin(&mut self.name_collection),
340 "optional_items" => Deserialize::begin(&mut self.optional_items),
341 "origin_context" => Deserialize::begin(&mut self.origin_context),
342 "payment_intent" => Deserialize::begin(&mut self.payment_intent),
343 "payment_link" => Deserialize::begin(&mut self.payment_link),
344 "payment_method_collection" => {
345 Deserialize::begin(&mut self.payment_method_collection)
346 }
347 "payment_method_configuration_details" => {
348 Deserialize::begin(&mut self.payment_method_configuration_details)
349 }
350 "payment_method_options" => Deserialize::begin(&mut self.payment_method_options),
351 "payment_method_types" => Deserialize::begin(&mut self.payment_method_types),
352 "payment_status" => Deserialize::begin(&mut self.payment_status),
353 "permissions" => Deserialize::begin(&mut self.permissions),
354 "phone_number_collection" => Deserialize::begin(&mut self.phone_number_collection),
355 "presentment_details" => Deserialize::begin(&mut self.presentment_details),
356 "recovered_from" => Deserialize::begin(&mut self.recovered_from),
357 "redirect_on_completion" => Deserialize::begin(&mut self.redirect_on_completion),
358 "return_url" => Deserialize::begin(&mut self.return_url),
359 "saved_payment_method_options" => {
360 Deserialize::begin(&mut self.saved_payment_method_options)
361 }
362 "setup_intent" => Deserialize::begin(&mut self.setup_intent),
363 "shipping_address_collection" => {
364 Deserialize::begin(&mut self.shipping_address_collection)
365 }
366 "shipping_cost" => Deserialize::begin(&mut self.shipping_cost),
367 "shipping_options" => Deserialize::begin(&mut self.shipping_options),
368 "status" => Deserialize::begin(&mut self.status),
369 "submit_type" => Deserialize::begin(&mut self.submit_type),
370 "subscription" => Deserialize::begin(&mut self.subscription),
371 "success_url" => Deserialize::begin(&mut self.success_url),
372 "tax_id_collection" => Deserialize::begin(&mut self.tax_id_collection),
373 "total_details" => Deserialize::begin(&mut self.total_details),
374 "ui_mode" => Deserialize::begin(&mut self.ui_mode),
375 "url" => Deserialize::begin(&mut self.url),
376 "wallet_options" => Deserialize::begin(&mut self.wallet_options),
377 _ => <dyn Visitor>::ignore(),
378 })
379 }
380
381 fn deser_default() -> Self {
382 Self {
383 adaptive_pricing: Deserialize::default(),
384 after_expiration: Deserialize::default(),
385 allow_promotion_codes: Deserialize::default(),
386 amount_subtotal: Deserialize::default(),
387 amount_total: Deserialize::default(),
388 automatic_tax: Deserialize::default(),
389 billing_address_collection: Deserialize::default(),
390 branding_settings: Deserialize::default(),
391 cancel_url: Deserialize::default(),
392 client_reference_id: Deserialize::default(),
393 client_secret: Deserialize::default(),
394 collected_information: Deserialize::default(),
395 consent: Deserialize::default(),
396 consent_collection: Deserialize::default(),
397 created: Deserialize::default(),
398 currency: Deserialize::default(),
399 currency_conversion: Deserialize::default(),
400 custom_fields: Deserialize::default(),
401 custom_text: Deserialize::default(),
402 customer: Deserialize::default(),
403 customer_creation: Deserialize::default(),
404 customer_details: Deserialize::default(),
405 customer_email: Deserialize::default(),
406 discounts: Deserialize::default(),
407 excluded_payment_method_types: Deserialize::default(),
408 expires_at: Deserialize::default(),
409 id: Deserialize::default(),
410 invoice: Deserialize::default(),
411 invoice_creation: Deserialize::default(),
412 line_items: Deserialize::default(),
413 livemode: Deserialize::default(),
414 locale: Deserialize::default(),
415 metadata: Deserialize::default(),
416 mode: Deserialize::default(),
417 name_collection: Deserialize::default(),
418 optional_items: Deserialize::default(),
419 origin_context: Deserialize::default(),
420 payment_intent: Deserialize::default(),
421 payment_link: Deserialize::default(),
422 payment_method_collection: Deserialize::default(),
423 payment_method_configuration_details: Deserialize::default(),
424 payment_method_options: Deserialize::default(),
425 payment_method_types: Deserialize::default(),
426 payment_status: Deserialize::default(),
427 permissions: Deserialize::default(),
428 phone_number_collection: Deserialize::default(),
429 presentment_details: Deserialize::default(),
430 recovered_from: Deserialize::default(),
431 redirect_on_completion: Deserialize::default(),
432 return_url: Deserialize::default(),
433 saved_payment_method_options: Deserialize::default(),
434 setup_intent: Deserialize::default(),
435 shipping_address_collection: Deserialize::default(),
436 shipping_cost: Deserialize::default(),
437 shipping_options: Deserialize::default(),
438 status: Deserialize::default(),
439 submit_type: Deserialize::default(),
440 subscription: Deserialize::default(),
441 success_url: Deserialize::default(),
442 tax_id_collection: Deserialize::default(),
443 total_details: Deserialize::default(),
444 ui_mode: Deserialize::default(),
445 url: Deserialize::default(),
446 wallet_options: Deserialize::default(),
447 }
448 }
449
450 fn take_out(&mut self) -> Option<Self::Out> {
451 let (
452 Some(adaptive_pricing),
453 Some(after_expiration),
454 Some(allow_promotion_codes),
455 Some(amount_subtotal),
456 Some(amount_total),
457 Some(automatic_tax),
458 Some(billing_address_collection),
459 Some(branding_settings),
460 Some(cancel_url),
461 Some(client_reference_id),
462 Some(client_secret),
463 Some(collected_information),
464 Some(consent),
465 Some(consent_collection),
466 Some(created),
467 Some(currency),
468 Some(currency_conversion),
469 Some(custom_fields),
470 Some(custom_text),
471 Some(customer),
472 Some(customer_creation),
473 Some(customer_details),
474 Some(customer_email),
475 Some(discounts),
476 Some(excluded_payment_method_types),
477 Some(expires_at),
478 Some(id),
479 Some(invoice),
480 Some(invoice_creation),
481 Some(line_items),
482 Some(livemode),
483 Some(locale),
484 Some(metadata),
485 Some(mode),
486 Some(name_collection),
487 Some(optional_items),
488 Some(origin_context),
489 Some(payment_intent),
490 Some(payment_link),
491 Some(payment_method_collection),
492 Some(payment_method_configuration_details),
493 Some(payment_method_options),
494 Some(payment_method_types),
495 Some(payment_status),
496 Some(permissions),
497 Some(phone_number_collection),
498 Some(presentment_details),
499 Some(recovered_from),
500 Some(redirect_on_completion),
501 Some(return_url),
502 Some(saved_payment_method_options),
503 Some(setup_intent),
504 Some(shipping_address_collection),
505 Some(shipping_cost),
506 Some(shipping_options),
507 Some(status),
508 Some(submit_type),
509 Some(subscription),
510 Some(success_url),
511 Some(tax_id_collection),
512 Some(total_details),
513 Some(ui_mode),
514 Some(url),
515 Some(wallet_options),
516 ) = (
517 self.adaptive_pricing,
518 self.after_expiration.take(),
519 self.allow_promotion_codes,
520 self.amount_subtotal,
521 self.amount_total,
522 self.automatic_tax.take(),
523 self.billing_address_collection.take(),
524 self.branding_settings.take(),
525 self.cancel_url.take(),
526 self.client_reference_id.take(),
527 self.client_secret.take(),
528 self.collected_information.take(),
529 self.consent.take(),
530 self.consent_collection.take(),
531 self.created,
532 self.currency.take(),
533 self.currency_conversion.take(),
534 self.custom_fields.take(),
535 self.custom_text.take(),
536 self.customer.take(),
537 self.customer_creation.take(),
538 self.customer_details.take(),
539 self.customer_email.take(),
540 self.discounts.take(),
541 self.excluded_payment_method_types.take(),
542 self.expires_at,
543 self.id.take(),
544 self.invoice.take(),
545 self.invoice_creation.take(),
546 self.line_items.take(),
547 self.livemode,
548 self.locale.take(),
549 self.metadata.take(),
550 self.mode.take(),
551 self.name_collection,
552 self.optional_items.take(),
553 self.origin_context.take(),
554 self.payment_intent.take(),
555 self.payment_link.take(),
556 self.payment_method_collection.take(),
557 self.payment_method_configuration_details.take(),
558 self.payment_method_options.take(),
559 self.payment_method_types.take(),
560 self.payment_status.take(),
561 self.permissions.take(),
562 self.phone_number_collection,
563 self.presentment_details.take(),
564 self.recovered_from.take(),
565 self.redirect_on_completion.take(),
566 self.return_url.take(),
567 self.saved_payment_method_options.take(),
568 self.setup_intent.take(),
569 self.shipping_address_collection.take(),
570 self.shipping_cost.take(),
571 self.shipping_options.take(),
572 self.status.take(),
573 self.submit_type.take(),
574 self.subscription.take(),
575 self.success_url.take(),
576 self.tax_id_collection.take(),
577 self.total_details.take(),
578 self.ui_mode.take(),
579 self.url.take(),
580 self.wallet_options.take(),
581 )
582 else {
583 return None;
584 };
585 Some(Self::Out {
586 adaptive_pricing,
587 after_expiration,
588 allow_promotion_codes,
589 amount_subtotal,
590 amount_total,
591 automatic_tax,
592 billing_address_collection,
593 branding_settings,
594 cancel_url,
595 client_reference_id,
596 client_secret,
597 collected_information,
598 consent,
599 consent_collection,
600 created,
601 currency,
602 currency_conversion,
603 custom_fields,
604 custom_text,
605 customer,
606 customer_creation,
607 customer_details,
608 customer_email,
609 discounts,
610 excluded_payment_method_types,
611 expires_at,
612 id,
613 invoice,
614 invoice_creation,
615 line_items,
616 livemode,
617 locale,
618 metadata,
619 mode,
620 name_collection,
621 optional_items,
622 origin_context,
623 payment_intent,
624 payment_link,
625 payment_method_collection,
626 payment_method_configuration_details,
627 payment_method_options,
628 payment_method_types,
629 payment_status,
630 permissions,
631 phone_number_collection,
632 presentment_details,
633 recovered_from,
634 redirect_on_completion,
635 return_url,
636 saved_payment_method_options,
637 setup_intent,
638 shipping_address_collection,
639 shipping_cost,
640 shipping_options,
641 status,
642 submit_type,
643 subscription,
644 success_url,
645 tax_id_collection,
646 total_details,
647 ui_mode,
648 url,
649 wallet_options,
650 })
651 }
652 }
653
654 impl Map for Builder<'_> {
655 fn key(&mut self, k: &str) -> Result<&mut dyn Visitor> {
656 self.builder.key(k)
657 }
658
659 fn finish(&mut self) -> Result<()> {
660 *self.out = self.builder.take_out();
661 Ok(())
662 }
663 }
664
665 impl ObjectDeser for CheckoutSession {
666 type Builder = CheckoutSessionBuilder;
667 }
668
669 impl FromValueOpt for CheckoutSession {
670 fn from_value(v: Value) -> Option<Self> {
671 let Value::Object(obj) = v else {
672 return None;
673 };
674 let mut b = CheckoutSessionBuilder::deser_default();
675 for (k, v) in obj {
676 match k.as_str() {
677 "adaptive_pricing" => b.adaptive_pricing = FromValueOpt::from_value(v),
678 "after_expiration" => b.after_expiration = FromValueOpt::from_value(v),
679 "allow_promotion_codes" => {
680 b.allow_promotion_codes = FromValueOpt::from_value(v)
681 }
682 "amount_subtotal" => b.amount_subtotal = FromValueOpt::from_value(v),
683 "amount_total" => b.amount_total = FromValueOpt::from_value(v),
684 "automatic_tax" => b.automatic_tax = FromValueOpt::from_value(v),
685 "billing_address_collection" => {
686 b.billing_address_collection = FromValueOpt::from_value(v)
687 }
688 "branding_settings" => b.branding_settings = FromValueOpt::from_value(v),
689 "cancel_url" => b.cancel_url = FromValueOpt::from_value(v),
690 "client_reference_id" => b.client_reference_id = FromValueOpt::from_value(v),
691 "client_secret" => b.client_secret = FromValueOpt::from_value(v),
692 "collected_information" => {
693 b.collected_information = FromValueOpt::from_value(v)
694 }
695 "consent" => b.consent = FromValueOpt::from_value(v),
696 "consent_collection" => b.consent_collection = FromValueOpt::from_value(v),
697 "created" => b.created = FromValueOpt::from_value(v),
698 "currency" => b.currency = FromValueOpt::from_value(v),
699 "currency_conversion" => b.currency_conversion = FromValueOpt::from_value(v),
700 "custom_fields" => b.custom_fields = FromValueOpt::from_value(v),
701 "custom_text" => b.custom_text = FromValueOpt::from_value(v),
702 "customer" => b.customer = FromValueOpt::from_value(v),
703 "customer_creation" => b.customer_creation = FromValueOpt::from_value(v),
704 "customer_details" => b.customer_details = FromValueOpt::from_value(v),
705 "customer_email" => b.customer_email = FromValueOpt::from_value(v),
706 "discounts" => b.discounts = FromValueOpt::from_value(v),
707 "excluded_payment_method_types" => {
708 b.excluded_payment_method_types = FromValueOpt::from_value(v)
709 }
710 "expires_at" => b.expires_at = FromValueOpt::from_value(v),
711 "id" => b.id = FromValueOpt::from_value(v),
712 "invoice" => b.invoice = FromValueOpt::from_value(v),
713 "invoice_creation" => b.invoice_creation = FromValueOpt::from_value(v),
714 "line_items" => b.line_items = FromValueOpt::from_value(v),
715 "livemode" => b.livemode = FromValueOpt::from_value(v),
716 "locale" => b.locale = FromValueOpt::from_value(v),
717 "metadata" => b.metadata = FromValueOpt::from_value(v),
718 "mode" => b.mode = FromValueOpt::from_value(v),
719 "name_collection" => b.name_collection = FromValueOpt::from_value(v),
720 "optional_items" => b.optional_items = FromValueOpt::from_value(v),
721 "origin_context" => b.origin_context = FromValueOpt::from_value(v),
722 "payment_intent" => b.payment_intent = FromValueOpt::from_value(v),
723 "payment_link" => b.payment_link = FromValueOpt::from_value(v),
724 "payment_method_collection" => {
725 b.payment_method_collection = FromValueOpt::from_value(v)
726 }
727 "payment_method_configuration_details" => {
728 b.payment_method_configuration_details = FromValueOpt::from_value(v)
729 }
730 "payment_method_options" => {
731 b.payment_method_options = FromValueOpt::from_value(v)
732 }
733 "payment_method_types" => b.payment_method_types = FromValueOpt::from_value(v),
734 "payment_status" => b.payment_status = FromValueOpt::from_value(v),
735 "permissions" => b.permissions = FromValueOpt::from_value(v),
736 "phone_number_collection" => {
737 b.phone_number_collection = FromValueOpt::from_value(v)
738 }
739 "presentment_details" => b.presentment_details = FromValueOpt::from_value(v),
740 "recovered_from" => b.recovered_from = FromValueOpt::from_value(v),
741 "redirect_on_completion" => {
742 b.redirect_on_completion = FromValueOpt::from_value(v)
743 }
744 "return_url" => b.return_url = FromValueOpt::from_value(v),
745 "saved_payment_method_options" => {
746 b.saved_payment_method_options = FromValueOpt::from_value(v)
747 }
748 "setup_intent" => b.setup_intent = FromValueOpt::from_value(v),
749 "shipping_address_collection" => {
750 b.shipping_address_collection = FromValueOpt::from_value(v)
751 }
752 "shipping_cost" => b.shipping_cost = FromValueOpt::from_value(v),
753 "shipping_options" => b.shipping_options = FromValueOpt::from_value(v),
754 "status" => b.status = FromValueOpt::from_value(v),
755 "submit_type" => b.submit_type = FromValueOpt::from_value(v),
756 "subscription" => b.subscription = FromValueOpt::from_value(v),
757 "success_url" => b.success_url = FromValueOpt::from_value(v),
758 "tax_id_collection" => b.tax_id_collection = FromValueOpt::from_value(v),
759 "total_details" => b.total_details = FromValueOpt::from_value(v),
760 "ui_mode" => b.ui_mode = FromValueOpt::from_value(v),
761 "url" => b.url = FromValueOpt::from_value(v),
762 "wallet_options" => b.wallet_options = FromValueOpt::from_value(v),
763 _ => {}
764 }
765 }
766 b.take_out()
767 }
768 }
769};
770#[cfg(feature = "serialize")]
771impl serde::Serialize for CheckoutSession {
772 fn serialize<S: serde::Serializer>(&self, s: S) -> Result<S::Ok, S::Error> {
773 use serde::ser::SerializeStruct;
774 let mut s = s.serialize_struct("CheckoutSession", 65)?;
775 s.serialize_field("adaptive_pricing", &self.adaptive_pricing)?;
776 s.serialize_field("after_expiration", &self.after_expiration)?;
777 s.serialize_field("allow_promotion_codes", &self.allow_promotion_codes)?;
778 s.serialize_field("amount_subtotal", &self.amount_subtotal)?;
779 s.serialize_field("amount_total", &self.amount_total)?;
780 s.serialize_field("automatic_tax", &self.automatic_tax)?;
781 s.serialize_field("billing_address_collection", &self.billing_address_collection)?;
782 s.serialize_field("branding_settings", &self.branding_settings)?;
783 s.serialize_field("cancel_url", &self.cancel_url)?;
784 s.serialize_field("client_reference_id", &self.client_reference_id)?;
785 s.serialize_field("client_secret", &self.client_secret)?;
786 s.serialize_field("collected_information", &self.collected_information)?;
787 s.serialize_field("consent", &self.consent)?;
788 s.serialize_field("consent_collection", &self.consent_collection)?;
789 s.serialize_field("created", &self.created)?;
790 s.serialize_field("currency", &self.currency)?;
791 s.serialize_field("currency_conversion", &self.currency_conversion)?;
792 s.serialize_field("custom_fields", &self.custom_fields)?;
793 s.serialize_field("custom_text", &self.custom_text)?;
794 s.serialize_field("customer", &self.customer)?;
795 s.serialize_field("customer_creation", &self.customer_creation)?;
796 s.serialize_field("customer_details", &self.customer_details)?;
797 s.serialize_field("customer_email", &self.customer_email)?;
798 s.serialize_field("discounts", &self.discounts)?;
799 s.serialize_field("excluded_payment_method_types", &self.excluded_payment_method_types)?;
800 s.serialize_field("expires_at", &self.expires_at)?;
801 s.serialize_field("id", &self.id)?;
802 s.serialize_field("invoice", &self.invoice)?;
803 s.serialize_field("invoice_creation", &self.invoice_creation)?;
804 s.serialize_field("line_items", &self.line_items)?;
805 s.serialize_field("livemode", &self.livemode)?;
806 s.serialize_field("locale", &self.locale)?;
807 s.serialize_field("metadata", &self.metadata)?;
808 s.serialize_field("mode", &self.mode)?;
809 s.serialize_field("name_collection", &self.name_collection)?;
810 s.serialize_field("optional_items", &self.optional_items)?;
811 s.serialize_field("origin_context", &self.origin_context)?;
812 s.serialize_field("payment_intent", &self.payment_intent)?;
813 s.serialize_field("payment_link", &self.payment_link)?;
814 s.serialize_field("payment_method_collection", &self.payment_method_collection)?;
815 s.serialize_field(
816 "payment_method_configuration_details",
817 &self.payment_method_configuration_details,
818 )?;
819 s.serialize_field("payment_method_options", &self.payment_method_options)?;
820 s.serialize_field("payment_method_types", &self.payment_method_types)?;
821 s.serialize_field("payment_status", &self.payment_status)?;
822 s.serialize_field("permissions", &self.permissions)?;
823 s.serialize_field("phone_number_collection", &self.phone_number_collection)?;
824 s.serialize_field("presentment_details", &self.presentment_details)?;
825 s.serialize_field("recovered_from", &self.recovered_from)?;
826 s.serialize_field("redirect_on_completion", &self.redirect_on_completion)?;
827 s.serialize_field("return_url", &self.return_url)?;
828 s.serialize_field("saved_payment_method_options", &self.saved_payment_method_options)?;
829 s.serialize_field("setup_intent", &self.setup_intent)?;
830 s.serialize_field("shipping_address_collection", &self.shipping_address_collection)?;
831 s.serialize_field("shipping_cost", &self.shipping_cost)?;
832 s.serialize_field("shipping_options", &self.shipping_options)?;
833 s.serialize_field("status", &self.status)?;
834 s.serialize_field("submit_type", &self.submit_type)?;
835 s.serialize_field("subscription", &self.subscription)?;
836 s.serialize_field("success_url", &self.success_url)?;
837 s.serialize_field("tax_id_collection", &self.tax_id_collection)?;
838 s.serialize_field("total_details", &self.total_details)?;
839 s.serialize_field("ui_mode", &self.ui_mode)?;
840 s.serialize_field("url", &self.url)?;
841 s.serialize_field("wallet_options", &self.wallet_options)?;
842
843 s.serialize_field("object", "checkout.session")?;
844 s.end()
845 }
846}
847#[derive(Clone, Eq, PartialEq)]
849#[non_exhaustive]
850pub enum CheckoutSessionCustomerCreation {
851 Always,
852 IfRequired,
853 Unknown(String),
855}
856impl CheckoutSessionCustomerCreation {
857 pub fn as_str(&self) -> &str {
858 use CheckoutSessionCustomerCreation::*;
859 match self {
860 Always => "always",
861 IfRequired => "if_required",
862 Unknown(v) => v,
863 }
864 }
865}
866
867impl std::str::FromStr for CheckoutSessionCustomerCreation {
868 type Err = std::convert::Infallible;
869 fn from_str(s: &str) -> Result<Self, Self::Err> {
870 use CheckoutSessionCustomerCreation::*;
871 match s {
872 "always" => Ok(Always),
873 "if_required" => Ok(IfRequired),
874 v => {
875 tracing::warn!(
876 "Unknown value '{}' for enum '{}'",
877 v,
878 "CheckoutSessionCustomerCreation"
879 );
880 Ok(Unknown(v.to_owned()))
881 }
882 }
883 }
884}
885impl std::fmt::Display for CheckoutSessionCustomerCreation {
886 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
887 f.write_str(self.as_str())
888 }
889}
890
891impl std::fmt::Debug for CheckoutSessionCustomerCreation {
892 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
893 f.write_str(self.as_str())
894 }
895}
896#[cfg(feature = "serialize")]
897impl serde::Serialize for CheckoutSessionCustomerCreation {
898 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
899 where
900 S: serde::Serializer,
901 {
902 serializer.serialize_str(self.as_str())
903 }
904}
905impl miniserde::Deserialize for CheckoutSessionCustomerCreation {
906 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
907 crate::Place::new(out)
908 }
909}
910
911impl miniserde::de::Visitor for crate::Place<CheckoutSessionCustomerCreation> {
912 fn string(&mut self, s: &str) -> miniserde::Result<()> {
913 use std::str::FromStr;
914 self.out = Some(CheckoutSessionCustomerCreation::from_str(s).expect("infallible"));
915 Ok(())
916 }
917}
918
919stripe_types::impl_from_val_with_from_str!(CheckoutSessionCustomerCreation);
920#[cfg(feature = "deserialize")]
921impl<'de> serde::Deserialize<'de> for CheckoutSessionCustomerCreation {
922 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
923 use std::str::FromStr;
924 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
925 Ok(Self::from_str(&s).expect("infallible"))
926 }
927}
928#[derive(Clone, Eq, PartialEq)]
930#[non_exhaustive]
931pub enum CheckoutSessionPaymentMethodCollection {
932 Always,
933 IfRequired,
934 Unknown(String),
936}
937impl CheckoutSessionPaymentMethodCollection {
938 pub fn as_str(&self) -> &str {
939 use CheckoutSessionPaymentMethodCollection::*;
940 match self {
941 Always => "always",
942 IfRequired => "if_required",
943 Unknown(v) => v,
944 }
945 }
946}
947
948impl std::str::FromStr for CheckoutSessionPaymentMethodCollection {
949 type Err = std::convert::Infallible;
950 fn from_str(s: &str) -> Result<Self, Self::Err> {
951 use CheckoutSessionPaymentMethodCollection::*;
952 match s {
953 "always" => Ok(Always),
954 "if_required" => Ok(IfRequired),
955 v => {
956 tracing::warn!(
957 "Unknown value '{}' for enum '{}'",
958 v,
959 "CheckoutSessionPaymentMethodCollection"
960 );
961 Ok(Unknown(v.to_owned()))
962 }
963 }
964 }
965}
966impl std::fmt::Display for CheckoutSessionPaymentMethodCollection {
967 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
968 f.write_str(self.as_str())
969 }
970}
971
972impl std::fmt::Debug for CheckoutSessionPaymentMethodCollection {
973 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
974 f.write_str(self.as_str())
975 }
976}
977#[cfg(feature = "serialize")]
978impl serde::Serialize for CheckoutSessionPaymentMethodCollection {
979 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
980 where
981 S: serde::Serializer,
982 {
983 serializer.serialize_str(self.as_str())
984 }
985}
986impl miniserde::Deserialize for CheckoutSessionPaymentMethodCollection {
987 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
988 crate::Place::new(out)
989 }
990}
991
992impl miniserde::de::Visitor for crate::Place<CheckoutSessionPaymentMethodCollection> {
993 fn string(&mut self, s: &str) -> miniserde::Result<()> {
994 use std::str::FromStr;
995 self.out = Some(CheckoutSessionPaymentMethodCollection::from_str(s).expect("infallible"));
996 Ok(())
997 }
998}
999
1000stripe_types::impl_from_val_with_from_str!(CheckoutSessionPaymentMethodCollection);
1001#[cfg(feature = "deserialize")]
1002impl<'de> serde::Deserialize<'de> for CheckoutSessionPaymentMethodCollection {
1003 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1004 use std::str::FromStr;
1005 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1006 Ok(Self::from_str(&s).expect("infallible"))
1007 }
1008}
1009#[derive(Clone, Eq, PartialEq)]
1012#[non_exhaustive]
1013pub enum CheckoutSessionPaymentStatus {
1014 NoPaymentRequired,
1015 Paid,
1016 Unpaid,
1017 Unknown(String),
1019}
1020impl CheckoutSessionPaymentStatus {
1021 pub fn as_str(&self) -> &str {
1022 use CheckoutSessionPaymentStatus::*;
1023 match self {
1024 NoPaymentRequired => "no_payment_required",
1025 Paid => "paid",
1026 Unpaid => "unpaid",
1027 Unknown(v) => v,
1028 }
1029 }
1030}
1031
1032impl std::str::FromStr for CheckoutSessionPaymentStatus {
1033 type Err = std::convert::Infallible;
1034 fn from_str(s: &str) -> Result<Self, Self::Err> {
1035 use CheckoutSessionPaymentStatus::*;
1036 match s {
1037 "no_payment_required" => Ok(NoPaymentRequired),
1038 "paid" => Ok(Paid),
1039 "unpaid" => Ok(Unpaid),
1040 v => {
1041 tracing::warn!(
1042 "Unknown value '{}' for enum '{}'",
1043 v,
1044 "CheckoutSessionPaymentStatus"
1045 );
1046 Ok(Unknown(v.to_owned()))
1047 }
1048 }
1049 }
1050}
1051impl std::fmt::Display for CheckoutSessionPaymentStatus {
1052 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1053 f.write_str(self.as_str())
1054 }
1055}
1056
1057impl std::fmt::Debug for CheckoutSessionPaymentStatus {
1058 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1059 f.write_str(self.as_str())
1060 }
1061}
1062#[cfg(feature = "serialize")]
1063impl serde::Serialize for CheckoutSessionPaymentStatus {
1064 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1065 where
1066 S: serde::Serializer,
1067 {
1068 serializer.serialize_str(self.as_str())
1069 }
1070}
1071impl miniserde::Deserialize for CheckoutSessionPaymentStatus {
1072 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1073 crate::Place::new(out)
1074 }
1075}
1076
1077impl miniserde::de::Visitor for crate::Place<CheckoutSessionPaymentStatus> {
1078 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1079 use std::str::FromStr;
1080 self.out = Some(CheckoutSessionPaymentStatus::from_str(s).expect("infallible"));
1081 Ok(())
1082 }
1083}
1084
1085stripe_types::impl_from_val_with_from_str!(CheckoutSessionPaymentStatus);
1086#[cfg(feature = "deserialize")]
1087impl<'de> serde::Deserialize<'de> for CheckoutSessionPaymentStatus {
1088 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1089 use std::str::FromStr;
1090 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1091 Ok(Self::from_str(&s).expect("infallible"))
1092 }
1093}
1094impl stripe_types::Object for CheckoutSession {
1095 type Id = stripe_shared::CheckoutSessionId;
1096 fn id(&self) -> &Self::Id {
1097 &self.id
1098 }
1099
1100 fn into_id(self) -> Self::Id {
1101 self.id
1102 }
1103}
1104stripe_types::def_id!(CheckoutSessionId);
1105#[derive(Clone, Eq, PartialEq)]
1106#[non_exhaustive]
1107pub enum CheckoutSessionBillingAddressCollection {
1108 Auto,
1109 Required,
1110 Unknown(String),
1112}
1113impl CheckoutSessionBillingAddressCollection {
1114 pub fn as_str(&self) -> &str {
1115 use CheckoutSessionBillingAddressCollection::*;
1116 match self {
1117 Auto => "auto",
1118 Required => "required",
1119 Unknown(v) => v,
1120 }
1121 }
1122}
1123
1124impl std::str::FromStr for CheckoutSessionBillingAddressCollection {
1125 type Err = std::convert::Infallible;
1126 fn from_str(s: &str) -> Result<Self, Self::Err> {
1127 use CheckoutSessionBillingAddressCollection::*;
1128 match s {
1129 "auto" => Ok(Auto),
1130 "required" => Ok(Required),
1131 v => {
1132 tracing::warn!(
1133 "Unknown value '{}' for enum '{}'",
1134 v,
1135 "CheckoutSessionBillingAddressCollection"
1136 );
1137 Ok(Unknown(v.to_owned()))
1138 }
1139 }
1140 }
1141}
1142impl std::fmt::Display for CheckoutSessionBillingAddressCollection {
1143 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1144 f.write_str(self.as_str())
1145 }
1146}
1147
1148impl std::fmt::Debug for CheckoutSessionBillingAddressCollection {
1149 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1150 f.write_str(self.as_str())
1151 }
1152}
1153impl serde::Serialize for CheckoutSessionBillingAddressCollection {
1154 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1155 where
1156 S: serde::Serializer,
1157 {
1158 serializer.serialize_str(self.as_str())
1159 }
1160}
1161impl miniserde::Deserialize for CheckoutSessionBillingAddressCollection {
1162 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1163 crate::Place::new(out)
1164 }
1165}
1166
1167impl miniserde::de::Visitor for crate::Place<CheckoutSessionBillingAddressCollection> {
1168 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1169 use std::str::FromStr;
1170 self.out = Some(CheckoutSessionBillingAddressCollection::from_str(s).expect("infallible"));
1171 Ok(())
1172 }
1173}
1174
1175stripe_types::impl_from_val_with_from_str!(CheckoutSessionBillingAddressCollection);
1176#[cfg(feature = "deserialize")]
1177impl<'de> serde::Deserialize<'de> for CheckoutSessionBillingAddressCollection {
1178 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1179 use std::str::FromStr;
1180 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1181 Ok(Self::from_str(&s).expect("infallible"))
1182 }
1183}
1184#[derive(Clone, Eq, PartialEq)]
1185#[non_exhaustive]
1186pub enum CheckoutSessionLocale {
1187 Auto,
1188 Bg,
1189 Cs,
1190 Da,
1191 De,
1192 El,
1193 En,
1194 EnMinusGb,
1195 Es,
1196 EsMinus419,
1197 Et,
1198 Fi,
1199 Fil,
1200 Fr,
1201 FrMinusCa,
1202 Hr,
1203 Hu,
1204 Id,
1205 It,
1206 Ja,
1207 Ko,
1208 Lt,
1209 Lv,
1210 Ms,
1211 Mt,
1212 Nb,
1213 Nl,
1214 Pl,
1215 Pt,
1216 PtMinusBr,
1217 Ro,
1218 Ru,
1219 Sk,
1220 Sl,
1221 Sv,
1222 Th,
1223 Tr,
1224 Vi,
1225 Zh,
1226 ZhMinusHk,
1227 ZhMinusTw,
1228 Unknown(String),
1230}
1231impl CheckoutSessionLocale {
1232 pub fn as_str(&self) -> &str {
1233 use CheckoutSessionLocale::*;
1234 match self {
1235 Auto => "auto",
1236 Bg => "bg",
1237 Cs => "cs",
1238 Da => "da",
1239 De => "de",
1240 El => "el",
1241 En => "en",
1242 EnMinusGb => "en-GB",
1243 Es => "es",
1244 EsMinus419 => "es-419",
1245 Et => "et",
1246 Fi => "fi",
1247 Fil => "fil",
1248 Fr => "fr",
1249 FrMinusCa => "fr-CA",
1250 Hr => "hr",
1251 Hu => "hu",
1252 Id => "id",
1253 It => "it",
1254 Ja => "ja",
1255 Ko => "ko",
1256 Lt => "lt",
1257 Lv => "lv",
1258 Ms => "ms",
1259 Mt => "mt",
1260 Nb => "nb",
1261 Nl => "nl",
1262 Pl => "pl",
1263 Pt => "pt",
1264 PtMinusBr => "pt-BR",
1265 Ro => "ro",
1266 Ru => "ru",
1267 Sk => "sk",
1268 Sl => "sl",
1269 Sv => "sv",
1270 Th => "th",
1271 Tr => "tr",
1272 Vi => "vi",
1273 Zh => "zh",
1274 ZhMinusHk => "zh-HK",
1275 ZhMinusTw => "zh-TW",
1276 Unknown(v) => v,
1277 }
1278 }
1279}
1280
1281impl std::str::FromStr for CheckoutSessionLocale {
1282 type Err = std::convert::Infallible;
1283 fn from_str(s: &str) -> Result<Self, Self::Err> {
1284 use CheckoutSessionLocale::*;
1285 match s {
1286 "auto" => Ok(Auto),
1287 "bg" => Ok(Bg),
1288 "cs" => Ok(Cs),
1289 "da" => Ok(Da),
1290 "de" => Ok(De),
1291 "el" => Ok(El),
1292 "en" => Ok(En),
1293 "en-GB" => Ok(EnMinusGb),
1294 "es" => Ok(Es),
1295 "es-419" => Ok(EsMinus419),
1296 "et" => Ok(Et),
1297 "fi" => Ok(Fi),
1298 "fil" => Ok(Fil),
1299 "fr" => Ok(Fr),
1300 "fr-CA" => Ok(FrMinusCa),
1301 "hr" => Ok(Hr),
1302 "hu" => Ok(Hu),
1303 "id" => Ok(Id),
1304 "it" => Ok(It),
1305 "ja" => Ok(Ja),
1306 "ko" => Ok(Ko),
1307 "lt" => Ok(Lt),
1308 "lv" => Ok(Lv),
1309 "ms" => Ok(Ms),
1310 "mt" => Ok(Mt),
1311 "nb" => Ok(Nb),
1312 "nl" => Ok(Nl),
1313 "pl" => Ok(Pl),
1314 "pt" => Ok(Pt),
1315 "pt-BR" => Ok(PtMinusBr),
1316 "ro" => Ok(Ro),
1317 "ru" => Ok(Ru),
1318 "sk" => Ok(Sk),
1319 "sl" => Ok(Sl),
1320 "sv" => Ok(Sv),
1321 "th" => Ok(Th),
1322 "tr" => Ok(Tr),
1323 "vi" => Ok(Vi),
1324 "zh" => Ok(Zh),
1325 "zh-HK" => Ok(ZhMinusHk),
1326 "zh-TW" => Ok(ZhMinusTw),
1327 v => {
1328 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CheckoutSessionLocale");
1329 Ok(Unknown(v.to_owned()))
1330 }
1331 }
1332 }
1333}
1334impl std::fmt::Display for CheckoutSessionLocale {
1335 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1336 f.write_str(self.as_str())
1337 }
1338}
1339
1340impl std::fmt::Debug for CheckoutSessionLocale {
1341 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1342 f.write_str(self.as_str())
1343 }
1344}
1345impl serde::Serialize for CheckoutSessionLocale {
1346 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1347 where
1348 S: serde::Serializer,
1349 {
1350 serializer.serialize_str(self.as_str())
1351 }
1352}
1353impl miniserde::Deserialize for CheckoutSessionLocale {
1354 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1355 crate::Place::new(out)
1356 }
1357}
1358
1359impl miniserde::de::Visitor for crate::Place<CheckoutSessionLocale> {
1360 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1361 use std::str::FromStr;
1362 self.out = Some(CheckoutSessionLocale::from_str(s).expect("infallible"));
1363 Ok(())
1364 }
1365}
1366
1367stripe_types::impl_from_val_with_from_str!(CheckoutSessionLocale);
1368#[cfg(feature = "deserialize")]
1369impl<'de> serde::Deserialize<'de> for CheckoutSessionLocale {
1370 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1371 use std::str::FromStr;
1372 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1373 Ok(Self::from_str(&s).expect("infallible"))
1374 }
1375}
1376#[derive(Clone, Eq, PartialEq)]
1377#[non_exhaustive]
1378pub enum CheckoutSessionMode {
1379 Payment,
1380 Setup,
1381 Subscription,
1382 Unknown(String),
1384}
1385impl CheckoutSessionMode {
1386 pub fn as_str(&self) -> &str {
1387 use CheckoutSessionMode::*;
1388 match self {
1389 Payment => "payment",
1390 Setup => "setup",
1391 Subscription => "subscription",
1392 Unknown(v) => v,
1393 }
1394 }
1395}
1396
1397impl std::str::FromStr for CheckoutSessionMode {
1398 type Err = std::convert::Infallible;
1399 fn from_str(s: &str) -> Result<Self, Self::Err> {
1400 use CheckoutSessionMode::*;
1401 match s {
1402 "payment" => Ok(Payment),
1403 "setup" => Ok(Setup),
1404 "subscription" => Ok(Subscription),
1405 v => {
1406 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CheckoutSessionMode");
1407 Ok(Unknown(v.to_owned()))
1408 }
1409 }
1410 }
1411}
1412impl std::fmt::Display for CheckoutSessionMode {
1413 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1414 f.write_str(self.as_str())
1415 }
1416}
1417
1418impl std::fmt::Debug for CheckoutSessionMode {
1419 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1420 f.write_str(self.as_str())
1421 }
1422}
1423impl serde::Serialize for CheckoutSessionMode {
1424 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1425 where
1426 S: serde::Serializer,
1427 {
1428 serializer.serialize_str(self.as_str())
1429 }
1430}
1431impl miniserde::Deserialize for CheckoutSessionMode {
1432 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1433 crate::Place::new(out)
1434 }
1435}
1436
1437impl miniserde::de::Visitor for crate::Place<CheckoutSessionMode> {
1438 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1439 use std::str::FromStr;
1440 self.out = Some(CheckoutSessionMode::from_str(s).expect("infallible"));
1441 Ok(())
1442 }
1443}
1444
1445stripe_types::impl_from_val_with_from_str!(CheckoutSessionMode);
1446#[cfg(feature = "deserialize")]
1447impl<'de> serde::Deserialize<'de> for CheckoutSessionMode {
1448 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1449 use std::str::FromStr;
1450 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1451 Ok(Self::from_str(&s).expect("infallible"))
1452 }
1453}
1454#[derive(Clone, Eq, PartialEq)]
1455#[non_exhaustive]
1456pub enum CheckoutSessionOriginContext {
1457 MobileApp,
1458 Web,
1459 Unknown(String),
1461}
1462impl CheckoutSessionOriginContext {
1463 pub fn as_str(&self) -> &str {
1464 use CheckoutSessionOriginContext::*;
1465 match self {
1466 MobileApp => "mobile_app",
1467 Web => "web",
1468 Unknown(v) => v,
1469 }
1470 }
1471}
1472
1473impl std::str::FromStr for CheckoutSessionOriginContext {
1474 type Err = std::convert::Infallible;
1475 fn from_str(s: &str) -> Result<Self, Self::Err> {
1476 use CheckoutSessionOriginContext::*;
1477 match s {
1478 "mobile_app" => Ok(MobileApp),
1479 "web" => Ok(Web),
1480 v => {
1481 tracing::warn!(
1482 "Unknown value '{}' for enum '{}'",
1483 v,
1484 "CheckoutSessionOriginContext"
1485 );
1486 Ok(Unknown(v.to_owned()))
1487 }
1488 }
1489 }
1490}
1491impl std::fmt::Display for CheckoutSessionOriginContext {
1492 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1493 f.write_str(self.as_str())
1494 }
1495}
1496
1497impl std::fmt::Debug for CheckoutSessionOriginContext {
1498 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1499 f.write_str(self.as_str())
1500 }
1501}
1502impl serde::Serialize for CheckoutSessionOriginContext {
1503 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1504 where
1505 S: serde::Serializer,
1506 {
1507 serializer.serialize_str(self.as_str())
1508 }
1509}
1510impl miniserde::Deserialize for CheckoutSessionOriginContext {
1511 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1512 crate::Place::new(out)
1513 }
1514}
1515
1516impl miniserde::de::Visitor for crate::Place<CheckoutSessionOriginContext> {
1517 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1518 use std::str::FromStr;
1519 self.out = Some(CheckoutSessionOriginContext::from_str(s).expect("infallible"));
1520 Ok(())
1521 }
1522}
1523
1524stripe_types::impl_from_val_with_from_str!(CheckoutSessionOriginContext);
1525#[cfg(feature = "deserialize")]
1526impl<'de> serde::Deserialize<'de> for CheckoutSessionOriginContext {
1527 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1528 use std::str::FromStr;
1529 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1530 Ok(Self::from_str(&s).expect("infallible"))
1531 }
1532}
1533#[derive(Clone, Eq, PartialEq)]
1534#[non_exhaustive]
1535pub enum CheckoutSessionRedirectOnCompletion {
1536 Always,
1537 IfRequired,
1538 Never,
1539 Unknown(String),
1541}
1542impl CheckoutSessionRedirectOnCompletion {
1543 pub fn as_str(&self) -> &str {
1544 use CheckoutSessionRedirectOnCompletion::*;
1545 match self {
1546 Always => "always",
1547 IfRequired => "if_required",
1548 Never => "never",
1549 Unknown(v) => v,
1550 }
1551 }
1552}
1553
1554impl std::str::FromStr for CheckoutSessionRedirectOnCompletion {
1555 type Err = std::convert::Infallible;
1556 fn from_str(s: &str) -> Result<Self, Self::Err> {
1557 use CheckoutSessionRedirectOnCompletion::*;
1558 match s {
1559 "always" => Ok(Always),
1560 "if_required" => Ok(IfRequired),
1561 "never" => Ok(Never),
1562 v => {
1563 tracing::warn!(
1564 "Unknown value '{}' for enum '{}'",
1565 v,
1566 "CheckoutSessionRedirectOnCompletion"
1567 );
1568 Ok(Unknown(v.to_owned()))
1569 }
1570 }
1571 }
1572}
1573impl std::fmt::Display for CheckoutSessionRedirectOnCompletion {
1574 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1575 f.write_str(self.as_str())
1576 }
1577}
1578
1579impl std::fmt::Debug for CheckoutSessionRedirectOnCompletion {
1580 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1581 f.write_str(self.as_str())
1582 }
1583}
1584impl serde::Serialize for CheckoutSessionRedirectOnCompletion {
1585 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1586 where
1587 S: serde::Serializer,
1588 {
1589 serializer.serialize_str(self.as_str())
1590 }
1591}
1592impl miniserde::Deserialize for CheckoutSessionRedirectOnCompletion {
1593 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1594 crate::Place::new(out)
1595 }
1596}
1597
1598impl miniserde::de::Visitor for crate::Place<CheckoutSessionRedirectOnCompletion> {
1599 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1600 use std::str::FromStr;
1601 self.out = Some(CheckoutSessionRedirectOnCompletion::from_str(s).expect("infallible"));
1602 Ok(())
1603 }
1604}
1605
1606stripe_types::impl_from_val_with_from_str!(CheckoutSessionRedirectOnCompletion);
1607#[cfg(feature = "deserialize")]
1608impl<'de> serde::Deserialize<'de> for CheckoutSessionRedirectOnCompletion {
1609 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1610 use std::str::FromStr;
1611 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1612 Ok(Self::from_str(&s).expect("infallible"))
1613 }
1614}
1615#[derive(Clone, Eq, PartialEq)]
1616#[non_exhaustive]
1617pub enum CheckoutSessionStatus {
1618 Complete,
1619 Expired,
1620 Open,
1621 Unknown(String),
1623}
1624impl CheckoutSessionStatus {
1625 pub fn as_str(&self) -> &str {
1626 use CheckoutSessionStatus::*;
1627 match self {
1628 Complete => "complete",
1629 Expired => "expired",
1630 Open => "open",
1631 Unknown(v) => v,
1632 }
1633 }
1634}
1635
1636impl std::str::FromStr for CheckoutSessionStatus {
1637 type Err = std::convert::Infallible;
1638 fn from_str(s: &str) -> Result<Self, Self::Err> {
1639 use CheckoutSessionStatus::*;
1640 match s {
1641 "complete" => Ok(Complete),
1642 "expired" => Ok(Expired),
1643 "open" => Ok(Open),
1644 v => {
1645 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CheckoutSessionStatus");
1646 Ok(Unknown(v.to_owned()))
1647 }
1648 }
1649 }
1650}
1651impl std::fmt::Display for CheckoutSessionStatus {
1652 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1653 f.write_str(self.as_str())
1654 }
1655}
1656
1657impl std::fmt::Debug for CheckoutSessionStatus {
1658 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1659 f.write_str(self.as_str())
1660 }
1661}
1662impl serde::Serialize for CheckoutSessionStatus {
1663 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1664 where
1665 S: serde::Serializer,
1666 {
1667 serializer.serialize_str(self.as_str())
1668 }
1669}
1670impl miniserde::Deserialize for CheckoutSessionStatus {
1671 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1672 crate::Place::new(out)
1673 }
1674}
1675
1676impl miniserde::de::Visitor for crate::Place<CheckoutSessionStatus> {
1677 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1678 use std::str::FromStr;
1679 self.out = Some(CheckoutSessionStatus::from_str(s).expect("infallible"));
1680 Ok(())
1681 }
1682}
1683
1684stripe_types::impl_from_val_with_from_str!(CheckoutSessionStatus);
1685#[cfg(feature = "deserialize")]
1686impl<'de> serde::Deserialize<'de> for CheckoutSessionStatus {
1687 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1688 use std::str::FromStr;
1689 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1690 Ok(Self::from_str(&s).expect("infallible"))
1691 }
1692}
1693#[derive(Clone, Eq, PartialEq)]
1694#[non_exhaustive]
1695pub enum CheckoutSessionSubmitType {
1696 Auto,
1697 Book,
1698 Donate,
1699 Pay,
1700 Subscribe,
1701 Unknown(String),
1703}
1704impl CheckoutSessionSubmitType {
1705 pub fn as_str(&self) -> &str {
1706 use CheckoutSessionSubmitType::*;
1707 match self {
1708 Auto => "auto",
1709 Book => "book",
1710 Donate => "donate",
1711 Pay => "pay",
1712 Subscribe => "subscribe",
1713 Unknown(v) => v,
1714 }
1715 }
1716}
1717
1718impl std::str::FromStr for CheckoutSessionSubmitType {
1719 type Err = std::convert::Infallible;
1720 fn from_str(s: &str) -> Result<Self, Self::Err> {
1721 use CheckoutSessionSubmitType::*;
1722 match s {
1723 "auto" => Ok(Auto),
1724 "book" => Ok(Book),
1725 "donate" => Ok(Donate),
1726 "pay" => Ok(Pay),
1727 "subscribe" => Ok(Subscribe),
1728 v => {
1729 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CheckoutSessionSubmitType");
1730 Ok(Unknown(v.to_owned()))
1731 }
1732 }
1733 }
1734}
1735impl std::fmt::Display for CheckoutSessionSubmitType {
1736 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1737 f.write_str(self.as_str())
1738 }
1739}
1740
1741impl std::fmt::Debug for CheckoutSessionSubmitType {
1742 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1743 f.write_str(self.as_str())
1744 }
1745}
1746impl serde::Serialize for CheckoutSessionSubmitType {
1747 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1748 where
1749 S: serde::Serializer,
1750 {
1751 serializer.serialize_str(self.as_str())
1752 }
1753}
1754impl miniserde::Deserialize for CheckoutSessionSubmitType {
1755 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1756 crate::Place::new(out)
1757 }
1758}
1759
1760impl miniserde::de::Visitor for crate::Place<CheckoutSessionSubmitType> {
1761 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1762 use std::str::FromStr;
1763 self.out = Some(CheckoutSessionSubmitType::from_str(s).expect("infallible"));
1764 Ok(())
1765 }
1766}
1767
1768stripe_types::impl_from_val_with_from_str!(CheckoutSessionSubmitType);
1769#[cfg(feature = "deserialize")]
1770impl<'de> serde::Deserialize<'de> for CheckoutSessionSubmitType {
1771 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1772 use std::str::FromStr;
1773 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1774 Ok(Self::from_str(&s).expect("infallible"))
1775 }
1776}
1777#[derive(Clone, Eq, PartialEq)]
1778#[non_exhaustive]
1779pub enum CheckoutSessionUiMode {
1780 Custom,
1781 Embedded,
1782 Hosted,
1783 Unknown(String),
1785}
1786impl CheckoutSessionUiMode {
1787 pub fn as_str(&self) -> &str {
1788 use CheckoutSessionUiMode::*;
1789 match self {
1790 Custom => "custom",
1791 Embedded => "embedded",
1792 Hosted => "hosted",
1793 Unknown(v) => v,
1794 }
1795 }
1796}
1797
1798impl std::str::FromStr for CheckoutSessionUiMode {
1799 type Err = std::convert::Infallible;
1800 fn from_str(s: &str) -> Result<Self, Self::Err> {
1801 use CheckoutSessionUiMode::*;
1802 match s {
1803 "custom" => Ok(Custom),
1804 "embedded" => Ok(Embedded),
1805 "hosted" => Ok(Hosted),
1806 v => {
1807 tracing::warn!("Unknown value '{}' for enum '{}'", v, "CheckoutSessionUiMode");
1808 Ok(Unknown(v.to_owned()))
1809 }
1810 }
1811 }
1812}
1813impl std::fmt::Display for CheckoutSessionUiMode {
1814 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1815 f.write_str(self.as_str())
1816 }
1817}
1818
1819impl std::fmt::Debug for CheckoutSessionUiMode {
1820 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1821 f.write_str(self.as_str())
1822 }
1823}
1824impl serde::Serialize for CheckoutSessionUiMode {
1825 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1826 where
1827 S: serde::Serializer,
1828 {
1829 serializer.serialize_str(self.as_str())
1830 }
1831}
1832impl miniserde::Deserialize for CheckoutSessionUiMode {
1833 fn begin(out: &mut Option<Self>) -> &mut dyn miniserde::de::Visitor {
1834 crate::Place::new(out)
1835 }
1836}
1837
1838impl miniserde::de::Visitor for crate::Place<CheckoutSessionUiMode> {
1839 fn string(&mut self, s: &str) -> miniserde::Result<()> {
1840 use std::str::FromStr;
1841 self.out = Some(CheckoutSessionUiMode::from_str(s).expect("infallible"));
1842 Ok(())
1843 }
1844}
1845
1846stripe_types::impl_from_val_with_from_str!(CheckoutSessionUiMode);
1847#[cfg(feature = "deserialize")]
1848impl<'de> serde::Deserialize<'de> for CheckoutSessionUiMode {
1849 fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
1850 use std::str::FromStr;
1851 let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
1852 Ok(Self::from_str(&s).expect("infallible"))
1853 }
1854}