use stripe_client_core::{
RequestBuilder, StripeBlockingClient, StripeClient, StripeMethod, StripeRequest,
};
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ListPaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
created: Option<stripe_types::RangeQueryTs>,
#[serde(skip_serializing_if = "Option::is_none")]
customer: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
customer_account: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
ending_before: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
starting_after: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListPaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListPaymentIntentBuilder").finish_non_exhaustive()
}
}
impl ListPaymentIntentBuilder {
fn new() -> Self {
Self {
created: None,
customer: None,
customer_account: None,
ending_before: None,
expand: None,
limit: None,
starting_after: None,
}
}
}
/// Returns a list of PaymentIntents.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ListPaymentIntent {
inner: ListPaymentIntentBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ListPaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ListPaymentIntent").finish_non_exhaustive()
}
}
impl ListPaymentIntent {
/// Construct a new `ListPaymentIntent`.
pub fn new() -> Self {
Self { inner: ListPaymentIntentBuilder::new() }
}
/// A filter on the list, based on the object `created` field.
/// The value can be a string with an integer Unix timestamp or a dictionary with a number of different query options.
pub fn created(mut self, created: impl Into<stripe_types::RangeQueryTs>) -> Self {
self.inner.created = Some(created.into());
self
}
/// Only return PaymentIntents for the customer that this customer ID specifies.
pub fn customer(mut self, customer: impl Into<String>) -> Self {
self.inner.customer = Some(customer.into());
self
}
/// Only return PaymentIntents for the account representing the customer that this ID specifies.
pub fn customer_account(mut self, customer_account: impl Into<String>) -> Self {
self.inner.customer_account = Some(customer_account.into());
self
}
/// A cursor for use in pagination.
/// `ending_before` is an object ID that defines your place in the list.
/// For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
pub fn ending_before(mut self, ending_before: impl Into<String>) -> Self {
self.inner.ending_before = Some(ending_before.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// A limit on the number of objects to be returned.
/// Limit can range between 1 and 100, and the default is 10.
pub fn limit(mut self, limit: impl Into<i64>) -> Self {
self.inner.limit = Some(limit.into());
self
}
/// A cursor for use in pagination.
/// `starting_after` is an object ID that defines your place in the list.
/// For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
pub fn starting_after(mut self, starting_after: impl Into<String>) -> Self {
self.inner.starting_after = Some(starting_after.into());
self
}
}
impl Default for ListPaymentIntent {
fn default() -> Self {
Self::new()
}
}
impl ListPaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
pub fn paginate(
&self,
) -> stripe_client_core::ListPaginator<stripe_types::List<stripe_shared::PaymentIntent>> {
stripe_client_core::ListPaginator::new_list("/payment_intents", &self.inner)
}
}
impl StripeRequest for ListPaymentIntent {
type Output = stripe_types::List<stripe_shared::PaymentIntent>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/payment_intents").query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct RetrievePaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
client_secret: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrievePaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrievePaymentIntentBuilder").finish_non_exhaustive()
}
}
impl RetrievePaymentIntentBuilder {
fn new() -> Self {
Self { client_secret: None, expand: None }
}
}
/// Retrieves the details of a PaymentIntent that has previously been created.
///
/// You can retrieve a PaymentIntent client-side using a publishable key when the `client_secret` is in the query string.
///
///
/// If you retrieve a PaymentIntent with a publishable key, it only returns a subset of properties.
/// Refer to the [payment intent](https://stripe.com/docs/api#payment_intent_object) object reference for more details.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct RetrievePaymentIntent {
inner: RetrievePaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for RetrievePaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("RetrievePaymentIntent").finish_non_exhaustive()
}
}
impl RetrievePaymentIntent {
/// Construct a new `RetrievePaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: RetrievePaymentIntentBuilder::new() }
}
/// The client secret of the PaymentIntent.
/// We require it if you use a publishable key to retrieve the source.
pub fn client_secret(mut self, client_secret: impl Into<String>) -> Self {
self.inner.client_secret = Some(client_secret.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl RetrievePaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for RetrievePaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(StripeMethod::Get, format!("/payment_intents/{intent}"))
.query(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct SearchPaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
page: Option<String>,
query: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for SearchPaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SearchPaymentIntentBuilder").finish_non_exhaustive()
}
}
impl SearchPaymentIntentBuilder {
fn new(query: impl Into<String>) -> Self {
Self { expand: None, limit: None, page: None, query: query.into() }
}
}
/// Search for PaymentIntents you’ve previously created using Stripe’s [Search Query Language](https://stripe.com/docs/search#search-query-language).
/// Don’t use search in read-after-write flows where strict consistency is necessary.
/// Under normal operating.
/// conditions, data is searchable in less than a minute.
/// Occasionally, propagation of new or updated data can be up.
/// to an hour behind during outages. Search functionality is not available to merchants in India.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct SearchPaymentIntent {
inner: SearchPaymentIntentBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for SearchPaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SearchPaymentIntent").finish_non_exhaustive()
}
}
impl SearchPaymentIntent {
/// Construct a new `SearchPaymentIntent`.
pub fn new(query: impl Into<String>) -> Self {
Self { inner: SearchPaymentIntentBuilder::new(query.into()) }
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// A limit on the number of objects to be returned.
/// Limit can range between 1 and 100, and the default is 10.
pub fn limit(mut self, limit: impl Into<i64>) -> Self {
self.inner.limit = Some(limit.into());
self
}
/// A cursor for pagination across multiple pages of results.
/// Don't include this parameter on the first call.
/// Use the next_page value returned in a previous response to request subsequent results.
pub fn page(mut self, page: impl Into<String>) -> Self {
self.inner.page = Some(page.into());
self
}
}
impl SearchPaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
pub fn paginate(
&self,
) -> stripe_client_core::ListPaginator<stripe_types::SearchList<stripe_shared::PaymentIntent>>
{
stripe_client_core::ListPaginator::new_search_list("/payment_intents/search", &self.inner)
}
}
impl StripeRequest for SearchPaymentIntent {
type Output = stripe_types::SearchList<stripe_shared::PaymentIntent>;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Get, "/payment_intents/search").query(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CreatePaymentIntentBuilder {
amount: i64,
#[serde(skip_serializing_if = "Option::is_none")]
amount_details: Option<CreatePaymentIntentAmountDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
application_fee_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
automatic_payment_methods: Option<CreatePaymentIntentAutomaticPaymentMethods>,
#[serde(skip_serializing_if = "Option::is_none")]
capture_method: Option<stripe_shared::PaymentIntentCaptureMethod>,
#[serde(skip_serializing_if = "Option::is_none")]
confirm: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
confirmation_method: Option<stripe_shared::PaymentIntentConfirmationMethod>,
#[serde(skip_serializing_if = "Option::is_none")]
confirmation_token: Option<String>,
currency: stripe_types::Currency,
#[serde(skip_serializing_if = "Option::is_none")]
customer: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
customer_account: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
error_on_requires_action: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
excluded_payment_method_types:
Option<Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
hooks: Option<AsyncWorkflowsParam>,
#[serde(skip_serializing_if = "Option::is_none")]
mandate: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
mandate_data: Option<CreatePaymentIntentMandateData>,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
off_session: Option<CreatePaymentIntentOffSession>,
#[serde(skip_serializing_if = "Option::is_none")]
on_behalf_of: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_details: Option<CreatePaymentIntentPaymentDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_configuration: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_data: Option<CreatePaymentIntentPaymentMethodData>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_options: Option<CreatePaymentIntentPaymentMethodOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_types: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
radar_options: Option<CreatePaymentIntentRadarOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
receipt_email: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
return_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
setup_future_usage: Option<stripe_shared::PaymentIntentSetupFutureUsage>,
#[serde(skip_serializing_if = "Option::is_none")]
shipping: Option<CreatePaymentIntentShipping>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor_suffix: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
transfer_data: Option<CreatePaymentIntentTransferData>,
#[serde(skip_serializing_if = "Option::is_none")]
transfer_group: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
use_stripe_sdk: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentBuilder").finish_non_exhaustive()
}
}
impl CreatePaymentIntentBuilder {
fn new(amount: impl Into<i64>, currency: impl Into<stripe_types::Currency>) -> Self {
Self {
amount: amount.into(),
amount_details: None,
application_fee_amount: None,
automatic_payment_methods: None,
capture_method: None,
confirm: None,
confirmation_method: None,
confirmation_token: None,
currency: currency.into(),
customer: None,
customer_account: None,
description: None,
error_on_requires_action: None,
excluded_payment_method_types: None,
expand: None,
hooks: None,
mandate: None,
mandate_data: None,
metadata: None,
off_session: None,
on_behalf_of: None,
payment_details: None,
payment_method: None,
payment_method_configuration: None,
payment_method_data: None,
payment_method_options: None,
payment_method_types: None,
radar_options: None,
receipt_email: None,
return_url: None,
setup_future_usage: None,
shipping: None,
statement_descriptor: None,
statement_descriptor_suffix: None,
transfer_data: None,
transfer_group: None,
use_stripe_sdk: None,
}
}
}
/// Provides industry-specific information about the amount.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAmountDetails {
/// The total discount applied on the transaction represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[line_items][#][discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Set to `false` to return arithmetic validation errors in the response without failing the request.
/// Use this when you want the operation to proceed regardless of arithmetic errors in the line item data.
///
/// Omit or set to `true` to immediately return a 400 error when arithmetic validation fails.
/// Use this for strict validation that prevents processing with line item data that has arithmetic inconsistencies.
///
/// For card payments, Stripe doesn't send line item data to card networks if there's an arithmetic validation error.
#[serde(skip_serializing_if = "Option::is_none")]
pub enforce_arithmetic_validation: Option<bool>,
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub line_items: Option<Vec<CreatePaymentIntentAmountDetailsLineItems>>,
/// Contains information about the shipping portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<AmountDetailsShippingParam>,
/// Contains information about the tax portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsTaxParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAmountDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAmountDetails").finish_non_exhaustive()
}
}
impl CreatePaymentIntentAmountDetails {
pub fn new() -> Self {
Self {
discount_amount: None,
enforce_arithmetic_validation: None,
line_items: None,
shipping: None,
tax: None,
}
}
}
impl Default for CreatePaymentIntentAmountDetails {
fn default() -> Self {
Self::new()
}
}
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAmountDetailsLineItems {
/// The discount applied on this line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Payment method-specific information for line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_options:
Option<CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions>,
/// The product code of the line item, such as an SKU.
/// Required for L3 rates.
/// At most 12 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_code: Option<String>,
/// The product name of the line item. Required for L3 rates. At most 1024 characters long.
///
/// For Cards, this field is truncated to 26 alphanumeric characters before being sent to the card networks.
/// For PayPal, this field is truncated to 127 characters.
pub product_name: String,
/// The quantity of items. Required for L3 rates. An integer greater than 0.
pub quantity: u64,
/// Contains information about the tax on the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsLineItemTaxParam>,
/// The unit cost of the line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L3 rates.
/// An integer greater than or equal to 0.
pub unit_cost: i64,
/// A unit of measure for the line item, such as gallons, feet, meters, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_of_measure: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAmountDetailsLineItems {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAmountDetailsLineItems").finish_non_exhaustive()
}
}
impl CreatePaymentIntentAmountDetailsLineItems {
pub fn new(
product_name: impl Into<String>,
quantity: impl Into<u64>,
unit_cost: impl Into<i64>,
) -> Self {
Self {
discount_amount: None,
payment_method_options: None,
product_code: None,
product_name: product_name.into(),
quantity: quantity.into(),
tax: None,
unit_cost: unit_cost.into(),
unit_of_measure: None,
}
}
}
/// Payment method-specific information for line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard>,
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present:
Option<CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent>,
/// This sub-hash contains line item details that are specific to the `klarna` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam>,
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
pub fn new() -> Self {
Self { card: None, card_present: None, klarna: None, paypal: None }
}
}
impl Default for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
/// Type of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub category:
Option<CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory>,
/// Description of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The Stripe account ID of the connected account that sells the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub sold_by: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self { category: None, description: None, sold_by: None }
}
}
impl Default for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Type of the line item.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
DigitalGoods,
Donation,
PhysicalGoods,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match self {
DigitalGoods => "digital_goods",
Donation => "donation",
PhysicalGoods => "physical_goods",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match s {
"digital_goods" => Ok(DigitalGoods),
"donation" => Ok(Donation),
"physical_goods" => Ok(PhysicalGoods),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// When you enable this parameter, this PaymentIntent accepts payment methods that you enable in the Dashboard and that are compatible with this PaymentIntent's other parameters.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentAutomaticPaymentMethods {
/// Controls whether this PaymentIntent will accept redirect-based payment methods.
///
/// Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps.
/// To [confirm](https://docs.stripe.com/api/payment_intents/confirm) this PaymentIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_redirects: Option<CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects>,
/// Whether this feature is enabled.
pub enabled: bool,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAutomaticPaymentMethods {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentAutomaticPaymentMethods").finish_non_exhaustive()
}
}
impl CreatePaymentIntentAutomaticPaymentMethods {
pub fn new(enabled: impl Into<bool>) -> Self {
Self { allow_redirects: None, enabled: enabled.into() }
}
}
/// Controls whether this PaymentIntent will accept redirect-based payment methods.
///
/// Redirect-based payment methods may require your customer to be redirected to a payment method's app or site for authentication or additional steps.
/// To [confirm](https://docs.stripe.com/api/payment_intents/confirm) this PaymentIntent, you may be required to provide a `return_url` to redirect customers back to your site after they authenticate or complete the payment.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
Always,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects::*;
match self {
Always => "always",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects::*;
match s {
"always" => Ok(Always),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentAutomaticPaymentMethodsAllowRedirects {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// This hash contains details about the Mandate to create.
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentMandateData {
/// This hash contains details about the customer acceptance of the Mandate.
pub customer_acceptance: CreatePaymentIntentMandateDataCustomerAcceptance,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentMandateData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentMandateData").finish_non_exhaustive()
}
}
impl CreatePaymentIntentMandateData {
pub fn new(
customer_acceptance: impl Into<CreatePaymentIntentMandateDataCustomerAcceptance>,
) -> Self {
Self { customer_acceptance: customer_acceptance.into() }
}
}
/// This hash contains details about the customer acceptance of the Mandate.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentMandateDataCustomerAcceptance {
/// The time at which the customer accepted the Mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub accepted_at: Option<stripe_types::Timestamp>,
/// If this is a Mandate accepted offline, this hash contains details about the offline acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub offline: Option<miniserde::json::Value>,
/// If this is a Mandate accepted online, this hash contains details about the online acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
pub online: Option<OnlineParam>,
/// The type of customer acceptance information included with the Mandate.
/// One of `online` or `offline`.
#[serde(rename = "type")]
pub type_: CreatePaymentIntentMandateDataCustomerAcceptanceType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentMandateDataCustomerAcceptance {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentMandateDataCustomerAcceptance").finish_non_exhaustive()
}
}
impl CreatePaymentIntentMandateDataCustomerAcceptance {
pub fn new(type_: impl Into<CreatePaymentIntentMandateDataCustomerAcceptanceType>) -> Self {
Self { accepted_at: None, offline: None, online: None, type_: type_.into() }
}
}
/// The type of customer acceptance information included with the Mandate.
/// One of `online` or `offline`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentMandateDataCustomerAcceptanceType {
Offline,
Online,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentMandateDataCustomerAcceptanceType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentMandateDataCustomerAcceptanceType::*;
match self {
Offline => "offline",
Online => "online",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentMandateDataCustomerAcceptanceType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentMandateDataCustomerAcceptanceType::*;
match s {
"offline" => Ok(Offline),
"online" => Ok(Online),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentMandateDataCustomerAcceptanceType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentMandateDataCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentMandateDataCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentMandateDataCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentMandateDataCustomerAcceptanceType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentMandateDataCustomerAcceptanceType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentMandateDataCustomerAcceptanceType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Set to `true` to indicate that the customer isn't in your checkout flow during this payment attempt and can't authenticate.
/// Use this parameter in scenarios where you collect card details and [charge them later](https://docs.stripe.com/payments/cards/charging-saved-cards).
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum CreatePaymentIntentOffSession {
OneOff,
Recurring,
#[serde(untagged)]
Bool(bool),
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentOffSession {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentOffSession").finish_non_exhaustive()
}
}
/// Provides industry-specific information about the charge.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentDetails {
/// A unique value to identify the customer. This field is available only for card payments.
///
/// This field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_reference: Option<String>,
/// A unique value assigned by the business to identify the transaction. Required for L2 and L3 rates.
///
/// For Cards, this field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
/// For Klarna, this field is truncated to 255 characters and is visible to customers when they view the order in the Klarna app.
#[serde(skip_serializing_if = "Option::is_none")]
pub order_reference: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentDetails").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentDetails {
pub fn new() -> Self {
Self { customer_reference: None, order_reference: None }
}
}
impl Default for CreatePaymentIntentPaymentDetails {
fn default() -> Self {
Self::new()
}
}
/// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear
/// in the [payment_method](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-payment_method).
/// property on the PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodData {
/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<PaymentMethodParam>,
/// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub affirm: Option<miniserde::json::Value>,
/// If this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub afterpay_clearpay: Option<miniserde::json::Value>,
/// If this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub alipay: Option<miniserde::json::Value>,
/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
/// The field defaults to `unspecified`.
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_redisplay: Option<CreatePaymentIntentPaymentMethodDataAllowRedisplay>,
/// If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub alma: Option<miniserde::json::Value>,
/// If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub amazon_pay: Option<miniserde::json::Value>,
/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<CreatePaymentIntentPaymentMethodDataAuBecsDebit>,
/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<CreatePaymentIntentPaymentMethodDataBacsDebit>,
/// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub bancontact: Option<miniserde::json::Value>,
/// If this is a `billie` PaymentMethod, this hash contains details about the Billie payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub billie: Option<miniserde::json::Value>,
/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_details: Option<CreatePaymentIntentPaymentMethodDataBillingDetails>,
/// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub blik: Option<miniserde::json::Value>,
/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<CreatePaymentIntentPaymentMethodDataBoleto>,
/// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub cashapp: Option<miniserde::json::Value>,
/// If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub crypto: Option<miniserde::json::Value>,
/// If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub customer_balance: Option<miniserde::json::Value>,
/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps: Option<CreatePaymentIntentPaymentMethodDataEps>,
/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<CreatePaymentIntentPaymentMethodDataFpx>,
/// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub giropay: Option<miniserde::json::Value>,
/// If this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub grabpay: Option<miniserde::json::Value>,
/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<CreatePaymentIntentPaymentMethodDataIdeal>,
/// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub interac_present: Option<miniserde::json::Value>,
/// If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub kakao_pay: Option<miniserde::json::Value>,
/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<CreatePaymentIntentPaymentMethodDataKlarna>,
/// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub konbini: Option<miniserde::json::Value>,
/// If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub kr_card: Option<miniserde::json::Value>,
/// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub link: Option<miniserde::json::Value>,
/// If this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub mb_way: Option<miniserde::json::Value>,
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<std::collections::HashMap<String, String>>,
/// If this is a `mobilepay` PaymentMethod, this hash contains details about the MobilePay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub mobilepay: Option<miniserde::json::Value>,
/// If this is a `multibanco` PaymentMethod, this hash contains details about the Multibanco payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub multibanco: Option<miniserde::json::Value>,
/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub naver_pay: Option<CreatePaymentIntentPaymentMethodDataNaverPay>,
/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub nz_bank_account: Option<CreatePaymentIntentPaymentMethodDataNzBankAccount>,
/// If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub oxxo: Option<miniserde::json::Value>,
/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub p24: Option<CreatePaymentIntentPaymentMethodDataP24>,
/// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pay_by_bank: Option<miniserde::json::Value>,
/// If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub payco: Option<miniserde::json::Value>,
/// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub paynow: Option<miniserde::json::Value>,
/// If this is a `paypal` PaymentMethod, this hash contains details about the PayPal payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub paypal: Option<miniserde::json::Value>,
/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub payto: Option<CreatePaymentIntentPaymentMethodDataPayto>,
/// If this is a `pix` PaymentMethod, this hash contains details about the Pix payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pix: Option<miniserde::json::Value>,
/// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub promptpay: Option<miniserde::json::Value>,
/// Options to configure Radar.
/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
#[serde(skip_serializing_if = "Option::is_none")]
pub radar_options: Option<CreatePaymentIntentPaymentMethodDataRadarOptions>,
/// If this is a `revolut_pay` PaymentMethod, this hash contains details about the Revolut Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub revolut_pay: Option<miniserde::json::Value>,
/// If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub samsung_pay: Option<miniserde::json::Value>,
/// If this is a `satispay` PaymentMethod, this hash contains details about the Satispay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub satispay: Option<miniserde::json::Value>,
/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<CreatePaymentIntentPaymentMethodDataSepaDebit>,
/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<CreatePaymentIntentPaymentMethodDataSofort>,
/// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub swish: Option<miniserde::json::Value>,
/// If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub twint: Option<miniserde::json::Value>,
/// The type of the PaymentMethod.
/// An additional hash is included on the PaymentMethod with a name matching this value.
/// It contains additional information specific to the PaymentMethod type.
#[serde(rename = "type")]
pub type_: CreatePaymentIntentPaymentMethodDataType,
/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub upi: Option<CreatePaymentIntentPaymentMethodDataUpi>,
/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<CreatePaymentIntentPaymentMethodDataUsBankAccount>,
/// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub wechat_pay: Option<miniserde::json::Value>,
/// If this is a `zip` PaymentMethod, this hash contains details about the Zip payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub zip: Option<miniserde::json::Value>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodData").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodData {
pub fn new(type_: impl Into<CreatePaymentIntentPaymentMethodDataType>) -> Self {
Self {
acss_debit: None,
affirm: None,
afterpay_clearpay: None,
alipay: None,
allow_redisplay: None,
alma: None,
amazon_pay: None,
au_becs_debit: None,
bacs_debit: None,
bancontact: None,
billie: None,
billing_details: None,
blik: None,
boleto: None,
cashapp: None,
crypto: None,
customer_balance: None,
eps: None,
fpx: None,
giropay: None,
grabpay: None,
ideal: None,
interac_present: None,
kakao_pay: None,
klarna: None,
konbini: None,
kr_card: None,
link: None,
mb_way: None,
metadata: None,
mobilepay: None,
multibanco: None,
naver_pay: None,
nz_bank_account: None,
oxxo: None,
p24: None,
pay_by_bank: None,
payco: None,
paynow: None,
paypal: None,
payto: None,
pix: None,
promptpay: None,
radar_options: None,
revolut_pay: None,
samsung_pay: None,
satispay: None,
sepa_debit: None,
sofort: None,
swish: None,
twint: None,
type_: type_.into(),
upi: None,
us_bank_account: None,
wechat_pay: None,
zip: None,
}
}
}
/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
/// The field defaults to `unspecified`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataAllowRedisplay {
Always,
Limited,
Unspecified,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataAllowRedisplay {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataAllowRedisplay::*;
match self {
Always => "always",
Limited => "limited",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataAllowRedisplay {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataAllowRedisplay::*;
match s {
"always" => Ok(Always),
"limited" => Ok(Limited),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataAllowRedisplay"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataAllowRedisplay))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataAllowRedisplay {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataAllowRedisplay {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataAuBecsDebit {
/// The account number for the bank account.
pub account_number: String,
/// Bank-State-Branch number of the bank account.
pub bsb_number: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataAuBecsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataAuBecsDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataAuBecsDebit {
pub fn new(account_number: impl Into<String>, bsb_number: impl Into<String>) -> Self {
Self { account_number: account_number.into(), bsb_number: bsb_number.into() }
}
}
/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataBacsDebit {
/// Account number of the bank account that the funds will be debited from.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Sort code of the bank account. (e.g., `10-20-30`)
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataBacsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataBacsDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataBacsDebit {
pub fn new() -> Self {
Self { account_number: None, sort_code: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataBacsDebit {
fn default() -> Self {
Self::new()
}
}
/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataBillingDetails {
/// Billing address.
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<CreatePaymentIntentPaymentMethodDataBillingDetailsAddress>,
/// Email address.
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
/// Full name.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Billing phone number (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
/// Taxpayer identification number.
/// Used only for transactions between LATAM buyers and non-LATAM sellers.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_id: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataBillingDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataBillingDetails").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataBillingDetails {
pub fn new() -> Self {
Self { address: None, email: None, name: None, phone: None, tax_id: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataBillingDetails {
fn default() -> Self {
Self::new()
}
}
/// Billing address.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataBillingDetailsAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Address line 1, such as the street, PO Box, or company name.
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2, such as the apartment, suite, unit, or building.
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataBillingDetailsAddress {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataBillingDetailsAddress")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataBillingDetailsAddress {
pub fn new() -> Self {
Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataBillingDetailsAddress {
fn default() -> Self {
Self::new()
}
}
/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataBoleto {
/// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
pub tax_id: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataBoleto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataBoleto").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataBoleto {
pub fn new(tax_id: impl Into<String>) -> Self {
Self { tax_id: tax_id.into() }
}
}
/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataEps {
/// The customer's bank.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<CreatePaymentIntentPaymentMethodDataEpsBank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataEps {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataEps").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataEps {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataEps {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataEpsBank {
ArzteUndApothekerBank,
AustrianAnadiBankAg,
BankAustria,
BankhausCarlSpangler,
BankhausSchelhammerUndSchatteraAg,
BawagPskAg,
BksBankAg,
BrullKallmusBankAg,
BtvVierLanderBank,
CapitalBankGraweGruppeAg,
DeutscheBankAg,
Dolomitenbank,
EasybankAg,
ErsteBankUndSparkassen,
HypoAlpeadriabankInternationalAg,
HypoBankBurgenlandAktiengesellschaft,
HypoNoeLbFurNiederosterreichUWien,
HypoOberosterreichSalzburgSteiermark,
HypoTirolBankAg,
HypoVorarlbergBankAg,
MarchfelderBank,
OberbankAg,
RaiffeisenBankengruppeOsterreich,
SchoellerbankAg,
SpardaBankWien,
VolksbankGruppe,
VolkskreditbankAg,
VrBankBraunau,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataEpsBank {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataEpsBank::*;
match self {
ArzteUndApothekerBank => "arzte_und_apotheker_bank",
AustrianAnadiBankAg => "austrian_anadi_bank_ag",
BankAustria => "bank_austria",
BankhausCarlSpangler => "bankhaus_carl_spangler",
BankhausSchelhammerUndSchatteraAg => "bankhaus_schelhammer_und_schattera_ag",
BawagPskAg => "bawag_psk_ag",
BksBankAg => "bks_bank_ag",
BrullKallmusBankAg => "brull_kallmus_bank_ag",
BtvVierLanderBank => "btv_vier_lander_bank",
CapitalBankGraweGruppeAg => "capital_bank_grawe_gruppe_ag",
DeutscheBankAg => "deutsche_bank_ag",
Dolomitenbank => "dolomitenbank",
EasybankAg => "easybank_ag",
ErsteBankUndSparkassen => "erste_bank_und_sparkassen",
HypoAlpeadriabankInternationalAg => "hypo_alpeadriabank_international_ag",
HypoBankBurgenlandAktiengesellschaft => "hypo_bank_burgenland_aktiengesellschaft",
HypoNoeLbFurNiederosterreichUWien => "hypo_noe_lb_fur_niederosterreich_u_wien",
HypoOberosterreichSalzburgSteiermark => "hypo_oberosterreich_salzburg_steiermark",
HypoTirolBankAg => "hypo_tirol_bank_ag",
HypoVorarlbergBankAg => "hypo_vorarlberg_bank_ag",
MarchfelderBank => "marchfelder_bank",
OberbankAg => "oberbank_ag",
RaiffeisenBankengruppeOsterreich => "raiffeisen_bankengruppe_osterreich",
SchoellerbankAg => "schoellerbank_ag",
SpardaBankWien => "sparda_bank_wien",
VolksbankGruppe => "volksbank_gruppe",
VolkskreditbankAg => "volkskreditbank_ag",
VrBankBraunau => "vr_bank_braunau",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataEpsBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataEpsBank::*;
match s {
"arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank),
"austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg),
"bank_austria" => Ok(BankAustria),
"bankhaus_carl_spangler" => Ok(BankhausCarlSpangler),
"bankhaus_schelhammer_und_schattera_ag" => Ok(BankhausSchelhammerUndSchatteraAg),
"bawag_psk_ag" => Ok(BawagPskAg),
"bks_bank_ag" => Ok(BksBankAg),
"brull_kallmus_bank_ag" => Ok(BrullKallmusBankAg),
"btv_vier_lander_bank" => Ok(BtvVierLanderBank),
"capital_bank_grawe_gruppe_ag" => Ok(CapitalBankGraweGruppeAg),
"deutsche_bank_ag" => Ok(DeutscheBankAg),
"dolomitenbank" => Ok(Dolomitenbank),
"easybank_ag" => Ok(EasybankAg),
"erste_bank_und_sparkassen" => Ok(ErsteBankUndSparkassen),
"hypo_alpeadriabank_international_ag" => Ok(HypoAlpeadriabankInternationalAg),
"hypo_bank_burgenland_aktiengesellschaft" => Ok(HypoBankBurgenlandAktiengesellschaft),
"hypo_noe_lb_fur_niederosterreich_u_wien" => Ok(HypoNoeLbFurNiederosterreichUWien),
"hypo_oberosterreich_salzburg_steiermark" => Ok(HypoOberosterreichSalzburgSteiermark),
"hypo_tirol_bank_ag" => Ok(HypoTirolBankAg),
"hypo_vorarlberg_bank_ag" => Ok(HypoVorarlbergBankAg),
"marchfelder_bank" => Ok(MarchfelderBank),
"oberbank_ag" => Ok(OberbankAg),
"raiffeisen_bankengruppe_osterreich" => Ok(RaiffeisenBankengruppeOsterreich),
"schoellerbank_ag" => Ok(SchoellerbankAg),
"sparda_bank_wien" => Ok(SpardaBankWien),
"volksbank_gruppe" => Ok(VolksbankGruppe),
"volkskreditbank_ag" => Ok(VolkskreditbankAg),
"vr_bank_braunau" => Ok(VrBankBraunau),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataEpsBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataEpsBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataEpsBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataEpsBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataFpx {
/// Account holder type for FPX transaction
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type: Option<CreatePaymentIntentPaymentMethodDataFpxAccountHolderType>,
/// The customer's bank.
pub bank: CreatePaymentIntentPaymentMethodDataFpxBank,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpx {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataFpx").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataFpx {
pub fn new(bank: impl Into<CreatePaymentIntentPaymentMethodDataFpxBank>) -> Self {
Self { account_holder_type: None, bank: bank.into() }
}
}
/// Account holder type for FPX transaction
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
Company,
Individual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataFpxAccountHolderType::*;
match self {
Company => "company",
Individual => "individual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataFpxAccountHolderType::*;
match s {
"company" => Ok(Company),
"individual" => Ok(Individual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataFpxAccountHolderType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataFpxAccountHolderType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataFpxBank {
AffinBank,
Agrobank,
AllianceBank,
Ambank,
BankIslam,
BankMuamalat,
BankOfChina,
BankRakyat,
Bsn,
Cimb,
DeutscheBank,
HongLeongBank,
Hsbc,
Kfh,
Maybank2e,
Maybank2u,
Ocbc,
PbEnterprise,
PublicBank,
Rhb,
StandardChartered,
Uob,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataFpxBank {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataFpxBank::*;
match self {
AffinBank => "affin_bank",
Agrobank => "agrobank",
AllianceBank => "alliance_bank",
Ambank => "ambank",
BankIslam => "bank_islam",
BankMuamalat => "bank_muamalat",
BankOfChina => "bank_of_china",
BankRakyat => "bank_rakyat",
Bsn => "bsn",
Cimb => "cimb",
DeutscheBank => "deutsche_bank",
HongLeongBank => "hong_leong_bank",
Hsbc => "hsbc",
Kfh => "kfh",
Maybank2e => "maybank2e",
Maybank2u => "maybank2u",
Ocbc => "ocbc",
PbEnterprise => "pb_enterprise",
PublicBank => "public_bank",
Rhb => "rhb",
StandardChartered => "standard_chartered",
Uob => "uob",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataFpxBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataFpxBank::*;
match s {
"affin_bank" => Ok(AffinBank),
"agrobank" => Ok(Agrobank),
"alliance_bank" => Ok(AllianceBank),
"ambank" => Ok(Ambank),
"bank_islam" => Ok(BankIslam),
"bank_muamalat" => Ok(BankMuamalat),
"bank_of_china" => Ok(BankOfChina),
"bank_rakyat" => Ok(BankRakyat),
"bsn" => Ok(Bsn),
"cimb" => Ok(Cimb),
"deutsche_bank" => Ok(DeutscheBank),
"hong_leong_bank" => Ok(HongLeongBank),
"hsbc" => Ok(Hsbc),
"kfh" => Ok(Kfh),
"maybank2e" => Ok(Maybank2e),
"maybank2u" => Ok(Maybank2u),
"ocbc" => Ok(Ocbc),
"pb_enterprise" => Ok(PbEnterprise),
"public_bank" => Ok(PublicBank),
"rhb" => Ok(Rhb),
"standard_chartered" => Ok(StandardChartered),
"uob" => Ok(Uob),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataFpxBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataFpxBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataFpxBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataFpxBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataIdeal {
/// The customer's bank.
/// Only use this parameter for existing customers.
/// Don't use it for new customers.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<CreatePaymentIntentPaymentMethodDataIdealBank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataIdeal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataIdeal").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataIdeal {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataIdeal {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
/// Only use this parameter for existing customers.
/// Don't use it for new customers.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataIdealBank {
AbnAmro,
Adyen,
AsnBank,
Bunq,
Buut,
Finom,
Handelsbanken,
Ing,
Knab,
Mollie,
Moneyou,
N26,
Nn,
Rabobank,
Regiobank,
Revolut,
SnsBank,
TriodosBank,
VanLanschot,
Yoursafe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataIdealBank {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataIdealBank::*;
match self {
AbnAmro => "abn_amro",
Adyen => "adyen",
AsnBank => "asn_bank",
Bunq => "bunq",
Buut => "buut",
Finom => "finom",
Handelsbanken => "handelsbanken",
Ing => "ing",
Knab => "knab",
Mollie => "mollie",
Moneyou => "moneyou",
N26 => "n26",
Nn => "nn",
Rabobank => "rabobank",
Regiobank => "regiobank",
Revolut => "revolut",
SnsBank => "sns_bank",
TriodosBank => "triodos_bank",
VanLanschot => "van_lanschot",
Yoursafe => "yoursafe",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataIdealBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataIdealBank::*;
match s {
"abn_amro" => Ok(AbnAmro),
"adyen" => Ok(Adyen),
"asn_bank" => Ok(AsnBank),
"bunq" => Ok(Bunq),
"buut" => Ok(Buut),
"finom" => Ok(Finom),
"handelsbanken" => Ok(Handelsbanken),
"ing" => Ok(Ing),
"knab" => Ok(Knab),
"mollie" => Ok(Mollie),
"moneyou" => Ok(Moneyou),
"n26" => Ok(N26),
"nn" => Ok(Nn),
"rabobank" => Ok(Rabobank),
"regiobank" => Ok(Regiobank),
"revolut" => Ok(Revolut),
"sns_bank" => Ok(SnsBank),
"triodos_bank" => Ok(TriodosBank),
"van_lanschot" => Ok(VanLanschot),
"yoursafe" => Ok(Yoursafe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataIdealBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataIdealBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataIdealBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataIdealBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataKlarna {
/// Customer's date of birth
#[serde(skip_serializing_if = "Option::is_none")]
pub dob: Option<DateOfBirth>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataKlarna {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataKlarna").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataKlarna {
pub fn new() -> Self {
Self { dob: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataKlarna {
fn default() -> Self {
Self::new()
}
}
/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataNaverPay {
/// Whether to use Naver Pay points or a card to fund this transaction.
/// If not provided, this defaults to `card`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding: Option<CreatePaymentIntentPaymentMethodDataNaverPayFunding>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataNaverPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataNaverPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataNaverPay {
pub fn new() -> Self {
Self { funding: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataNaverPay {
fn default() -> Self {
Self::new()
}
}
/// Whether to use Naver Pay points or a card to fund this transaction.
/// If not provided, this defaults to `card`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataNaverPayFunding {
Card,
Points,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataNaverPayFunding {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataNaverPayFunding::*;
match self {
Card => "card",
Points => "points",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataNaverPayFunding {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataNaverPayFunding::*;
match s {
"card" => Ok(Card),
"points" => Ok(Points),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataNaverPayFunding"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataNaverPayFunding))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataNaverPayFunding {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataNaverPayFunding {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataNzBankAccount {
/// The name on the bank account.
/// Only required if the account holder name is different from the name of the authorized signatory collected in the PaymentMethod’s billing details.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_name: Option<String>,
/// The account number for the bank account.
pub account_number: String,
/// The numeric code for the bank account's bank.
pub bank_code: String,
/// The numeric code for the bank account's bank branch.
pub branch_code: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// The suffix of the bank account number.
pub suffix: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataNzBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataNzBankAccount").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataNzBankAccount {
pub fn new(
account_number: impl Into<String>,
bank_code: impl Into<String>,
branch_code: impl Into<String>,
suffix: impl Into<String>,
) -> Self {
Self {
account_holder_name: None,
account_number: account_number.into(),
bank_code: bank_code.into(),
branch_code: branch_code.into(),
reference: None,
suffix: suffix.into(),
}
}
}
/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataP24 {
/// The customer's bank.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<CreatePaymentIntentPaymentMethodDataP24Bank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataP24 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataP24").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataP24 {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataP24 {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataP24Bank {
AliorBank,
BankMillennium,
BankNowyBfgSa,
BankPekaoSa,
BankiSpbdzielcze,
Blik,
BnpParibas,
Boz,
CitiHandlowy,
CreditAgricole,
Envelobank,
EtransferPocztowy24,
GetinBank,
Ideabank,
Ing,
Inteligo,
MbankMtransfer,
NestPrzelew,
NoblePay,
PbacZIpko,
PlusBank,
SantanderPrzelew24,
TmobileUsbugiBankowe,
ToyotaBank,
Velobank,
VolkswagenBank,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataP24Bank {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataP24Bank::*;
match self {
AliorBank => "alior_bank",
BankMillennium => "bank_millennium",
BankNowyBfgSa => "bank_nowy_bfg_sa",
BankPekaoSa => "bank_pekao_sa",
BankiSpbdzielcze => "banki_spbdzielcze",
Blik => "blik",
BnpParibas => "bnp_paribas",
Boz => "boz",
CitiHandlowy => "citi_handlowy",
CreditAgricole => "credit_agricole",
Envelobank => "envelobank",
EtransferPocztowy24 => "etransfer_pocztowy24",
GetinBank => "getin_bank",
Ideabank => "ideabank",
Ing => "ing",
Inteligo => "inteligo",
MbankMtransfer => "mbank_mtransfer",
NestPrzelew => "nest_przelew",
NoblePay => "noble_pay",
PbacZIpko => "pbac_z_ipko",
PlusBank => "plus_bank",
SantanderPrzelew24 => "santander_przelew24",
TmobileUsbugiBankowe => "tmobile_usbugi_bankowe",
ToyotaBank => "toyota_bank",
Velobank => "velobank",
VolkswagenBank => "volkswagen_bank",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataP24Bank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataP24Bank::*;
match s {
"alior_bank" => Ok(AliorBank),
"bank_millennium" => Ok(BankMillennium),
"bank_nowy_bfg_sa" => Ok(BankNowyBfgSa),
"bank_pekao_sa" => Ok(BankPekaoSa),
"banki_spbdzielcze" => Ok(BankiSpbdzielcze),
"blik" => Ok(Blik),
"bnp_paribas" => Ok(BnpParibas),
"boz" => Ok(Boz),
"citi_handlowy" => Ok(CitiHandlowy),
"credit_agricole" => Ok(CreditAgricole),
"envelobank" => Ok(Envelobank),
"etransfer_pocztowy24" => Ok(EtransferPocztowy24),
"getin_bank" => Ok(GetinBank),
"ideabank" => Ok(Ideabank),
"ing" => Ok(Ing),
"inteligo" => Ok(Inteligo),
"mbank_mtransfer" => Ok(MbankMtransfer),
"nest_przelew" => Ok(NestPrzelew),
"noble_pay" => Ok(NoblePay),
"pbac_z_ipko" => Ok(PbacZIpko),
"plus_bank" => Ok(PlusBank),
"santander_przelew24" => Ok(SantanderPrzelew24),
"tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe),
"toyota_bank" => Ok(ToyotaBank),
"velobank" => Ok(Velobank),
"volkswagen_bank" => Ok(VolkswagenBank),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataP24Bank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataP24Bank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataP24Bank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataP24Bank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataPayto {
/// The account number for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Bank-State-Branch number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bsb_number: Option<String>,
/// The PayID alias for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub pay_id: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataPayto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataPayto").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataPayto {
pub fn new() -> Self {
Self { account_number: None, bsb_number: None, pay_id: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataPayto {
fn default() -> Self {
Self::new()
}
}
/// Options to configure Radar.
/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataRadarOptions {
/// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataRadarOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataRadarOptions").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataRadarOptions {
pub fn new() -> Self {
Self { session: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataRadarOptions {
fn default() -> Self {
Self::new()
}
}
/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataSepaDebit {
/// IBAN of the bank account.
pub iban: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataSepaDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataSepaDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataSepaDebit {
pub fn new(iban: impl Into<String>) -> Self {
Self { iban: iban.into() }
}
}
/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataSofort {
/// Two-letter ISO code representing the country the bank account is located in.
pub country: CreatePaymentIntentPaymentMethodDataSofortCountry,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataSofort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataSofort").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataSofort {
pub fn new(country: impl Into<CreatePaymentIntentPaymentMethodDataSofortCountry>) -> Self {
Self { country: country.into() }
}
}
/// Two-letter ISO code representing the country the bank account is located in.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataSofortCountry {
At,
Be,
De,
Es,
It,
Nl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataSofortCountry {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataSofortCountry::*;
match self {
At => "AT",
Be => "BE",
De => "DE",
Es => "ES",
It => "IT",
Nl => "NL",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataSofortCountry {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataSofortCountry::*;
match s {
"AT" => Ok(At),
"BE" => Ok(Be),
"DE" => Ok(De),
"ES" => Ok(Es),
"IT" => Ok(It),
"NL" => Ok(Nl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataSofortCountry"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataSofortCountry))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataSofortCountry {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataSofortCountry {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The type of the PaymentMethod.
/// An additional hash is included on the PaymentMethod with a name matching this value.
/// It contains additional information specific to the PaymentMethod type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataType {
AcssDebit,
Affirm,
AfterpayClearpay,
Alipay,
Alma,
AmazonPay,
AuBecsDebit,
BacsDebit,
Bancontact,
Billie,
Blik,
Boleto,
Cashapp,
Crypto,
CustomerBalance,
Eps,
Fpx,
Giropay,
Grabpay,
Ideal,
KakaoPay,
Klarna,
Konbini,
KrCard,
Link,
MbWay,
Mobilepay,
Multibanco,
NaverPay,
NzBankAccount,
Oxxo,
P24,
PayByBank,
Payco,
Paynow,
Paypal,
Payto,
Pix,
Promptpay,
RevolutPay,
SamsungPay,
Satispay,
SepaDebit,
Sofort,
Swish,
Twint,
Upi,
UsBankAccount,
WechatPay,
Zip,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataType::*;
match self {
AcssDebit => "acss_debit",
Affirm => "affirm",
AfterpayClearpay => "afterpay_clearpay",
Alipay => "alipay",
Alma => "alma",
AmazonPay => "amazon_pay",
AuBecsDebit => "au_becs_debit",
BacsDebit => "bacs_debit",
Bancontact => "bancontact",
Billie => "billie",
Blik => "blik",
Boleto => "boleto",
Cashapp => "cashapp",
Crypto => "crypto",
CustomerBalance => "customer_balance",
Eps => "eps",
Fpx => "fpx",
Giropay => "giropay",
Grabpay => "grabpay",
Ideal => "ideal",
KakaoPay => "kakao_pay",
Klarna => "klarna",
Konbini => "konbini",
KrCard => "kr_card",
Link => "link",
MbWay => "mb_way",
Mobilepay => "mobilepay",
Multibanco => "multibanco",
NaverPay => "naver_pay",
NzBankAccount => "nz_bank_account",
Oxxo => "oxxo",
P24 => "p24",
PayByBank => "pay_by_bank",
Payco => "payco",
Paynow => "paynow",
Paypal => "paypal",
Payto => "payto",
Pix => "pix",
Promptpay => "promptpay",
RevolutPay => "revolut_pay",
SamsungPay => "samsung_pay",
Satispay => "satispay",
SepaDebit => "sepa_debit",
Sofort => "sofort",
Swish => "swish",
Twint => "twint",
Upi => "upi",
UsBankAccount => "us_bank_account",
WechatPay => "wechat_pay",
Zip => "zip",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataType::*;
match s {
"acss_debit" => Ok(AcssDebit),
"affirm" => Ok(Affirm),
"afterpay_clearpay" => Ok(AfterpayClearpay),
"alipay" => Ok(Alipay),
"alma" => Ok(Alma),
"amazon_pay" => Ok(AmazonPay),
"au_becs_debit" => Ok(AuBecsDebit),
"bacs_debit" => Ok(BacsDebit),
"bancontact" => Ok(Bancontact),
"billie" => Ok(Billie),
"blik" => Ok(Blik),
"boleto" => Ok(Boleto),
"cashapp" => Ok(Cashapp),
"crypto" => Ok(Crypto),
"customer_balance" => Ok(CustomerBalance),
"eps" => Ok(Eps),
"fpx" => Ok(Fpx),
"giropay" => Ok(Giropay),
"grabpay" => Ok(Grabpay),
"ideal" => Ok(Ideal),
"kakao_pay" => Ok(KakaoPay),
"klarna" => Ok(Klarna),
"konbini" => Ok(Konbini),
"kr_card" => Ok(KrCard),
"link" => Ok(Link),
"mb_way" => Ok(MbWay),
"mobilepay" => Ok(Mobilepay),
"multibanco" => Ok(Multibanco),
"naver_pay" => Ok(NaverPay),
"nz_bank_account" => Ok(NzBankAccount),
"oxxo" => Ok(Oxxo),
"p24" => Ok(P24),
"pay_by_bank" => Ok(PayByBank),
"payco" => Ok(Payco),
"paynow" => Ok(Paynow),
"paypal" => Ok(Paypal),
"payto" => Ok(Payto),
"pix" => Ok(Pix),
"promptpay" => Ok(Promptpay),
"revolut_pay" => Ok(RevolutPay),
"samsung_pay" => Ok(SamsungPay),
"satispay" => Ok(Satispay),
"sepa_debit" => Ok(SepaDebit),
"sofort" => Ok(Sofort),
"swish" => Ok(Swish),
"twint" => Ok(Twint),
"upi" => Ok(Upi),
"us_bank_account" => Ok(UsBankAccount),
"wechat_pay" => Ok(WechatPay),
"zip" => Ok(Zip),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataType)).finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataUpi {
/// Configuration options for setting up an eMandate
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodDataUpiMandateOptions>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUpi {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataUpi").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataUpi {
pub fn new() -> Self {
Self { mandate_options: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataUpi {
fn default() -> Self {
Self::new()
}
}
/// Configuration options for setting up an eMandate
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataUpiMandateOptions {
/// Amount to be charged for future payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType>,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUpiMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataUpiMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataUpiMandateOptions {
pub fn new() -> Self {
Self { amount: None, amount_type: None, description: None, end_date: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodDataUpiMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodDataUsBankAccount {
/// Account holder type: individual or company.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type:
Option<CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType>,
/// Account number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Account type: checkings or savings. Defaults to checking if omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_type: Option<CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType>,
/// The ID of a Financial Connections Account to use as a payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub financial_connections_account: Option<String>,
/// Routing number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing_number: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodDataUsBankAccount").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodDataUsBankAccount {
pub fn new() -> Self {
Self {
account_holder_type: None,
account_number: None,
account_type: None,
financial_connections_account: None,
routing_number: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodDataUsBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Account holder type: individual or company.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
Company,
Individual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*;
match self {
Company => "company",
Individual => "individual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*;
match s {
"company" => Ok(Company),
"individual" => Ok(Individual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Account type: checkings or savings. Defaults to checking if omitted.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
Checking,
Savings,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*;
match self {
Checking => "checking",
Savings => "savings",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*;
match s {
"checking" => Ok(Checking),
"savings" => Ok(Savings),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Payment method-specific configuration for this PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptions {
/// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<CreatePaymentIntentPaymentMethodOptionsAcssDebit>,
/// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub affirm: Option<CreatePaymentIntentPaymentMethodOptionsAffirm>,
/// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub afterpay_clearpay: Option<CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay>,
/// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub alipay: Option<CreatePaymentIntentPaymentMethodOptionsAlipay>,
/// If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub alma: Option<CreatePaymentIntentPaymentMethodOptionsAlma>,
/// If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_pay: Option<CreatePaymentIntentPaymentMethodOptionsAmazonPay>,
/// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<CreatePaymentIntentPaymentMethodOptionsAuBecsDebit>,
/// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<CreatePaymentIntentPaymentMethodOptionsBacsDebit>,
/// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub bancontact: Option<CreatePaymentIntentPaymentMethodOptionsBancontact>,
/// If this is a `billie` PaymentMethod, this sub-hash contains details about the Billie payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub billie: Option<CreatePaymentIntentPaymentMethodOptionsBillie>,
/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub blik: Option<CreatePaymentIntentPaymentMethodOptionsBlik>,
/// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<CreatePaymentIntentPaymentMethodOptionsBoleto>,
/// Configuration for any card payments attempted on this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<CreatePaymentIntentPaymentMethodOptionsCard>,
/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present: Option<CreatePaymentIntentPaymentMethodOptionsCardPresent>,
/// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp: Option<CreatePaymentIntentPaymentMethodOptionsCashapp>,
/// If this is a `crypto` PaymentMethod, this sub-hash contains details about the Crypto payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub crypto: Option<CreatePaymentIntentPaymentMethodOptionsCrypto>,
/// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_balance: Option<CreatePaymentIntentPaymentMethodOptionsCustomerBalance>,
/// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps: Option<CreatePaymentIntentPaymentMethodOptionsEps>,
/// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<CreatePaymentIntentPaymentMethodOptionsFpx>,
/// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub giropay: Option<CreatePaymentIntentPaymentMethodOptionsGiropay>,
/// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub grabpay: Option<CreatePaymentIntentPaymentMethodOptionsGrabpay>,
/// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<CreatePaymentIntentPaymentMethodOptionsIdeal>,
/// If this is a `interac_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub interac_present: Option<miniserde::json::Value>,
/// If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub kakao_pay: Option<CreatePaymentIntentPaymentMethodOptionsKakaoPay>,
/// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<CreatePaymentIntentPaymentMethodOptionsKlarna>,
/// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub konbini: Option<CreatePaymentIntentPaymentMethodOptionsKonbini>,
/// If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub kr_card: Option<CreatePaymentIntentPaymentMethodOptionsKrCard>,
/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub link: Option<CreatePaymentIntentPaymentMethodOptionsLink>,
/// If this is a `mb_way` PaymentMethod, this sub-hash contains details about the MB WAY payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub mb_way: Option<CreatePaymentIntentPaymentMethodOptionsMbWay>,
/// If this is a `MobilePay` PaymentMethod, this sub-hash contains details about the MobilePay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub mobilepay: Option<CreatePaymentIntentPaymentMethodOptionsMobilepay>,
/// If this is a `multibanco` PaymentMethod, this sub-hash contains details about the Multibanco payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub multibanco: Option<CreatePaymentIntentPaymentMethodOptionsMultibanco>,
/// If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub naver_pay: Option<CreatePaymentIntentPaymentMethodOptionsNaverPay>,
/// If this is a `nz_bank_account` PaymentMethod, this sub-hash contains details about the NZ BECS Direct Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub nz_bank_account: Option<CreatePaymentIntentPaymentMethodOptionsNzBankAccount>,
/// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub oxxo: Option<CreatePaymentIntentPaymentMethodOptionsOxxo>,
/// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub p24: Option<CreatePaymentIntentPaymentMethodOptionsP24>,
/// If this is a `pay_by_bank` PaymentMethod, this sub-hash contains details about the PayByBank payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pay_by_bank: Option<miniserde::json::Value>,
/// If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub payco: Option<CreatePaymentIntentPaymentMethodOptionsPayco>,
/// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub paynow: Option<CreatePaymentIntentPaymentMethodOptionsPaynow>,
/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<CreatePaymentIntentPaymentMethodOptionsPaypal>,
/// If this is a `payto` PaymentMethod, this sub-hash contains details about the PayTo payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub payto: Option<CreatePaymentIntentPaymentMethodOptionsPayto>,
/// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub pix: Option<CreatePaymentIntentPaymentMethodOptionsPix>,
/// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub promptpay: Option<CreatePaymentIntentPaymentMethodOptionsPromptpay>,
/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub revolut_pay: Option<CreatePaymentIntentPaymentMethodOptionsRevolutPay>,
/// If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub samsung_pay: Option<CreatePaymentIntentPaymentMethodOptionsSamsungPay>,
/// If this is a `satispay` PaymentMethod, this sub-hash contains details about the Satispay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub satispay: Option<CreatePaymentIntentPaymentMethodOptionsSatispay>,
/// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<CreatePaymentIntentPaymentMethodOptionsSepaDebit>,
/// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<CreatePaymentIntentPaymentMethodOptionsSofort>,
/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub swish: Option<CreatePaymentIntentPaymentMethodOptionsSwish>,
/// If this is a `twint` PaymentMethod, this sub-hash contains details about the TWINT payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub twint: Option<CreatePaymentIntentPaymentMethodOptionsTwint>,
/// If this is a `upi` PaymentIntent, this sub-hash contains details about the UPI payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub upi: Option<CreatePaymentIntentPaymentMethodOptionsUpi>,
/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccount>,
/// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub wechat_pay: Option<CreatePaymentIntentPaymentMethodOptionsWechatPay>,
/// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub zip: Option<CreatePaymentIntentPaymentMethodOptionsZip>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptions").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptions {
pub fn new() -> Self {
Self {
acss_debit: None,
affirm: None,
afterpay_clearpay: None,
alipay: None,
alma: None,
amazon_pay: None,
au_becs_debit: None,
bacs_debit: None,
bancontact: None,
billie: None,
blik: None,
boleto: None,
card: None,
card_present: None,
cashapp: None,
crypto: None,
customer_balance: None,
eps: None,
fpx: None,
giropay: None,
grabpay: None,
ideal: None,
interac_present: None,
kakao_pay: None,
klarna: None,
konbini: None,
kr_card: None,
link: None,
mb_way: None,
mobilepay: None,
multibanco: None,
naver_pay: None,
nz_bank_account: None,
oxxo: None,
p24: None,
pay_by_bank: None,
payco: None,
paynow: None,
paypal: None,
payto: None,
pix: None,
promptpay: None,
revolut_pay: None,
samsung_pay: None,
satispay: None,
sepa_debit: None,
sofort: None,
swish: None,
twint: None,
upi: None,
us_bank_account: None,
wechat_pay: None,
zip: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
/// Bank account verification method. The default value is `automatic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAcssDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAcssDebit {
pub fn new() -> Self {
Self {
mandate_options: None,
setup_future_usage: None,
target_date: None,
verification_method: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAcssDebit {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
/// A URL for custom mandate text to render during confirmation step.
/// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,.
/// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent.
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_mandate_url: Option<String>,
/// Description of the mandate interval.
/// Only required if 'payment_schedule' parameter is 'interval' or 'combined'.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_description: Option<String>,
/// Payment schedule for the mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_schedule:
Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule>,
/// Transaction type of the mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_type:
Option<CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
pub fn new() -> Self {
Self {
custom_mandate_url: None,
interval_description: None,
payment_schedule: None,
transaction_type: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// Payment schedule for the mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule {
Combined,
Interval,
Sporadic,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*;
match self {
Combined => "combined",
Interval => "interval",
Sporadic => "sporadic",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*;
match s {
"combined" => Ok(Combined),
"interval" => Ok(Interval),
"sporadic" => Ok(Sporadic),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Transaction type of the mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
Business,
Personal,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*;
match self {
Business => "business",
Personal => "personal",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*;
match s {
"business" => Ok(Business),
"personal" => Ok(Personal),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Bank account verification method. The default value is `automatic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
Automatic,
Instant,
Microdeposits,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAffirm {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod>,
/// Preferred language of the Affirm authorization page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirm {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAffirm").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAffirm {
pub fn new() -> Self {
Self { capture_method: None, preferred_locale: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAffirm {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method:
Option<CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod>,
/// An internal identifier or reference that this payment corresponds to.
/// You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes.
/// This field differs from the statement descriptor and item name.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
pub fn new() -> Self {
Self { capture_method: None, reference: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAlipay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlipay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAlipay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAlipay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAlipay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAlma {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlma {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAlma").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAlma {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAlma {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAmazonPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAmazonPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAmazonPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAmazonPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAmazonPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsAuBecsDebit {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAuBecsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsAuBecsDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsAuBecsDebit {
pub fn new() -> Self {
Self { setup_future_usage: None, target_date: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsAuBecsDebit {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsBacsDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<PaymentMethodOptionsMandateOptionsParam>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBacsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsBacsDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsBacsDebit {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None, target_date: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsBacsDebit {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsBancontact {
/// Preferred language of the Bancontact authorization page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_language:
Option<CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontact {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsBancontact").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsBancontact {
pub fn new() -> Self {
Self { preferred_language: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsBancontact {
fn default() -> Self {
Self::new()
}
}
/// Preferred language of the Bancontact authorization page that the customer is redirected to.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
De,
En,
Fr,
Nl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*;
match self {
De => "de",
En => "en",
Fr => "fr",
Nl => "nl",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*;
match s {
"de" => Ok(De),
"en" => Ok(En),
"fr" => Ok(Fr),
"nl" => Ok(Nl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `billie` PaymentMethod, this sub-hash contains details about the Billie payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsBillie {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBillie {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsBillie").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsBillie {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsBillie {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsBlik {
/// The 6-digit BLIK code that a customer has generated using their banking application.
/// Can only be set on confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBlik {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsBlik").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsBlik {
pub fn new() -> Self {
Self { code: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsBlik {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsBoleto {
/// The number of calendar days before a Boleto voucher expires.
/// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBoleto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsBoleto").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsBoleto {
pub fn new() -> Self {
Self { expires_after_days: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsBoleto {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Configuration for any card payments attempted on this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCard {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod>,
/// A single-use `cvc_update` Token that represents a card CVC value.
/// When provided, the CVC value will be verified during the card payment attempt.
/// This parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub cvc_token: Option<String>,
/// Installment configuration for payments attempted on this PaymentIntent.
///
/// For more information, see the [installments integration guide](https://docs.stripe.com/payments/installments).
#[serde(skip_serializing_if = "Option::is_none")]
pub installments: Option<CreatePaymentIntentPaymentMethodOptionsCardInstallments>,
/// Configuration options for setting up an eMandate for cards issued in India.
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodOptionsCardMandateOptions>,
/// When specified, this parameter indicates that a transaction will be marked
/// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This
/// parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub moto: Option<bool>,
/// Selected network to process this PaymentIntent on.
/// Depends on the available networks of the card attached to the PaymentIntent.
/// Can be only set confirm-time.
#[serde(skip_serializing_if = "Option::is_none")]
pub network: Option<CreatePaymentIntentPaymentMethodOptionsCardNetwork>,
/// Request ability to [capture beyond the standard authorization validity window](https://docs.stripe.com/payments/extended-authorization) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_extended_authorization:
Option<CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>,
/// Request ability to [increment the authorization](https://docs.stripe.com/payments/incremental-authorization) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_incremental_authorization:
Option<CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>,
/// Request ability to make [multiple captures](https://docs.stripe.com/payments/multicapture) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_multicapture:
Option<CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture>,
/// Request ability to [overcapture](https://docs.stripe.com/payments/overcapture) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_overcapture: Option<CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture>,
/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://docs.stripe.com/strong-customer-authentication).
/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
/// If not provided, this value defaults to `automatic`.
/// Read our guide on [manually requesting 3D Secure](https://docs.stripe.com/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_three_d_secure:
Option<CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>,
/// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e.
/// using the cvc_token parameter).
#[serde(skip_serializing_if = "Option::is_none")]
pub require_cvc_recollection: Option<bool>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage>,
/// Provides information about a card payment that customers see on their statements.
/// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor.
/// Maximum 22 characters.
/// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor_suffix_kana: Option<String>,
/// Provides information about a card payment that customers see on their statements.
/// Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that’s set on the account to form the complete statement descriptor.
/// Maximum 17 characters.
/// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor_suffix_kanji: Option<String>,
/// If 3D Secure authentication was performed with a third-party provider,
/// the authentication details to use for this payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub three_d_secure: Option<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCard").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCard {
pub fn new() -> Self {
Self {
capture_method: None,
cvc_token: None,
installments: None,
mandate_options: None,
moto: None,
network: None,
request_extended_authorization: None,
request_incremental_authorization: None,
request_multicapture: None,
request_overcapture: None,
request_three_d_secure: None,
require_cvc_recollection: None,
setup_future_usage: None,
statement_descriptor_suffix_kana: None,
statement_descriptor_suffix_kanji: None,
three_d_secure: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Installment configuration for payments attempted on this PaymentIntent.
///
/// For more information, see the [installments integration guide](https://docs.stripe.com/payments/installments).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardInstallments {
/// Setting to true enables installments for this PaymentIntent.
/// This will cause the response to contain a list of available installment plans.
/// Setting to false will prevent any selected plan from applying to a charge.
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
/// The selected installment plan to use for this payment attempt.
/// This parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub plan: Option<CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallments {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardInstallments")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardInstallments {
pub fn new() -> Self {
Self { enabled: None, plan: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCardInstallments {
fn default() -> Self {
Self::new()
}
}
/// The selected installment plan to use for this payment attempt.
/// This parameter can only be provided during confirmation.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
/// For `fixed_count` installment plans, this is required.
/// It represents the number of installment payments your customer will make to their credit card.
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<u64>,
/// For `fixed_count` installment plans, this is required.
/// It represents the interval between installment payments your customer will make to their credit card.
/// One of `month`.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval: Option<CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval>,
/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
#[serde(rename = "type")]
pub type_: CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
pub fn new(
type_: impl Into<CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType>,
) -> Self {
Self { count: None, interval: None, type_: type_.into() }
}
}
/// For `fixed_count` installment plans, this is required.
/// It represents the interval between installment payments your customer will make to their credit card.
/// One of `month`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
Month,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*;
match self {
Month => "month",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*;
match s {
"month" => Ok(Month),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
Bonus,
FixedCount,
Revolving,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*;
match self {
Bonus => "bonus",
FixedCount => "fixed_count",
Revolving => "revolving",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*;
match s {
"bonus" => Ok(Bonus),
"fixed_count" => Ok(FixedCount),
"revolving" => Ok(Revolving),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Configuration options for setting up an eMandate for cards issued in India.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardMandateOptions {
/// Amount to be charged for future payments, specified in the presentment currency.
pub amount: i64,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
pub amount_type: CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
/// If not provided, the mandate will be active until canceled.
/// If provided, end date should be after start date.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`.
pub interval: CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval,
/// The number of intervals between payments.
/// For example, `interval=month` and `interval_count=3` indicates one payment every three months.
/// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks).
/// This parameter is optional when `interval=sporadic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
/// Unique identifier for the mandate or subscription.
pub reference: String,
/// Start date of the mandate or subscription. Start date should not be lesser than yesterday.
pub start_date: stripe_types::Timestamp,
/// Specifies the type of mandates supported. Possible values are `india`.
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_types:
Option<Vec<CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptions {
pub fn new(
amount: impl Into<i64>,
amount_type: impl Into<CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType>,
interval: impl Into<CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval>,
reference: impl Into<String>,
start_date: impl Into<stripe_types::Timestamp>,
) -> Self {
Self {
amount: amount.into(),
amount_type: amount_type.into(),
description: None,
end_date: None,
interval: interval.into(),
interval_count: None,
reference: reference.into(),
start_date: start_date.into(),
supported_types: None,
}
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
Day,
Month,
Sporadic,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*;
match self {
Day => "day",
Month => "month",
Sporadic => "sporadic",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"sporadic" => Ok(Sporadic),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Specifies the type of mandates supported. Possible values are `india`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
India,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*;
match self {
India => "india",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*;
match s {
"india" => Ok(India),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Selected network to process this PaymentIntent on.
/// Depends on the available networks of the card attached to the PaymentIntent.
/// Can be only set confirm-time.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardNetwork {
Amex,
CartesBancaires,
Diners,
Discover,
EftposAu,
Girocard,
Interac,
Jcb,
Link,
Mastercard,
Unionpay,
Unknown,
Visa,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
/// This variant is prefixed with an underscore to avoid conflicts with Stripe's 'Unknown' variant.
_Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardNetwork {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardNetwork::*;
match self {
Amex => "amex",
CartesBancaires => "cartes_bancaires",
Diners => "diners",
Discover => "discover",
EftposAu => "eftpos_au",
Girocard => "girocard",
Interac => "interac",
Jcb => "jcb",
Link => "link",
Mastercard => "mastercard",
Unionpay => "unionpay",
Unknown => "unknown",
Visa => "visa",
_Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardNetwork {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardNetwork::*;
match s {
"amex" => Ok(Amex),
"cartes_bancaires" => Ok(CartesBancaires),
"diners" => Ok(Diners),
"discover" => Ok(Discover),
"eftpos_au" => Ok(EftposAu),
"girocard" => Ok(Girocard),
"interac" => Ok(Interac),
"jcb" => Ok(Jcb),
"link" => Ok(Link),
"mastercard" => Ok(Mastercard),
"unionpay" => Ok(Unionpay),
"unknown" => Ok(Unknown),
"visa" => Ok(Visa),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardNetwork"
);
Ok(_Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardNetwork))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardNetwork {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsCardNetwork {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [capture beyond the standard authorization validity window](https://docs.stripe.com/payments/extended-authorization) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [increment the authorization](https://docs.stripe.com/payments/incremental-authorization) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to make [multiple captures](https://docs.stripe.com/payments/multicapture) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardRequestMulticapture
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [overcapture](https://docs.stripe.com/payments/overcapture) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardRequestOvercapture
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://docs.stripe.com/strong-customer-authentication).
/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
/// If not provided, this value defaults to `automatic`.
/// Read our guide on [manually requesting 3D Secure](https://docs.stripe.com/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
Any,
Automatic,
Challenge,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
match self {
Any => "any",
Automatic => "automatic",
Challenge => "challenge",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
match s {
"any" => Ok(Any),
"automatic" => Ok(Automatic),
"challenge" => Ok(Challenge),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If 3D Secure authentication was performed with a third-party provider,
/// the authentication details to use for this payment.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure {
/// The `transStatus` returned from the card Issuer’s ACS in the ARes.
#[serde(skip_serializing_if = "Option::is_none")]
pub ares_trans_status:
Option<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus>,
/// The cryptogram, also known as the "authentication value" (AAV, CAVV or
/// AEVV). This value is 20 bytes, base64-encoded into a 28-character string.
/// (Most 3D Secure providers will return the base64-encoded version, which
/// is what you should specify here.)
pub cryptogram: String,
/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure
/// provider and indicates what degree of authentication was performed.
#[serde(skip_serializing_if = "Option::is_none")]
pub electronic_commerce_indicator:
Option<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator>,
/// The exemption requested via 3DS and accepted by the issuer at authentication time.
#[serde(skip_serializing_if = "Option::is_none")]
pub exemption_indicator:
Option<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator>,
/// Network specific 3DS fields. Network specific arguments require an
/// explicit card brand choice. The parameter `payment_method_options.card.network``
/// must be populated accordingly
#[serde(skip_serializing_if = "Option::is_none")]
pub network_options:
Option<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions>,
/// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the
/// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99.
#[serde(skip_serializing_if = "Option::is_none")]
pub requestor_challenge_indicator: Option<String>,
/// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server
/// Transaction ID (dsTransID).
pub transaction_id: String,
/// The version of 3D Secure that was performed.
pub version: CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecure {
pub fn new(
cryptogram: impl Into<String>,
transaction_id: impl Into<String>,
version: impl Into<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion>,
) -> Self {
Self {
ares_trans_status: None,
cryptogram: cryptogram.into(),
electronic_commerce_indicator: None,
exemption_indicator: None,
network_options: None,
requestor_challenge_indicator: None,
transaction_id: transaction_id.into(),
version: version.into(),
}
}
}
/// The `transStatus` returned from the card Issuer’s ACS in the ARes.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
A,
C,
I,
N,
R,
U,
Y,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*;
match self {
A => "A",
C => "C",
I => "I",
N => "N",
R => "R",
U => "U",
Y => "Y",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*;
match s {
"A" => Ok(A),
"C" => Ok(C),
"I" => Ok(I),
"N" => Ok(N),
"R" => Ok(R),
"U" => Ok(U),
"Y" => Ok(Y),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure
/// provider and indicates what degree of authentication was performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator {
V01,
V02,
V05,
V06,
V07,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*;
match self {
V01 => "01",
V02 => "02",
V05 => "05",
V06 => "06",
V07 => "07",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*;
match s {
"01" => Ok(V01),
"02" => Ok(V02),
"05" => Ok(V05),
"06" => Ok(V06),
"07" => Ok(V07),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The exemption requested via 3DS and accepted by the issuer at authentication time.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
LowRisk,
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*;
match self {
LowRisk => "low_risk",
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*;
match s {
"low_risk" => Ok(LowRisk),
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Network specific 3DS fields. Network specific arguments require an
/// explicit card brand choice. The parameter `payment_method_options.card.network``
/// must be populated accordingly
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
/// Cartes Bancaires-specific 3DS fields.
#[serde(skip_serializing_if = "Option::is_none")]
pub cartes_bancaires: Option<
CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires,
>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
pub fn new() -> Self {
Self { cartes_bancaires: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
fn default() -> Self {
Self::new()
}
}
/// Cartes Bancaires-specific 3DS fields.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires {
/// The cryptogram calculation algorithm used by the card Issuer's ACS
/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`.
/// messageExtension: CB-AVALGO
pub cb_avalgo: CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo,
/// The exemption indicator returned from Cartes Bancaires in the ARes.
/// message extension: CB-EXEMPTION; string (4 characters)
/// This is a 3 byte bitmap (low significant byte first and most significant
/// bit first) that has been Base64 encoded
#[serde(skip_serializing_if = "Option::is_none")]
pub cb_exemption: Option<String>,
/// The risk score returned from Cartes Bancaires in the ARes.
/// message extension: CB-SCORE; numeric value 0-99
#[serde(skip_serializing_if = "Option::is_none")]
pub cb_score: Option<i64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires",
)
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires {
pub fn new(
cb_avalgo: impl Into<CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo>,
) -> Self {
Self { cb_avalgo: cb_avalgo.into(), cb_exemption: None, cb_score: None }
}
}
/// The cryptogram calculation algorithm used by the card Issuer's ACS
/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`.
/// messageExtension: CB-AVALGO
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
V0,
V1,
V2,
V3,
V4,
A,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*;
match self {
V0 => "0",
V1 => "1",
V2 => "2",
V3 => "3",
V4 => "4",
A => "A",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*;
match s {
"0" => Ok(V0),
"1" => Ok(V1),
"2" => Ok(V2),
"3" => Ok(V3),
"4" => Ok(V4),
"A" => Ok(A),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo)).finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The version of 3D Secure that was performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
V1_0_2,
V2_1_0,
V2_2_0,
V2_3_0,
V2_3_1,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*;
match self {
V1_0_2 => "1.0.2",
V2_1_0 => "2.1.0",
V2_2_0 => "2.2.0",
V2_3_0 => "2.3.0",
V2_3_1 => "2.3.1",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*;
match s {
"1.0.2" => Ok(V1_0_2),
"2.1.0" => Ok(V2_1_0),
"2.2.0" => Ok(V2_2_0),
"2.3.0" => Ok(V2_3_0),
"2.3.1" => Ok(V2_3_1),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardPresent {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod>,
/// Request ability to capture this payment beyond the standard [authorization validity window](https://docs.stripe.com/terminal/features/extended-authorizations#authorization-validity).
#[serde(skip_serializing_if = "Option::is_none")]
pub request_extended_authorization: Option<bool>,
/// Request ability to [increment](https://docs.stripe.com/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible.
/// Check [incremental_authorization_supported](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://docs.stripe.com/api/payment_intents/confirm) response to verify support.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_incremental_authorization_support: Option<bool>,
/// Network routing priority on co-branded EMV cards supporting domestic debit and international card schemes.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing: Option<CreatePaymentIntentPaymentMethodOptionsCardPresentRouting>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardPresent").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self {
capture_method: None,
request_extended_authorization: None,
request_incremental_authorization_support: None,
routing: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
Manual,
ManualPreferred,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod::*;
match self {
Manual => "manual",
ManualPreferred => "manual_preferred",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod::*;
match s {
"manual" => Ok(Manual),
"manual_preferred" => Ok(ManualPreferred),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Network routing priority on co-branded EMV cards supporting domestic debit and international card schemes.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCardPresentRouting {
/// Routing requested priority
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_priority:
Option<CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCardPresentRouting {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCardPresentRouting")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCardPresentRouting {
pub fn new() -> Self {
Self { requested_priority: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCardPresentRouting {
fn default() -> Self {
Self::new()
}
}
/// Routing requested priority
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority {
Domestic,
International,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority::*;
match self {
Domestic => "domestic",
International => "international",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority::*;
match s {
"domestic" => Ok(Domestic),
"international" => Ok(International),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCashapp {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashapp {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCashapp").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCashapp {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCashapp {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `crypto` PaymentMethod, this sub-hash contains details about the Crypto payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCrypto {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCrypto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCrypto").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCrypto {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCrypto {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalance {
/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank_transfer: Option<CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer>,
/// The funding method type to be used when there are not enough funds in the customer balance.
/// Permitted values include: `bank_transfer`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding_type: Option<CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalance {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCustomerBalance")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCustomerBalance {
pub fn new() -> Self {
Self { bank_transfer: None, funding_type: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsCustomerBalance {
fn default() -> Self {
Self::new()
}
}
/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
/// Configuration for the eu_bank_transfer funding type.
#[serde(skip_serializing_if = "Option::is_none")]
pub eu_bank_transfer: Option<EuBankTransferParams>,
/// List of address types that should be returned in the financial_addresses response.
/// If not specified, all valid types will be returned.
///
/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_address_types: Option<
Vec<
CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes,
>,
>,
/// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
#[serde(rename = "type")]
pub type_: CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
pub fn new(
type_: impl Into<CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType>,
) -> Self {
Self { eu_bank_transfer: None, requested_address_types: None, type_: type_.into() }
}
}
/// List of address types that should be returned in the financial_addresses response.
/// If not specified, all valid types will be returned.
///
/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes {
Aba,
Iban,
Sepa,
SortCode,
Spei,
Swift,
Zengin,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*;
match self {
Aba => "aba",
Iban => "iban",
Sepa => "sepa",
SortCode => "sort_code",
Spei => "spei",
Swift => "swift",
Zengin => "zengin",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*;
match s {
"aba" => Ok(Aba),
"iban" => Ok(Iban),
"sepa" => Ok(Sepa),
"sort_code" => Ok(SortCode),
"spei" => Ok(Spei),
"swift" => Ok(Swift),
"zengin" => Ok(Zengin),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
EuBankTransfer,
GbBankTransfer,
JpBankTransfer,
MxBankTransfer,
UsBankTransfer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*;
match self {
EuBankTransfer => "eu_bank_transfer",
GbBankTransfer => "gb_bank_transfer",
JpBankTransfer => "jp_bank_transfer",
MxBankTransfer => "mx_bank_transfer",
UsBankTransfer => "us_bank_transfer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*;
match s {
"eu_bank_transfer" => Ok(EuBankTransfer),
"gb_bank_transfer" => Ok(GbBankTransfer),
"jp_bank_transfer" => Ok(JpBankTransfer),
"mx_bank_transfer" => Ok(MxBankTransfer),
"us_bank_transfer" => Ok(UsBankTransfer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The funding method type to be used when there are not enough funds in the customer balance.
/// Permitted values include: `bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
BankTransfer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*;
match self {
BankTransfer => "bank_transfer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*;
match s {
"bank_transfer" => Ok(BankTransfer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsEps {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsEps {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsEps").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsEps {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsEps {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsFpx {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsFpx {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsFpx").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsFpx {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsFpx {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsGiropay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGiropay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsGiropay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsGiropay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsGiropay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsGrabpay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGrabpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsGrabpay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsGrabpay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsGrabpay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsIdeal {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsIdeal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsIdeal").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsIdeal {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsIdeal {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsKakaoPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKakaoPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsKakaoPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsKakaoPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsKakaoPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsKlarna {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod>,
/// On-demand details if setting up or charging an on-demand payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub on_demand: Option<CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemand>,
/// Preferred language of the Klarna authorization page that the customer is redirected to
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage>,
/// Subscription details if setting up or charging a subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub subscriptions: Option<Vec<CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarna {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsKlarna").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsKlarna {
pub fn new() -> Self {
Self {
capture_method: None,
on_demand: None,
preferred_locale: None,
setup_future_usage: None,
subscriptions: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsKlarna {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// On-demand details if setting up or charging an on-demand payment.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
/// Your average amount value.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub average_amount: Option<i64>,
/// The maximum value you may charge a customer per purchase.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum_amount: Option<i64>,
/// The lowest or minimum value you may charge a customer per purchase.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_amount: Option<i64>,
/// Interval at which the customer is making purchases
#[serde(skip_serializing_if = "Option::is_none")]
pub purchase_interval:
Option<CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval>,
/// The number of `purchase_interval` between charges
#[serde(skip_serializing_if = "Option::is_none")]
pub purchase_interval_count: Option<u64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemand")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
pub fn new() -> Self {
Self {
average_amount: None,
maximum_amount: None,
minimum_amount: None,
purchase_interval: None,
purchase_interval_count: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
fn default() -> Self {
Self::new()
}
}
/// Interval at which the customer is making purchases
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
Day,
Month,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval::*;
match self {
Day => "day",
Month => "month",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Preferred language of the Klarna authorization page that the customer is redirected to
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
CsMinusCz,
DaMinusDk,
DeMinusAt,
DeMinusCh,
DeMinusDe,
ElMinusGr,
EnMinusAt,
EnMinusAu,
EnMinusBe,
EnMinusCa,
EnMinusCh,
EnMinusCz,
EnMinusDe,
EnMinusDk,
EnMinusEs,
EnMinusFi,
EnMinusFr,
EnMinusGb,
EnMinusGr,
EnMinusIe,
EnMinusIt,
EnMinusNl,
EnMinusNo,
EnMinusNz,
EnMinusPl,
EnMinusPt,
EnMinusRo,
EnMinusSe,
EnMinusUs,
EsMinusEs,
EsMinusUs,
FiMinusFi,
FrMinusBe,
FrMinusCa,
FrMinusCh,
FrMinusFr,
ItMinusCh,
ItMinusIt,
NbMinusNo,
NlMinusBe,
NlMinusNl,
PlMinusPl,
PtMinusPt,
RoMinusRo,
SvMinusFi,
SvMinusSe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*;
match self {
CsMinusCz => "cs-CZ",
DaMinusDk => "da-DK",
DeMinusAt => "de-AT",
DeMinusCh => "de-CH",
DeMinusDe => "de-DE",
ElMinusGr => "el-GR",
EnMinusAt => "en-AT",
EnMinusAu => "en-AU",
EnMinusBe => "en-BE",
EnMinusCa => "en-CA",
EnMinusCh => "en-CH",
EnMinusCz => "en-CZ",
EnMinusDe => "en-DE",
EnMinusDk => "en-DK",
EnMinusEs => "en-ES",
EnMinusFi => "en-FI",
EnMinusFr => "en-FR",
EnMinusGb => "en-GB",
EnMinusGr => "en-GR",
EnMinusIe => "en-IE",
EnMinusIt => "en-IT",
EnMinusNl => "en-NL",
EnMinusNo => "en-NO",
EnMinusNz => "en-NZ",
EnMinusPl => "en-PL",
EnMinusPt => "en-PT",
EnMinusRo => "en-RO",
EnMinusSe => "en-SE",
EnMinusUs => "en-US",
EsMinusEs => "es-ES",
EsMinusUs => "es-US",
FiMinusFi => "fi-FI",
FrMinusBe => "fr-BE",
FrMinusCa => "fr-CA",
FrMinusCh => "fr-CH",
FrMinusFr => "fr-FR",
ItMinusCh => "it-CH",
ItMinusIt => "it-IT",
NbMinusNo => "nb-NO",
NlMinusBe => "nl-BE",
NlMinusNl => "nl-NL",
PlMinusPl => "pl-PL",
PtMinusPt => "pt-PT",
RoMinusRo => "ro-RO",
SvMinusFi => "sv-FI",
SvMinusSe => "sv-SE",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*;
match s {
"cs-CZ" => Ok(CsMinusCz),
"da-DK" => Ok(DaMinusDk),
"de-AT" => Ok(DeMinusAt),
"de-CH" => Ok(DeMinusCh),
"de-DE" => Ok(DeMinusDe),
"el-GR" => Ok(ElMinusGr),
"en-AT" => Ok(EnMinusAt),
"en-AU" => Ok(EnMinusAu),
"en-BE" => Ok(EnMinusBe),
"en-CA" => Ok(EnMinusCa),
"en-CH" => Ok(EnMinusCh),
"en-CZ" => Ok(EnMinusCz),
"en-DE" => Ok(EnMinusDe),
"en-DK" => Ok(EnMinusDk),
"en-ES" => Ok(EnMinusEs),
"en-FI" => Ok(EnMinusFi),
"en-FR" => Ok(EnMinusFr),
"en-GB" => Ok(EnMinusGb),
"en-GR" => Ok(EnMinusGr),
"en-IE" => Ok(EnMinusIe),
"en-IT" => Ok(EnMinusIt),
"en-NL" => Ok(EnMinusNl),
"en-NO" => Ok(EnMinusNo),
"en-NZ" => Ok(EnMinusNz),
"en-PL" => Ok(EnMinusPl),
"en-PT" => Ok(EnMinusPt),
"en-RO" => Ok(EnMinusRo),
"en-SE" => Ok(EnMinusSe),
"en-US" => Ok(EnMinusUs),
"es-ES" => Ok(EsMinusEs),
"es-US" => Ok(EsMinusUs),
"fi-FI" => Ok(FiMinusFi),
"fr-BE" => Ok(FrMinusBe),
"fr-CA" => Ok(FrMinusCa),
"fr-CH" => Ok(FrMinusCh),
"fr-FR" => Ok(FrMinusFr),
"it-CH" => Ok(ItMinusCh),
"it-IT" => Ok(ItMinusIt),
"nb-NO" => Ok(NbMinusNo),
"nl-BE" => Ok(NlMinusBe),
"nl-NL" => Ok(NlMinusNl),
"pl-PL" => Ok(PlMinusPl),
"pt-PT" => Ok(PtMinusPt),
"ro-RO" => Ok(RoMinusRo),
"sv-FI" => Ok(SvMinusFi),
"sv-SE" => Ok(SvMinusSe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Subscription details if setting up or charging a subscription.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
/// Unit of time between subscription charges.
pub interval: CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval,
/// The number of intervals (specified in the `interval` attribute) between subscription charges.
/// For example, `interval=month` and `interval_count=3` charges every 3 months.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
/// Name for subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Describes the upcoming charge for this subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_billing: Option<SubscriptionNextBillingParam>,
/// A non-customer-facing reference to correlate subscription charges in the Klarna app.
/// Use a value that persists across subscription charges.
pub reference: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
pub fn new(
interval: impl Into<CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval>,
reference: impl Into<String>,
) -> Self {
Self {
interval: interval.into(),
interval_count: None,
name: None,
next_billing: None,
reference: reference.into(),
}
}
}
/// Unit of time between subscription charges.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
Day,
Month,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval::*;
match self {
Day => "day",
Month => "month",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsKonbini {
/// An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores.
/// Must not consist of only zeroes and could be rejected in case of insufficient uniqueness.
/// We recommend to use the customer's phone number.
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_number: Option<String>,
/// The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire.
/// For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST.
/// Defaults to 3 days.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// The timestamp at which the Konbini payment instructions will expire.
/// Only one of `expires_after_days` or `expires_at` may be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<stripe_types::Timestamp>,
/// A product descriptor of up to 22 characters, which will appear to customers at the convenience store.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_description: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKonbini {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsKonbini").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsKonbini {
pub fn new() -> Self {
Self {
confirmation_number: None,
expires_after_days: None,
expires_at: None,
product_description: None,
setup_future_usage: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsKonbini {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsKrCard {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKrCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsKrCard").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsKrCard {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsKrCard {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsLink {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod>,
/// \[Deprecated\] This is a legacy parameter that no longer has any function.
#[serde(skip_serializing_if = "Option::is_none")]
pub persistent_token: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsLink").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsLink {
pub fn new() -> Self {
Self { capture_method: None, persistent_token: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsLink {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `mb_way` PaymentMethod, this sub-hash contains details about the MB WAY payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsMbWay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMbWay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsMbWay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsMbWay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsMbWay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `MobilePay` PaymentMethod, this sub-hash contains details about the MobilePay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsMobilepay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMobilepay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsMobilepay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsMobilepay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsMobilepay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `multibanco` PaymentMethod, this sub-hash contains details about the Multibanco payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsMultibanco {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMultibanco {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsMultibanco").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsMultibanco {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsMultibanco {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsNaverPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNaverPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsNaverPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsNaverPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsNaverPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `nz_bank_account` PaymentMethod, this sub-hash contains details about the NZ BECS Direct Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsNzBankAccount {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNzBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsNzBankAccount")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsNzBankAccount {
pub fn new() -> Self {
Self { setup_future_usage: None, target_date: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsNzBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsOxxo {
/// The number of calendar days before an OXXO voucher expires.
/// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsOxxo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsOxxo").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsOxxo {
pub fn new() -> Self {
Self { expires_after_days: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsOxxo {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsP24 {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage>,
/// Confirm that the payer has accepted the P24 terms and conditions.
#[serde(skip_serializing_if = "Option::is_none")]
pub tos_shown_and_accepted: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsP24 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsP24").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsP24 {
pub fn new() -> Self {
Self { setup_future_usage: None, tos_shown_and_accepted: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsP24 {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPayco {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPayco {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPayco").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPayco {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPayco {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPaynow {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaynow {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPaynow").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPaynow {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPaynow {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPaypal {
/// Controls when the funds will be captured from the customer's account.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod>,
/// [Preferred locale](https://docs.stripe.com/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale>,
/// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID.
/// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// The risk correlation ID for an on-session payment using a saved PayPal payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_correlation_id: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPaypal").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self {
capture_method: None,
preferred_locale: None,
reference: None,
risk_correlation_id: None,
setup_future_usage: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds will be captured from the customer's account.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// [Preferred locale](https://docs.stripe.com/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
CsMinusCz,
DaMinusDk,
DeMinusAt,
DeMinusDe,
DeMinusLu,
ElMinusGr,
EnMinusGb,
EnMinusUs,
EsMinusEs,
FiMinusFi,
FrMinusBe,
FrMinusFr,
FrMinusLu,
HuMinusHu,
ItMinusIt,
NlMinusBe,
NlMinusNl,
PlMinusPl,
PtMinusPt,
SkMinusSk,
SvMinusSe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*;
match self {
CsMinusCz => "cs-CZ",
DaMinusDk => "da-DK",
DeMinusAt => "de-AT",
DeMinusDe => "de-DE",
DeMinusLu => "de-LU",
ElMinusGr => "el-GR",
EnMinusGb => "en-GB",
EnMinusUs => "en-US",
EsMinusEs => "es-ES",
FiMinusFi => "fi-FI",
FrMinusBe => "fr-BE",
FrMinusFr => "fr-FR",
FrMinusLu => "fr-LU",
HuMinusHu => "hu-HU",
ItMinusIt => "it-IT",
NlMinusBe => "nl-BE",
NlMinusNl => "nl-NL",
PlMinusPl => "pl-PL",
PtMinusPt => "pt-PT",
SkMinusSk => "sk-SK",
SvMinusSe => "sv-SE",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*;
match s {
"cs-CZ" => Ok(CsMinusCz),
"da-DK" => Ok(DaMinusDk),
"de-AT" => Ok(DeMinusAt),
"de-DE" => Ok(DeMinusDe),
"de-LU" => Ok(DeMinusLu),
"el-GR" => Ok(ElMinusGr),
"en-GB" => Ok(EnMinusGb),
"en-US" => Ok(EnMinusUs),
"es-ES" => Ok(EsMinusEs),
"fi-FI" => Ok(FiMinusFi),
"fr-BE" => Ok(FrMinusBe),
"fr-FR" => Ok(FrMinusFr),
"fr-LU" => Ok(FrMinusLu),
"hu-HU" => Ok(HuMinusHu),
"it-IT" => Ok(ItMinusIt),
"nl-BE" => Ok(NlMinusBe),
"nl-NL" => Ok(NlMinusNl),
"pl-PL" => Ok(PlMinusPl),
"pt-PT" => Ok(PtMinusPt),
"sk-SK" => Ok(SkMinusSk),
"sv-SE" => Ok(SvMinusSe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payto` PaymentMethod, this sub-hash contains details about the PayTo payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPayto {
/// Additional fields for Mandate creation.
/// Only `purpose` field is configurable for PayTo PaymentIntent with `setup_future_usage=none`.
/// Other fields are only applicable to PayTo PaymentIntent with `setup_future_usage=off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPayto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPayto").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPayto {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPayto {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation.
/// Only `purpose` field is configurable for PayTo PaymentIntent with `setup_future_usage=none`.
/// Other fields are only applicable to PayTo PaymentIntent with `setup_future_usage=off_session`.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
/// Amount that will be collected. It is required when `amount_type` is `fixed`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// The type of amount that will be collected.
/// The amount charged must be exact or up to the value of `amount` param for `fixed` or `maximum` type respectively.
/// Defaults to `maximum`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType>,
/// Date, in YYYY-MM-DD format, after which payments will not be collected. Defaults to no end date.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<String>,
/// The periodicity at which payments will be collected. Defaults to `adhoc`.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_schedule:
Option<CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule>,
/// The number of payments that will be made during a payment period.
/// Defaults to 1 except for when `payment_schedule` is `adhoc`.
/// In that case, it defaults to no limit.
#[serde(skip_serializing_if = "Option::is_none")]
pub payments_per_period: Option<i64>,
/// The purpose for which payments are made. Has a default value based on your merchant category code.
#[serde(skip_serializing_if = "Option::is_none")]
pub purpose: Option<CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
pub fn new() -> Self {
Self {
amount: None,
amount_type: None,
end_date: None,
payment_schedule: None,
payments_per_period: None,
purpose: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// The type of amount that will be collected.
/// The amount charged must be exact or up to the value of `amount` param for `fixed` or `maximum` type respectively.
/// Defaults to `maximum`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The periodicity at which payments will be collected. Defaults to `adhoc`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
Adhoc,
Annual,
Daily,
Fortnightly,
Monthly,
Quarterly,
SemiAnnual,
Weekly,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule::*;
match self {
Adhoc => "adhoc",
Annual => "annual",
Daily => "daily",
Fortnightly => "fortnightly",
Monthly => "monthly",
Quarterly => "quarterly",
SemiAnnual => "semi_annual",
Weekly => "weekly",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule::*;
match s {
"adhoc" => Ok(Adhoc),
"annual" => Ok(Annual),
"daily" => Ok(Daily),
"fortnightly" => Ok(Fortnightly),
"monthly" => Ok(Monthly),
"quarterly" => Ok(Quarterly),
"semi_annual" => Ok(SemiAnnual),
"weekly" => Ok(Weekly),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The purpose for which payments are made. Has a default value based on your merchant category code.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
DependantSupport,
Government,
Loan,
Mortgage,
Other,
Pension,
Personal,
Retail,
Salary,
Tax,
Utility,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose::*;
match self {
DependantSupport => "dependant_support",
Government => "government",
Loan => "loan",
Mortgage => "mortgage",
Other => "other",
Pension => "pension",
Personal => "personal",
Retail => "retail",
Salary => "salary",
Tax => "tax",
Utility => "utility",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose::*;
match s {
"dependant_support" => Ok(DependantSupport),
"government" => Ok(Government),
"loan" => Ok(Loan),
"mortgage" => Ok(Mortgage),
"other" => Ok(Other),
"pension" => Ok(Pension),
"personal" => Ok(Personal),
"retail" => Ok(Retail),
"salary" => Ok(Salary),
"tax" => Ok(Tax),
"utility" => Ok(Utility),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPix {
/// Determines if the amount includes the IOF tax. Defaults to `never`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_includes_iof: Option<CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof>,
/// The number of seconds (between 10 and 1209600) after which Pix payment will expire.
/// Defaults to 86400 seconds.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_seconds: Option<i64>,
/// The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future).
/// Defaults to 1 day in the future.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<stripe_types::Timestamp>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPix {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPix").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPix {
pub fn new() -> Self {
Self {
amount_includes_iof: None,
expires_after_seconds: None,
expires_at: None,
setup_future_usage: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPix {
fn default() -> Self {
Self::new()
}
}
/// Determines if the amount includes the IOF tax. Defaults to `never`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
Always,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof::*;
match self {
Always => "always",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof::*;
match s {
"always" => Ok(Always),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsPromptpay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPromptpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsPromptpay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsPromptpay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsPromptpay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsRevolutPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsRevolutPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsRevolutPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsRevolutPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsRevolutPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsSamsungPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSamsungPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsSamsungPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsSamsungPay {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsSamsungPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `satispay` PaymentMethod, this sub-hash contains details about the Satispay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsSatispay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSatispay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsSatispay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsSatispay {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsSatispay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsSepaDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSepaDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsSepaDebit").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsSepaDebit {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None, target_date: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsSepaDebit {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
/// Prefix used to generate the Mandate reference.
/// Must be at most 12 characters long.
/// Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'.
/// Cannot begin with 'STRIPE'.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference_prefix: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
pub fn new() -> Self {
Self { reference_prefix: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsSofort {
/// Language shown to the payer on redirect.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_language: Option<CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsSofort").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsSofort {
pub fn new() -> Self {
Self { preferred_language: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsSofort {
fn default() -> Self {
Self::new()
}
}
/// Language shown to the payer on redirect.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
De,
En,
Es,
Fr,
It,
Nl,
Pl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*;
match self {
De => "de",
En => "en",
Es => "es",
Fr => "fr",
It => "it",
Nl => "nl",
Pl => "pl",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*;
match s {
"de" => Ok(De),
"en" => Ok(En),
"es" => Ok(Es),
"fr" => Ok(Fr),
"it" => Ok(It),
"nl" => Ok(Nl),
"pl" => Ok(Pl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsSwish {
/// A reference for this payment to be displayed in the Swish app.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSwish {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsSwish").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsSwish {
pub fn new() -> Self {
Self { reference: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsSwish {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `twint` PaymentMethod, this sub-hash contains details about the TWINT payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsTwint {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsTwint {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsTwint").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsTwint {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsTwint {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `upi` PaymentIntent, this sub-hash contains details about the UPI payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUpi {
/// Configuration options for setting up an eMandate
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodOptionsUpiMandateOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUpi {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsUpi").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUpi {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUpi {
fn default() -> Self {
Self::new()
}
}
/// Configuration options for setting up an eMandate
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
/// Amount to be charged for future payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType>,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsUpiMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
pub fn new() -> Self {
Self { amount: None, amount_type: None, description: None, end_date: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccount {
/// Additional fields for Financial Connections Session creation
#[serde(skip_serializing_if = "Option::is_none")]
pub financial_connections:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections>,
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions>,
/// Additional fields for network related functions
#[serde(skip_serializing_if = "Option::is_none")]
pub networks: Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
/// The purpose of the transaction.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_purpose:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose>,
/// Bank account verification method. The default value is `automatic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsUsBankAccount")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccount {
pub fn new() -> Self {
Self {
financial_connections: None,
mandate_options: None,
networks: None,
setup_future_usage: None,
target_date: None,
transaction_purpose: None,
verification_method: None,
}
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUsBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Financial Connections Session creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
/// Provide filters for the linked accounts that the customer can select for the payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub filters:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters>,
/// The list of permissions to request.
/// If this parameter is passed, the `payment_method` permission must be included.
/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<
Vec<CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions>,
>,
/// List of data features that you would like to retrieve upon account creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prefetch: Option<
Vec<CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch>,
>,
/// For webview integrations only.
/// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
#[serde(skip_serializing_if = "Option::is_none")]
pub return_url: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
pub fn new() -> Self {
Self { filters: None, permissions: None, prefetch: None, return_url: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
fn default() -> Self {
Self::new()
}
}
/// Provide filters for the linked accounts that the customer can select for the payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
/// The account subcategories to use to filter for selectable accounts.
/// Valid subcategories are `checking` and `savings`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_subcategories: Option<Vec<CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters",
)
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
pub fn new() -> Self {
Self { account_subcategories: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
fn default() -> Self {
Self::new()
}
}
/// The account subcategories to use to filter for selectable accounts.
/// Valid subcategories are `checking` and `savings`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories
{
Checking,
Savings,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories::*;
match self {
Checking => "checking",
Savings => "savings",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories::*;
match s {
"checking" => Ok(Checking),
"savings" => Ok(Savings),
v => { tracing::warn!("Unknown value '{}' for enum '{}'", v, "CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories"); Ok(Unknown(v.to_owned())) }
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories)).finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The list of permissions to request.
/// If this parameter is passed, the `payment_method` permission must be included.
/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
Balances,
Ownership,
PaymentMethod,
Transactions,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*;
match self {
Balances => "balances",
Ownership => "ownership",
PaymentMethod => "payment_method",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*;
match s {
"balances" => Ok(Balances),
"ownership" => Ok(Ownership),
"payment_method" => Ok(PaymentMethod),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// List of data features that you would like to retrieve upon account creation.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
Balances,
Ownership,
Transactions,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*;
match self {
Balances => "balances",
Ownership => "ownership",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*;
match s {
"balances" => Ok(Balances),
"ownership" => Ok(Ownership),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
/// The method used to collect offline mandate customer acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_method:
Option<CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
pub fn new() -> Self {
Self { collection_method: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// The method used to collect offline mandate customer acceptance.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod {
Paper,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*;
match self {
Paper => "paper",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*;
match s {
"paper" => Ok(Paper),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Additional fields for network related functions
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
/// Triggers validations to run across the selected networks
#[serde(skip_serializing_if = "Option::is_none")]
pub requested:
Option<Vec<CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks")
.finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
pub fn new() -> Self {
Self { requested: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
fn default() -> Self {
Self::new()
}
}
/// Triggers validations to run across the selected networks
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
Ach,
UsDomesticWire,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*;
match self {
Ach => "ach",
UsDomesticWire => "us_domestic_wire",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*;
match s {
"ach" => Ok(Ach),
"us_domestic_wire" => Ok(UsDomesticWire),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The purpose of the transaction.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
Goods,
Other,
Services,
Unspecified,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match self {
Goods => "goods",
Other => "other",
Services => "services",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match s {
"goods" => Ok(Goods),
"other" => Ok(Other),
"services" => Ok(Services),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Bank account verification method. The default value is `automatic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
Automatic,
Instant,
Microdeposits,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsWechatPay {
/// The app ID registered with WeChat Pay. Only required when client is ios or android.
#[serde(skip_serializing_if = "Option::is_none")]
pub app_id: Option<String>,
/// The client type that the end customer will pay from
#[serde(skip_serializing_if = "Option::is_none")]
pub client: Option<CreatePaymentIntentPaymentMethodOptionsWechatPayClient>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsWechatPay").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsWechatPay {
pub fn new() -> Self {
Self { app_id: None, client: None, setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsWechatPay {
fn default() -> Self {
Self::new()
}
}
/// The client type that the end customer will pay from
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
Android,
Ios,
Web,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsWechatPayClient::*;
match self {
Android => "android",
Ios => "ios",
Web => "web",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsWechatPayClient::*;
match s {
"android" => Ok(Android),
"ios" => Ok(Ios),
"web" => Ok(Web),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsWechatPayClient"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsWechatPayClient))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CreatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentPaymentMethodOptionsZip {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsZip {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentPaymentMethodOptionsZip").finish_non_exhaustive()
}
}
impl CreatePaymentIntentPaymentMethodOptionsZip {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for CreatePaymentIntentPaymentMethodOptionsZip {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
pub fn as_str(&self) -> &str {
use CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CreatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Options to configure Radar.
/// Learn more about [Radar Sessions](https://docs.stripe.com/radar/radar-session).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentRadarOptions {
/// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentRadarOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentRadarOptions").finish_non_exhaustive()
}
}
impl CreatePaymentIntentRadarOptions {
pub fn new() -> Self {
Self { session: None }
}
}
impl Default for CreatePaymentIntentRadarOptions {
fn default() -> Self {
Self::new()
}
}
/// Shipping information for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentShipping {
/// Shipping address.
pub address: CreatePaymentIntentShippingAddress,
/// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub carrier: Option<String>,
/// Recipient name.
pub name: String,
/// Recipient phone (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
/// The tracking number for a physical product, obtained from the delivery service.
/// If multiple tracking numbers were generated for this purchase, please separate them with commas.
#[serde(skip_serializing_if = "Option::is_none")]
pub tracking_number: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentShipping {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentShipping").finish_non_exhaustive()
}
}
impl CreatePaymentIntentShipping {
pub fn new(
address: impl Into<CreatePaymentIntentShippingAddress>,
name: impl Into<String>,
) -> Self {
Self {
address: address.into(),
carrier: None,
name: name.into(),
phone: None,
tracking_number: None,
}
}
}
/// Shipping address.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentShippingAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Address line 1, such as the street, PO Box, or company name.
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2, such as the apartment, suite, unit, or building.
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentShippingAddress {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentShippingAddress").finish_non_exhaustive()
}
}
impl CreatePaymentIntentShippingAddress {
pub fn new() -> Self {
Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
}
}
impl Default for CreatePaymentIntentShippingAddress {
fn default() -> Self {
Self::new()
}
}
/// The parameters that you can use to automatically create a Transfer.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntentTransferData {
/// The amount that will be transferred automatically when a charge succeeds.
/// The amount is capped at the total transaction amount and if no amount is set,
/// the full amount is transferred.
///
/// If you intend to collect a fee and you need a more robust reporting experience, using
/// [application_fee_amount](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-application_fee_amount).
/// might be a better fit for your integration.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// If specified, successful charges will be attributed to the destination
/// account for tax reporting, and the funds from charges will be transferred
/// to the destination account. The ID of the resulting transfer will be
/// returned on the successful charge's `transfer` field.
pub destination: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntentTransferData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntentTransferData").finish_non_exhaustive()
}
}
impl CreatePaymentIntentTransferData {
pub fn new(destination: impl Into<String>) -> Self {
Self { amount: None, destination: destination.into() }
}
}
/// Creates a PaymentIntent object.
///
/// After the PaymentIntent is created, attach a payment method and [confirm](https://stripe.com/docs/api/payment_intents/confirm).
/// to continue the payment. Learn more about [the available payment flows
/// with the Payment Intents API](https://stripe.com/docs/payments/payment-intents).
///
/// When you use `confirm=true` during creation, it’s equivalent to creating
/// and confirming the PaymentIntent in the same call. You can use any parameters
/// available in the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) when you supply
/// `confirm=true`.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CreatePaymentIntent {
inner: CreatePaymentIntentBuilder,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CreatePaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CreatePaymentIntent").finish_non_exhaustive()
}
}
impl CreatePaymentIntent {
/// Construct a new `CreatePaymentIntent`.
pub fn new(amount: impl Into<i64>, currency: impl Into<stripe_types::Currency>) -> Self {
Self { inner: CreatePaymentIntentBuilder::new(amount.into(), currency.into()) }
}
/// Provides industry-specific information about the amount.
pub fn amount_details(
mut self,
amount_details: impl Into<CreatePaymentIntentAmountDetails>,
) -> Self {
self.inner.amount_details = Some(amount_details.into());
self
}
/// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account.
/// The amount of the application fee collected will be capped at the total amount captured.
/// For more information, see the PaymentIntents [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn application_fee_amount(mut self, application_fee_amount: impl Into<i64>) -> Self {
self.inner.application_fee_amount = Some(application_fee_amount.into());
self
}
/// When you enable this parameter, this PaymentIntent accepts payment methods that you enable in the Dashboard and that are compatible with this PaymentIntent's other parameters.
pub fn automatic_payment_methods(
mut self,
automatic_payment_methods: impl Into<CreatePaymentIntentAutomaticPaymentMethods>,
) -> Self {
self.inner.automatic_payment_methods = Some(automatic_payment_methods.into());
self
}
/// Controls when the funds will be captured from the customer's account.
pub fn capture_method(
mut self,
capture_method: impl Into<stripe_shared::PaymentIntentCaptureMethod>,
) -> Self {
self.inner.capture_method = Some(capture_method.into());
self
}
/// Set to `true` to attempt to [confirm this PaymentIntent](https://docs.stripe.com/api/payment_intents/confirm) immediately.
/// This parameter defaults to `false`.
/// When creating and confirming a PaymentIntent at the same time, you can also provide the parameters available in the [Confirm API](https://docs.stripe.com/api/payment_intents/confirm).
pub fn confirm(mut self, confirm: impl Into<bool>) -> Self {
self.inner.confirm = Some(confirm.into());
self
}
/// Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment.
pub fn confirmation_method(
mut self,
confirmation_method: impl Into<stripe_shared::PaymentIntentConfirmationMethod>,
) -> Self {
self.inner.confirmation_method = Some(confirmation_method.into());
self
}
/// ID of the ConfirmationToken used to confirm this PaymentIntent.
///
/// If the provided ConfirmationToken contains properties that are also being provided in this request, such as `payment_method`, then the values in this request will take precedence.
pub fn confirmation_token(mut self, confirmation_token: impl Into<String>) -> Self {
self.inner.confirmation_token = Some(confirmation_token.into());
self
}
/// ID of the Customer this PaymentIntent belongs to, if one exists.
///
/// Payment methods attached to other Customers cannot be used with this PaymentIntent.
///
/// If [setup_future_usage](https://api.stripe.com#payment_intent_object-setup_future_usage) is set and this PaymentIntent's payment method is not `card_present`, then the payment method attaches to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete.
/// If the payment method is `card_present` and isn't a digital wallet, then a [generated_card](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card is created and attached to the Customer instead.
pub fn customer(mut self, customer: impl Into<String>) -> Self {
self.inner.customer = Some(customer.into());
self
}
/// ID of the Account representing the customer that this PaymentIntent belongs to, if one exists.
///
/// Payment methods attached to other Accounts cannot be used with this PaymentIntent.
///
/// If [setup_future_usage](https://api.stripe.com#payment_intent_object-setup_future_usage) is set and this PaymentIntent's payment method is not `card_present`, then the payment method attaches to the Account after the PaymentIntent has been confirmed and any required actions from the user are complete.
/// If the payment method is `card_present` and isn't a digital wallet, then a [generated_card](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card is created and attached to the Account instead.
pub fn customer_account(mut self, customer_account: impl Into<String>) -> Self {
self.inner.customer_account = Some(customer_account.into());
self
}
/// An arbitrary string attached to the object. Often useful for displaying to users.
pub fn description(mut self, description: impl Into<String>) -> Self {
self.inner.description = Some(description.into());
self
}
/// Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`.
/// Use this parameter for simpler integrations that don't handle customer actions, such as [saving cards without authentication](https://docs.stripe.com/payments/save-card-without-authentication).
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
pub fn error_on_requires_action(mut self, error_on_requires_action: impl Into<bool>) -> Self {
self.inner.error_on_requires_action = Some(error_on_requires_action.into());
self
}
/// The list of payment method types to exclude from use with this payment.
pub fn excluded_payment_method_types(
mut self,
excluded_payment_method_types: impl Into<
Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>,
>,
) -> Self {
self.inner.excluded_payment_method_types = Some(excluded_payment_method_types.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// Automations to be run during the PaymentIntent lifecycle
pub fn hooks(mut self, hooks: impl Into<AsyncWorkflowsParam>) -> Self {
self.inner.hooks = Some(hooks.into());
self
}
/// ID of the mandate that's used for this payment.
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
pub fn mandate(mut self, mandate: impl Into<String>) -> Self {
self.inner.mandate = Some(mandate.into());
self
}
/// This hash contains details about the Mandate to create.
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
pub fn mandate_data(mut self, mandate_data: impl Into<CreatePaymentIntentMandateData>) -> Self {
self.inner.mandate_data = Some(mandate_data.into());
self
}
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
/// Set to `true` to indicate that the customer isn't in your checkout flow during this payment attempt and can't authenticate.
/// Use this parameter in scenarios where you collect card details and [charge them later](https://docs.stripe.com/payments/cards/charging-saved-cards).
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
pub fn off_session(mut self, off_session: impl Into<CreatePaymentIntentOffSession>) -> Self {
self.inner.off_session = Some(off_session.into());
self
}
/// The Stripe account ID that these funds are intended for.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn on_behalf_of(mut self, on_behalf_of: impl Into<String>) -> Self {
self.inner.on_behalf_of = Some(on_behalf_of.into());
self
}
/// Provides industry-specific information about the charge.
pub fn payment_details(
mut self,
payment_details: impl Into<CreatePaymentIntentPaymentDetails>,
) -> Self {
self.inner.payment_details = Some(payment_details.into());
self
}
/// ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://docs.stripe.com/payments/payment-methods#compatibility) object) to attach to this PaymentIntent.
///
/// If you don't provide the `payment_method` parameter or the `source` parameter with `confirm=true`, `source` automatically populates with `customer.default_source` to improve migration for users of the Charges API.
/// We recommend that you explicitly provide the `payment_method` moving forward.
/// If the payment method is attached to a Customer, you must also provide the ID of that Customer as the [customer](https://api.stripe.com#create_payment_intent-customer) parameter of this PaymentIntent.
/// end
pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
self.inner.payment_method = Some(payment_method.into());
self
}
/// The ID of the [payment method configuration](https://docs.stripe.com/api/payment_method_configurations) to use with this PaymentIntent.
pub fn payment_method_configuration(
mut self,
payment_method_configuration: impl Into<String>,
) -> Self {
self.inner.payment_method_configuration = Some(payment_method_configuration.into());
self
}
/// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear
/// in the [payment_method](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-payment_method).
/// property on the PaymentIntent.
pub fn payment_method_data(
mut self,
payment_method_data: impl Into<CreatePaymentIntentPaymentMethodData>,
) -> Self {
self.inner.payment_method_data = Some(payment_method_data.into());
self
}
/// Payment method-specific configuration for this PaymentIntent.
pub fn payment_method_options(
mut self,
payment_method_options: impl Into<CreatePaymentIntentPaymentMethodOptions>,
) -> Self {
self.inner.payment_method_options = Some(payment_method_options.into());
self
}
/// The list of payment method types (for example, a card) that this PaymentIntent can use.
/// If you don't provide this, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods).
/// A list of valid payment method types can be found [here](https://docs.stripe.com/api/payment_methods/object#payment_method_object-type).
pub fn payment_method_types(mut self, payment_method_types: impl Into<Vec<String>>) -> Self {
self.inner.payment_method_types = Some(payment_method_types.into());
self
}
/// Options to configure Radar.
/// Learn more about [Radar Sessions](https://docs.stripe.com/radar/radar-session).
pub fn radar_options(
mut self,
radar_options: impl Into<CreatePaymentIntentRadarOptions>,
) -> Self {
self.inner.radar_options = Some(radar_options.into());
self
}
/// Email address to send the receipt to.
/// If you specify `receipt_email` for a payment in live mode, you send a receipt regardless of your [email settings](https://dashboard.stripe.com/account/emails).
pub fn receipt_email(mut self, receipt_email: impl Into<String>) -> Self {
self.inner.receipt_email = Some(receipt_email.into());
self
}
/// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.
/// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme.
/// This parameter can only be used with [`confirm=true`](https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm).
pub fn return_url(mut self, return_url: impl Into<String>) -> Self {
self.inner.return_url = Some(return_url.into());
self
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
pub fn setup_future_usage(
mut self,
setup_future_usage: impl Into<stripe_shared::PaymentIntentSetupFutureUsage>,
) -> Self {
self.inner.setup_future_usage = Some(setup_future_usage.into());
self
}
/// Shipping information for this PaymentIntent.
pub fn shipping(mut self, shipping: impl Into<CreatePaymentIntentShipping>) -> Self {
self.inner.shipping = Some(shipping.into());
self
}
/// Text that appears on the customer's statement as the statement descriptor for a non-card charge.
/// This value overrides the account's default statement descriptor.
/// For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors).
///
/// Setting this value for a card charge returns an error.
/// For card charges, set the [statement_descriptor_suffix](https://docs.stripe.com/get-started/account/statement-descriptors#dynamic) instead.
pub fn statement_descriptor(mut self, statement_descriptor: impl Into<String>) -> Self {
self.inner.statement_descriptor = Some(statement_descriptor.into());
self
}
/// Provides information about a card charge.
/// Concatenated to the account's [statement descriptor prefix](https://docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer's statement.
pub fn statement_descriptor_suffix(
mut self,
statement_descriptor_suffix: impl Into<String>,
) -> Self {
self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix.into());
self
}
/// The parameters that you can use to automatically create a Transfer.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn transfer_data(
mut self,
transfer_data: impl Into<CreatePaymentIntentTransferData>,
) -> Self {
self.inner.transfer_data = Some(transfer_data.into());
self
}
/// A string that identifies the resulting payment as part of a group.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/connect/separate-charges-and-transfers).
pub fn transfer_group(mut self, transfer_group: impl Into<String>) -> Self {
self.inner.transfer_group = Some(transfer_group.into());
self
}
/// Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions.
pub fn use_stripe_sdk(mut self, use_stripe_sdk: impl Into<bool>) -> Self {
self.inner.use_stripe_sdk = Some(use_stripe_sdk.into());
self
}
}
impl CreatePaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for CreatePaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
RequestBuilder::new(StripeMethod::Post, "/payment_intents").form(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct UpdatePaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
amount_details: Option<UpdatePaymentIntentAmountDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
application_fee_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
capture_method: Option<stripe_shared::PaymentIntentCaptureMethod>,
#[serde(skip_serializing_if = "Option::is_none")]
currency: Option<stripe_types::Currency>,
#[serde(skip_serializing_if = "Option::is_none")]
customer: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
customer_account: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
excluded_payment_method_types:
Option<Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
hooks: Option<AsyncWorkflowsParam>,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_details: Option<UpdatePaymentIntentPaymentDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_configuration: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_data: Option<UpdatePaymentIntentPaymentMethodData>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_options: Option<UpdatePaymentIntentPaymentMethodOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_types: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
receipt_email: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
setup_future_usage: Option<stripe_shared::PaymentIntentSetupFutureUsage>,
#[serde(skip_serializing_if = "Option::is_none")]
shipping: Option<UpdatePaymentIntentShipping>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor_suffix: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
transfer_data: Option<UpdatePaymentIntentTransferData>,
#[serde(skip_serializing_if = "Option::is_none")]
transfer_group: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentBuilder").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentBuilder {
fn new() -> Self {
Self {
amount: None,
amount_details: None,
application_fee_amount: None,
capture_method: None,
currency: None,
customer: None,
customer_account: None,
description: None,
excluded_payment_method_types: None,
expand: None,
hooks: None,
metadata: None,
payment_details: None,
payment_method: None,
payment_method_configuration: None,
payment_method_data: None,
payment_method_options: None,
payment_method_types: None,
receipt_email: None,
setup_future_usage: None,
shipping: None,
statement_descriptor: None,
statement_descriptor_suffix: None,
transfer_data: None,
transfer_group: None,
}
}
}
/// Provides industry-specific information about the amount.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentAmountDetails {
/// The total discount applied on the transaction represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[line_items][#][discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Set to `false` to return arithmetic validation errors in the response without failing the request.
/// Use this when you want the operation to proceed regardless of arithmetic errors in the line item data.
///
/// Omit or set to `true` to immediately return a 400 error when arithmetic validation fails.
/// Use this for strict validation that prevents processing with line item data that has arithmetic inconsistencies.
///
/// For card payments, Stripe doesn't send line item data to card networks if there's an arithmetic validation error.
#[serde(skip_serializing_if = "Option::is_none")]
pub enforce_arithmetic_validation: Option<bool>,
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub line_items: Option<Vec<UpdatePaymentIntentAmountDetailsLineItems>>,
/// Contains information about the shipping portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<AmountDetailsShippingParam>,
/// Contains information about the tax portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsTaxParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentAmountDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentAmountDetails").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentAmountDetails {
pub fn new() -> Self {
Self {
discount_amount: None,
enforce_arithmetic_validation: None,
line_items: None,
shipping: None,
tax: None,
}
}
}
impl Default for UpdatePaymentIntentAmountDetails {
fn default() -> Self {
Self::new()
}
}
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentAmountDetailsLineItems {
/// The discount applied on this line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Payment method-specific information for line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_options:
Option<UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions>,
/// The product code of the line item, such as an SKU.
/// Required for L3 rates.
/// At most 12 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_code: Option<String>,
/// The product name of the line item. Required for L3 rates. At most 1024 characters long.
///
/// For Cards, this field is truncated to 26 alphanumeric characters before being sent to the card networks.
/// For PayPal, this field is truncated to 127 characters.
pub product_name: String,
/// The quantity of items. Required for L3 rates. An integer greater than 0.
pub quantity: u64,
/// Contains information about the tax on the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsLineItemTaxParam>,
/// The unit cost of the line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L3 rates.
/// An integer greater than or equal to 0.
pub unit_cost: i64,
/// A unit of measure for the line item, such as gallons, feet, meters, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_of_measure: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentAmountDetailsLineItems {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentAmountDetailsLineItems").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentAmountDetailsLineItems {
pub fn new(
product_name: impl Into<String>,
quantity: impl Into<u64>,
unit_cost: impl Into<i64>,
) -> Self {
Self {
discount_amount: None,
payment_method_options: None,
product_code: None,
product_name: product_name.into(),
quantity: quantity.into(),
tax: None,
unit_cost: unit_cost.into(),
unit_of_measure: None,
}
}
}
/// Payment method-specific information for line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard>,
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present:
Option<UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent>,
/// This sub-hash contains line item details that are specific to the `klarna` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam>,
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
pub fn new() -> Self {
Self { card: None, card_present: None, klarna: None, paypal: None }
}
}
impl Default for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
/// Type of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub category:
Option<UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory>,
/// Description of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The Stripe account ID of the connected account that sells the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub sold_by: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self { category: None, description: None, sold_by: None }
}
}
impl Default for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Type of the line item.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
DigitalGoods,
Donation,
PhysicalGoods,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match self {
DigitalGoods => "digital_goods",
Donation => "donation",
PhysicalGoods => "physical_goods",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match s {
"digital_goods" => Ok(DigitalGoods),
"donation" => Ok(Donation),
"physical_goods" => Ok(PhysicalGoods),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Provides industry-specific information about the charge.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentDetails {
/// A unique value to identify the customer. This field is available only for card payments.
///
/// This field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_reference: Option<String>,
/// A unique value assigned by the business to identify the transaction. Required for L2 and L3 rates.
///
/// For Cards, this field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
/// For Klarna, this field is truncated to 255 characters and is visible to customers when they view the order in the Klarna app.
#[serde(skip_serializing_if = "Option::is_none")]
pub order_reference: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentDetails").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentDetails {
pub fn new() -> Self {
Self { customer_reference: None, order_reference: None }
}
}
impl Default for UpdatePaymentIntentPaymentDetails {
fn default() -> Self {
Self::new()
}
}
/// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear
/// in the [payment_method](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-payment_method).
/// property on the PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodData {
/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<PaymentMethodParam>,
/// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub affirm: Option<miniserde::json::Value>,
/// If this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub afterpay_clearpay: Option<miniserde::json::Value>,
/// If this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub alipay: Option<miniserde::json::Value>,
/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
/// The field defaults to `unspecified`.
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_redisplay: Option<UpdatePaymentIntentPaymentMethodDataAllowRedisplay>,
/// If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub alma: Option<miniserde::json::Value>,
/// If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub amazon_pay: Option<miniserde::json::Value>,
/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<UpdatePaymentIntentPaymentMethodDataAuBecsDebit>,
/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<UpdatePaymentIntentPaymentMethodDataBacsDebit>,
/// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub bancontact: Option<miniserde::json::Value>,
/// If this is a `billie` PaymentMethod, this hash contains details about the Billie payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub billie: Option<miniserde::json::Value>,
/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_details: Option<UpdatePaymentIntentPaymentMethodDataBillingDetails>,
/// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub blik: Option<miniserde::json::Value>,
/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<UpdatePaymentIntentPaymentMethodDataBoleto>,
/// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub cashapp: Option<miniserde::json::Value>,
/// If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub crypto: Option<miniserde::json::Value>,
/// If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub customer_balance: Option<miniserde::json::Value>,
/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps: Option<UpdatePaymentIntentPaymentMethodDataEps>,
/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<UpdatePaymentIntentPaymentMethodDataFpx>,
/// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub giropay: Option<miniserde::json::Value>,
/// If this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub grabpay: Option<miniserde::json::Value>,
/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<UpdatePaymentIntentPaymentMethodDataIdeal>,
/// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub interac_present: Option<miniserde::json::Value>,
/// If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub kakao_pay: Option<miniserde::json::Value>,
/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<UpdatePaymentIntentPaymentMethodDataKlarna>,
/// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub konbini: Option<miniserde::json::Value>,
/// If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub kr_card: Option<miniserde::json::Value>,
/// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub link: Option<miniserde::json::Value>,
/// If this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub mb_way: Option<miniserde::json::Value>,
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<std::collections::HashMap<String, String>>,
/// If this is a `mobilepay` PaymentMethod, this hash contains details about the MobilePay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub mobilepay: Option<miniserde::json::Value>,
/// If this is a `multibanco` PaymentMethod, this hash contains details about the Multibanco payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub multibanco: Option<miniserde::json::Value>,
/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub naver_pay: Option<UpdatePaymentIntentPaymentMethodDataNaverPay>,
/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub nz_bank_account: Option<UpdatePaymentIntentPaymentMethodDataNzBankAccount>,
/// If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub oxxo: Option<miniserde::json::Value>,
/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub p24: Option<UpdatePaymentIntentPaymentMethodDataP24>,
/// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pay_by_bank: Option<miniserde::json::Value>,
/// If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub payco: Option<miniserde::json::Value>,
/// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub paynow: Option<miniserde::json::Value>,
/// If this is a `paypal` PaymentMethod, this hash contains details about the PayPal payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub paypal: Option<miniserde::json::Value>,
/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub payto: Option<UpdatePaymentIntentPaymentMethodDataPayto>,
/// If this is a `pix` PaymentMethod, this hash contains details about the Pix payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pix: Option<miniserde::json::Value>,
/// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub promptpay: Option<miniserde::json::Value>,
/// Options to configure Radar.
/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
#[serde(skip_serializing_if = "Option::is_none")]
pub radar_options: Option<UpdatePaymentIntentPaymentMethodDataRadarOptions>,
/// If this is a `revolut_pay` PaymentMethod, this hash contains details about the Revolut Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub revolut_pay: Option<miniserde::json::Value>,
/// If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub samsung_pay: Option<miniserde::json::Value>,
/// If this is a `satispay` PaymentMethod, this hash contains details about the Satispay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub satispay: Option<miniserde::json::Value>,
/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<UpdatePaymentIntentPaymentMethodDataSepaDebit>,
/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<UpdatePaymentIntentPaymentMethodDataSofort>,
/// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub swish: Option<miniserde::json::Value>,
/// If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub twint: Option<miniserde::json::Value>,
/// The type of the PaymentMethod.
/// An additional hash is included on the PaymentMethod with a name matching this value.
/// It contains additional information specific to the PaymentMethod type.
#[serde(rename = "type")]
pub type_: UpdatePaymentIntentPaymentMethodDataType,
/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub upi: Option<UpdatePaymentIntentPaymentMethodDataUpi>,
/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<UpdatePaymentIntentPaymentMethodDataUsBankAccount>,
/// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub wechat_pay: Option<miniserde::json::Value>,
/// If this is a `zip` PaymentMethod, this hash contains details about the Zip payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub zip: Option<miniserde::json::Value>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodData").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodData {
pub fn new(type_: impl Into<UpdatePaymentIntentPaymentMethodDataType>) -> Self {
Self {
acss_debit: None,
affirm: None,
afterpay_clearpay: None,
alipay: None,
allow_redisplay: None,
alma: None,
amazon_pay: None,
au_becs_debit: None,
bacs_debit: None,
bancontact: None,
billie: None,
billing_details: None,
blik: None,
boleto: None,
cashapp: None,
crypto: None,
customer_balance: None,
eps: None,
fpx: None,
giropay: None,
grabpay: None,
ideal: None,
interac_present: None,
kakao_pay: None,
klarna: None,
konbini: None,
kr_card: None,
link: None,
mb_way: None,
metadata: None,
mobilepay: None,
multibanco: None,
naver_pay: None,
nz_bank_account: None,
oxxo: None,
p24: None,
pay_by_bank: None,
payco: None,
paynow: None,
paypal: None,
payto: None,
pix: None,
promptpay: None,
radar_options: None,
revolut_pay: None,
samsung_pay: None,
satispay: None,
sepa_debit: None,
sofort: None,
swish: None,
twint: None,
type_: type_.into(),
upi: None,
us_bank_account: None,
wechat_pay: None,
zip: None,
}
}
}
/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
/// The field defaults to `unspecified`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
Always,
Limited,
Unspecified,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataAllowRedisplay::*;
match self {
Always => "always",
Limited => "limited",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataAllowRedisplay::*;
match s {
"always" => Ok(Always),
"limited" => Ok(Limited),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataAllowRedisplay"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataAllowRedisplay))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataAllowRedisplay {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataAuBecsDebit {
/// The account number for the bank account.
pub account_number: String,
/// Bank-State-Branch number of the bank account.
pub bsb_number: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataAuBecsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataAuBecsDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataAuBecsDebit {
pub fn new(account_number: impl Into<String>, bsb_number: impl Into<String>) -> Self {
Self { account_number: account_number.into(), bsb_number: bsb_number.into() }
}
}
/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataBacsDebit {
/// Account number of the bank account that the funds will be debited from.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Sort code of the bank account. (e.g., `10-20-30`)
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataBacsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataBacsDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataBacsDebit {
pub fn new() -> Self {
Self { account_number: None, sort_code: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataBacsDebit {
fn default() -> Self {
Self::new()
}
}
/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataBillingDetails {
/// Billing address.
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress>,
/// Email address.
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
/// Full name.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Billing phone number (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
/// Taxpayer identification number.
/// Used only for transactions between LATAM buyers and non-LATAM sellers.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_id: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataBillingDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataBillingDetails").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataBillingDetails {
pub fn new() -> Self {
Self { address: None, email: None, name: None, phone: None, tax_id: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataBillingDetails {
fn default() -> Self {
Self::new()
}
}
/// Billing address.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Address line 1, such as the street, PO Box, or company name.
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2, such as the apartment, suite, unit, or building.
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress {
pub fn new() -> Self {
Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataBillingDetailsAddress {
fn default() -> Self {
Self::new()
}
}
/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataBoleto {
/// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
pub tax_id: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataBoleto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataBoleto").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataBoleto {
pub fn new(tax_id: impl Into<String>) -> Self {
Self { tax_id: tax_id.into() }
}
}
/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataEps {
/// The customer's bank.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<UpdatePaymentIntentPaymentMethodDataEpsBank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataEps {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataEps").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataEps {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataEps {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataEpsBank {
ArzteUndApothekerBank,
AustrianAnadiBankAg,
BankAustria,
BankhausCarlSpangler,
BankhausSchelhammerUndSchatteraAg,
BawagPskAg,
BksBankAg,
BrullKallmusBankAg,
BtvVierLanderBank,
CapitalBankGraweGruppeAg,
DeutscheBankAg,
Dolomitenbank,
EasybankAg,
ErsteBankUndSparkassen,
HypoAlpeadriabankInternationalAg,
HypoBankBurgenlandAktiengesellschaft,
HypoNoeLbFurNiederosterreichUWien,
HypoOberosterreichSalzburgSteiermark,
HypoTirolBankAg,
HypoVorarlbergBankAg,
MarchfelderBank,
OberbankAg,
RaiffeisenBankengruppeOsterreich,
SchoellerbankAg,
SpardaBankWien,
VolksbankGruppe,
VolkskreditbankAg,
VrBankBraunau,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataEpsBank {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataEpsBank::*;
match self {
ArzteUndApothekerBank => "arzte_und_apotheker_bank",
AustrianAnadiBankAg => "austrian_anadi_bank_ag",
BankAustria => "bank_austria",
BankhausCarlSpangler => "bankhaus_carl_spangler",
BankhausSchelhammerUndSchatteraAg => "bankhaus_schelhammer_und_schattera_ag",
BawagPskAg => "bawag_psk_ag",
BksBankAg => "bks_bank_ag",
BrullKallmusBankAg => "brull_kallmus_bank_ag",
BtvVierLanderBank => "btv_vier_lander_bank",
CapitalBankGraweGruppeAg => "capital_bank_grawe_gruppe_ag",
DeutscheBankAg => "deutsche_bank_ag",
Dolomitenbank => "dolomitenbank",
EasybankAg => "easybank_ag",
ErsteBankUndSparkassen => "erste_bank_und_sparkassen",
HypoAlpeadriabankInternationalAg => "hypo_alpeadriabank_international_ag",
HypoBankBurgenlandAktiengesellschaft => "hypo_bank_burgenland_aktiengesellschaft",
HypoNoeLbFurNiederosterreichUWien => "hypo_noe_lb_fur_niederosterreich_u_wien",
HypoOberosterreichSalzburgSteiermark => "hypo_oberosterreich_salzburg_steiermark",
HypoTirolBankAg => "hypo_tirol_bank_ag",
HypoVorarlbergBankAg => "hypo_vorarlberg_bank_ag",
MarchfelderBank => "marchfelder_bank",
OberbankAg => "oberbank_ag",
RaiffeisenBankengruppeOsterreich => "raiffeisen_bankengruppe_osterreich",
SchoellerbankAg => "schoellerbank_ag",
SpardaBankWien => "sparda_bank_wien",
VolksbankGruppe => "volksbank_gruppe",
VolkskreditbankAg => "volkskreditbank_ag",
VrBankBraunau => "vr_bank_braunau",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataEpsBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataEpsBank::*;
match s {
"arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank),
"austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg),
"bank_austria" => Ok(BankAustria),
"bankhaus_carl_spangler" => Ok(BankhausCarlSpangler),
"bankhaus_schelhammer_und_schattera_ag" => Ok(BankhausSchelhammerUndSchatteraAg),
"bawag_psk_ag" => Ok(BawagPskAg),
"bks_bank_ag" => Ok(BksBankAg),
"brull_kallmus_bank_ag" => Ok(BrullKallmusBankAg),
"btv_vier_lander_bank" => Ok(BtvVierLanderBank),
"capital_bank_grawe_gruppe_ag" => Ok(CapitalBankGraweGruppeAg),
"deutsche_bank_ag" => Ok(DeutscheBankAg),
"dolomitenbank" => Ok(Dolomitenbank),
"easybank_ag" => Ok(EasybankAg),
"erste_bank_und_sparkassen" => Ok(ErsteBankUndSparkassen),
"hypo_alpeadriabank_international_ag" => Ok(HypoAlpeadriabankInternationalAg),
"hypo_bank_burgenland_aktiengesellschaft" => Ok(HypoBankBurgenlandAktiengesellschaft),
"hypo_noe_lb_fur_niederosterreich_u_wien" => Ok(HypoNoeLbFurNiederosterreichUWien),
"hypo_oberosterreich_salzburg_steiermark" => Ok(HypoOberosterreichSalzburgSteiermark),
"hypo_tirol_bank_ag" => Ok(HypoTirolBankAg),
"hypo_vorarlberg_bank_ag" => Ok(HypoVorarlbergBankAg),
"marchfelder_bank" => Ok(MarchfelderBank),
"oberbank_ag" => Ok(OberbankAg),
"raiffeisen_bankengruppe_osterreich" => Ok(RaiffeisenBankengruppeOsterreich),
"schoellerbank_ag" => Ok(SchoellerbankAg),
"sparda_bank_wien" => Ok(SpardaBankWien),
"volksbank_gruppe" => Ok(VolksbankGruppe),
"volkskreditbank_ag" => Ok(VolkskreditbankAg),
"vr_bank_braunau" => Ok(VrBankBraunau),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataEpsBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataEpsBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataEpsBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataEpsBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataFpx {
/// Account holder type for FPX transaction
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type: Option<UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType>,
/// The customer's bank.
pub bank: UpdatePaymentIntentPaymentMethodDataFpxBank,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpx {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataFpx").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataFpx {
pub fn new(bank: impl Into<UpdatePaymentIntentPaymentMethodDataFpxBank>) -> Self {
Self { account_holder_type: None, bank: bank.into() }
}
}
/// Account holder type for FPX transaction
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
Company,
Individual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType::*;
match self {
Company => "company",
Individual => "individual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType::*;
match s {
"company" => Ok(Company),
"individual" => Ok(Individual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataFpxAccountHolderType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataFpxBank {
AffinBank,
Agrobank,
AllianceBank,
Ambank,
BankIslam,
BankMuamalat,
BankOfChina,
BankRakyat,
Bsn,
Cimb,
DeutscheBank,
HongLeongBank,
Hsbc,
Kfh,
Maybank2e,
Maybank2u,
Ocbc,
PbEnterprise,
PublicBank,
Rhb,
StandardChartered,
Uob,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataFpxBank {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataFpxBank::*;
match self {
AffinBank => "affin_bank",
Agrobank => "agrobank",
AllianceBank => "alliance_bank",
Ambank => "ambank",
BankIslam => "bank_islam",
BankMuamalat => "bank_muamalat",
BankOfChina => "bank_of_china",
BankRakyat => "bank_rakyat",
Bsn => "bsn",
Cimb => "cimb",
DeutscheBank => "deutsche_bank",
HongLeongBank => "hong_leong_bank",
Hsbc => "hsbc",
Kfh => "kfh",
Maybank2e => "maybank2e",
Maybank2u => "maybank2u",
Ocbc => "ocbc",
PbEnterprise => "pb_enterprise",
PublicBank => "public_bank",
Rhb => "rhb",
StandardChartered => "standard_chartered",
Uob => "uob",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataFpxBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataFpxBank::*;
match s {
"affin_bank" => Ok(AffinBank),
"agrobank" => Ok(Agrobank),
"alliance_bank" => Ok(AllianceBank),
"ambank" => Ok(Ambank),
"bank_islam" => Ok(BankIslam),
"bank_muamalat" => Ok(BankMuamalat),
"bank_of_china" => Ok(BankOfChina),
"bank_rakyat" => Ok(BankRakyat),
"bsn" => Ok(Bsn),
"cimb" => Ok(Cimb),
"deutsche_bank" => Ok(DeutscheBank),
"hong_leong_bank" => Ok(HongLeongBank),
"hsbc" => Ok(Hsbc),
"kfh" => Ok(Kfh),
"maybank2e" => Ok(Maybank2e),
"maybank2u" => Ok(Maybank2u),
"ocbc" => Ok(Ocbc),
"pb_enterprise" => Ok(PbEnterprise),
"public_bank" => Ok(PublicBank),
"rhb" => Ok(Rhb),
"standard_chartered" => Ok(StandardChartered),
"uob" => Ok(Uob),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataFpxBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataFpxBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataFpxBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataFpxBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataIdeal {
/// The customer's bank.
/// Only use this parameter for existing customers.
/// Don't use it for new customers.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<UpdatePaymentIntentPaymentMethodDataIdealBank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataIdeal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataIdeal").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataIdeal {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataIdeal {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
/// Only use this parameter for existing customers.
/// Don't use it for new customers.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataIdealBank {
AbnAmro,
Adyen,
AsnBank,
Bunq,
Buut,
Finom,
Handelsbanken,
Ing,
Knab,
Mollie,
Moneyou,
N26,
Nn,
Rabobank,
Regiobank,
Revolut,
SnsBank,
TriodosBank,
VanLanschot,
Yoursafe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataIdealBank {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataIdealBank::*;
match self {
AbnAmro => "abn_amro",
Adyen => "adyen",
AsnBank => "asn_bank",
Bunq => "bunq",
Buut => "buut",
Finom => "finom",
Handelsbanken => "handelsbanken",
Ing => "ing",
Knab => "knab",
Mollie => "mollie",
Moneyou => "moneyou",
N26 => "n26",
Nn => "nn",
Rabobank => "rabobank",
Regiobank => "regiobank",
Revolut => "revolut",
SnsBank => "sns_bank",
TriodosBank => "triodos_bank",
VanLanschot => "van_lanschot",
Yoursafe => "yoursafe",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataIdealBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataIdealBank::*;
match s {
"abn_amro" => Ok(AbnAmro),
"adyen" => Ok(Adyen),
"asn_bank" => Ok(AsnBank),
"bunq" => Ok(Bunq),
"buut" => Ok(Buut),
"finom" => Ok(Finom),
"handelsbanken" => Ok(Handelsbanken),
"ing" => Ok(Ing),
"knab" => Ok(Knab),
"mollie" => Ok(Mollie),
"moneyou" => Ok(Moneyou),
"n26" => Ok(N26),
"nn" => Ok(Nn),
"rabobank" => Ok(Rabobank),
"regiobank" => Ok(Regiobank),
"revolut" => Ok(Revolut),
"sns_bank" => Ok(SnsBank),
"triodos_bank" => Ok(TriodosBank),
"van_lanschot" => Ok(VanLanschot),
"yoursafe" => Ok(Yoursafe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataIdealBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataIdealBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataIdealBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataIdealBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataKlarna {
/// Customer's date of birth
#[serde(skip_serializing_if = "Option::is_none")]
pub dob: Option<DateOfBirth>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataKlarna {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataKlarna").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataKlarna {
pub fn new() -> Self {
Self { dob: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataKlarna {
fn default() -> Self {
Self::new()
}
}
/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataNaverPay {
/// Whether to use Naver Pay points or a card to fund this transaction.
/// If not provided, this defaults to `card`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding: Option<UpdatePaymentIntentPaymentMethodDataNaverPayFunding>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataNaverPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataNaverPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataNaverPay {
pub fn new() -> Self {
Self { funding: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataNaverPay {
fn default() -> Self {
Self::new()
}
}
/// Whether to use Naver Pay points or a card to fund this transaction.
/// If not provided, this defaults to `card`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
Card,
Points,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataNaverPayFunding::*;
match self {
Card => "card",
Points => "points",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataNaverPayFunding::*;
match s {
"card" => Ok(Card),
"points" => Ok(Points),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataNaverPayFunding"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataNaverPayFunding))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataNaverPayFunding {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataNzBankAccount {
/// The name on the bank account.
/// Only required if the account holder name is different from the name of the authorized signatory collected in the PaymentMethod’s billing details.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_name: Option<String>,
/// The account number for the bank account.
pub account_number: String,
/// The numeric code for the bank account's bank.
pub bank_code: String,
/// The numeric code for the bank account's bank branch.
pub branch_code: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// The suffix of the bank account number.
pub suffix: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataNzBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataNzBankAccount").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataNzBankAccount {
pub fn new(
account_number: impl Into<String>,
bank_code: impl Into<String>,
branch_code: impl Into<String>,
suffix: impl Into<String>,
) -> Self {
Self {
account_holder_name: None,
account_number: account_number.into(),
bank_code: bank_code.into(),
branch_code: branch_code.into(),
reference: None,
suffix: suffix.into(),
}
}
}
/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataP24 {
/// The customer's bank.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<UpdatePaymentIntentPaymentMethodDataP24Bank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataP24 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataP24").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataP24 {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataP24 {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataP24Bank {
AliorBank,
BankMillennium,
BankNowyBfgSa,
BankPekaoSa,
BankiSpbdzielcze,
Blik,
BnpParibas,
Boz,
CitiHandlowy,
CreditAgricole,
Envelobank,
EtransferPocztowy24,
GetinBank,
Ideabank,
Ing,
Inteligo,
MbankMtransfer,
NestPrzelew,
NoblePay,
PbacZIpko,
PlusBank,
SantanderPrzelew24,
TmobileUsbugiBankowe,
ToyotaBank,
Velobank,
VolkswagenBank,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataP24Bank {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataP24Bank::*;
match self {
AliorBank => "alior_bank",
BankMillennium => "bank_millennium",
BankNowyBfgSa => "bank_nowy_bfg_sa",
BankPekaoSa => "bank_pekao_sa",
BankiSpbdzielcze => "banki_spbdzielcze",
Blik => "blik",
BnpParibas => "bnp_paribas",
Boz => "boz",
CitiHandlowy => "citi_handlowy",
CreditAgricole => "credit_agricole",
Envelobank => "envelobank",
EtransferPocztowy24 => "etransfer_pocztowy24",
GetinBank => "getin_bank",
Ideabank => "ideabank",
Ing => "ing",
Inteligo => "inteligo",
MbankMtransfer => "mbank_mtransfer",
NestPrzelew => "nest_przelew",
NoblePay => "noble_pay",
PbacZIpko => "pbac_z_ipko",
PlusBank => "plus_bank",
SantanderPrzelew24 => "santander_przelew24",
TmobileUsbugiBankowe => "tmobile_usbugi_bankowe",
ToyotaBank => "toyota_bank",
Velobank => "velobank",
VolkswagenBank => "volkswagen_bank",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataP24Bank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataP24Bank::*;
match s {
"alior_bank" => Ok(AliorBank),
"bank_millennium" => Ok(BankMillennium),
"bank_nowy_bfg_sa" => Ok(BankNowyBfgSa),
"bank_pekao_sa" => Ok(BankPekaoSa),
"banki_spbdzielcze" => Ok(BankiSpbdzielcze),
"blik" => Ok(Blik),
"bnp_paribas" => Ok(BnpParibas),
"boz" => Ok(Boz),
"citi_handlowy" => Ok(CitiHandlowy),
"credit_agricole" => Ok(CreditAgricole),
"envelobank" => Ok(Envelobank),
"etransfer_pocztowy24" => Ok(EtransferPocztowy24),
"getin_bank" => Ok(GetinBank),
"ideabank" => Ok(Ideabank),
"ing" => Ok(Ing),
"inteligo" => Ok(Inteligo),
"mbank_mtransfer" => Ok(MbankMtransfer),
"nest_przelew" => Ok(NestPrzelew),
"noble_pay" => Ok(NoblePay),
"pbac_z_ipko" => Ok(PbacZIpko),
"plus_bank" => Ok(PlusBank),
"santander_przelew24" => Ok(SantanderPrzelew24),
"tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe),
"toyota_bank" => Ok(ToyotaBank),
"velobank" => Ok(Velobank),
"volkswagen_bank" => Ok(VolkswagenBank),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataP24Bank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataP24Bank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataP24Bank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataP24Bank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataPayto {
/// The account number for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Bank-State-Branch number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bsb_number: Option<String>,
/// The PayID alias for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub pay_id: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataPayto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataPayto").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataPayto {
pub fn new() -> Self {
Self { account_number: None, bsb_number: None, pay_id: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataPayto {
fn default() -> Self {
Self::new()
}
}
/// Options to configure Radar.
/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataRadarOptions {
/// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataRadarOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataRadarOptions").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataRadarOptions {
pub fn new() -> Self {
Self { session: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataRadarOptions {
fn default() -> Self {
Self::new()
}
}
/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataSepaDebit {
/// IBAN of the bank account.
pub iban: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataSepaDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataSepaDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataSepaDebit {
pub fn new(iban: impl Into<String>) -> Self {
Self { iban: iban.into() }
}
}
/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataSofort {
/// Two-letter ISO code representing the country the bank account is located in.
pub country: UpdatePaymentIntentPaymentMethodDataSofortCountry,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataSofort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataSofort").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataSofort {
pub fn new(country: impl Into<UpdatePaymentIntentPaymentMethodDataSofortCountry>) -> Self {
Self { country: country.into() }
}
}
/// Two-letter ISO code representing the country the bank account is located in.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataSofortCountry {
At,
Be,
De,
Es,
It,
Nl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataSofortCountry {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataSofortCountry::*;
match self {
At => "AT",
Be => "BE",
De => "DE",
Es => "ES",
It => "IT",
Nl => "NL",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataSofortCountry {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataSofortCountry::*;
match s {
"AT" => Ok(At),
"BE" => Ok(Be),
"DE" => Ok(De),
"ES" => Ok(Es),
"IT" => Ok(It),
"NL" => Ok(Nl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataSofortCountry"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataSofortCountry))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataSofortCountry {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataSofortCountry {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The type of the PaymentMethod.
/// An additional hash is included on the PaymentMethod with a name matching this value.
/// It contains additional information specific to the PaymentMethod type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataType {
AcssDebit,
Affirm,
AfterpayClearpay,
Alipay,
Alma,
AmazonPay,
AuBecsDebit,
BacsDebit,
Bancontact,
Billie,
Blik,
Boleto,
Cashapp,
Crypto,
CustomerBalance,
Eps,
Fpx,
Giropay,
Grabpay,
Ideal,
KakaoPay,
Klarna,
Konbini,
KrCard,
Link,
MbWay,
Mobilepay,
Multibanco,
NaverPay,
NzBankAccount,
Oxxo,
P24,
PayByBank,
Payco,
Paynow,
Paypal,
Payto,
Pix,
Promptpay,
RevolutPay,
SamsungPay,
Satispay,
SepaDebit,
Sofort,
Swish,
Twint,
Upi,
UsBankAccount,
WechatPay,
Zip,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataType::*;
match self {
AcssDebit => "acss_debit",
Affirm => "affirm",
AfterpayClearpay => "afterpay_clearpay",
Alipay => "alipay",
Alma => "alma",
AmazonPay => "amazon_pay",
AuBecsDebit => "au_becs_debit",
BacsDebit => "bacs_debit",
Bancontact => "bancontact",
Billie => "billie",
Blik => "blik",
Boleto => "boleto",
Cashapp => "cashapp",
Crypto => "crypto",
CustomerBalance => "customer_balance",
Eps => "eps",
Fpx => "fpx",
Giropay => "giropay",
Grabpay => "grabpay",
Ideal => "ideal",
KakaoPay => "kakao_pay",
Klarna => "klarna",
Konbini => "konbini",
KrCard => "kr_card",
Link => "link",
MbWay => "mb_way",
Mobilepay => "mobilepay",
Multibanco => "multibanco",
NaverPay => "naver_pay",
NzBankAccount => "nz_bank_account",
Oxxo => "oxxo",
P24 => "p24",
PayByBank => "pay_by_bank",
Payco => "payco",
Paynow => "paynow",
Paypal => "paypal",
Payto => "payto",
Pix => "pix",
Promptpay => "promptpay",
RevolutPay => "revolut_pay",
SamsungPay => "samsung_pay",
Satispay => "satispay",
SepaDebit => "sepa_debit",
Sofort => "sofort",
Swish => "swish",
Twint => "twint",
Upi => "upi",
UsBankAccount => "us_bank_account",
WechatPay => "wechat_pay",
Zip => "zip",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataType::*;
match s {
"acss_debit" => Ok(AcssDebit),
"affirm" => Ok(Affirm),
"afterpay_clearpay" => Ok(AfterpayClearpay),
"alipay" => Ok(Alipay),
"alma" => Ok(Alma),
"amazon_pay" => Ok(AmazonPay),
"au_becs_debit" => Ok(AuBecsDebit),
"bacs_debit" => Ok(BacsDebit),
"bancontact" => Ok(Bancontact),
"billie" => Ok(Billie),
"blik" => Ok(Blik),
"boleto" => Ok(Boleto),
"cashapp" => Ok(Cashapp),
"crypto" => Ok(Crypto),
"customer_balance" => Ok(CustomerBalance),
"eps" => Ok(Eps),
"fpx" => Ok(Fpx),
"giropay" => Ok(Giropay),
"grabpay" => Ok(Grabpay),
"ideal" => Ok(Ideal),
"kakao_pay" => Ok(KakaoPay),
"klarna" => Ok(Klarna),
"konbini" => Ok(Konbini),
"kr_card" => Ok(KrCard),
"link" => Ok(Link),
"mb_way" => Ok(MbWay),
"mobilepay" => Ok(Mobilepay),
"multibanco" => Ok(Multibanco),
"naver_pay" => Ok(NaverPay),
"nz_bank_account" => Ok(NzBankAccount),
"oxxo" => Ok(Oxxo),
"p24" => Ok(P24),
"pay_by_bank" => Ok(PayByBank),
"payco" => Ok(Payco),
"paynow" => Ok(Paynow),
"paypal" => Ok(Paypal),
"payto" => Ok(Payto),
"pix" => Ok(Pix),
"promptpay" => Ok(Promptpay),
"revolut_pay" => Ok(RevolutPay),
"samsung_pay" => Ok(SamsungPay),
"satispay" => Ok(Satispay),
"sepa_debit" => Ok(SepaDebit),
"sofort" => Ok(Sofort),
"swish" => Ok(Swish),
"twint" => Ok(Twint),
"upi" => Ok(Upi),
"us_bank_account" => Ok(UsBankAccount),
"wechat_pay" => Ok(WechatPay),
"zip" => Ok(Zip),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataType)).finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataUpi {
/// Configuration options for setting up an eMandate
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodDataUpiMandateOptions>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUpi {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataUpi").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataUpi {
pub fn new() -> Self {
Self { mandate_options: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataUpi {
fn default() -> Self {
Self::new()
}
}
/// Configuration options for setting up an eMandate
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataUpiMandateOptions {
/// Amount to be charged for future payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType>,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUpiMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataUpiMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataUpiMandateOptions {
pub fn new() -> Self {
Self { amount: None, amount_type: None, description: None, end_date: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataUpiMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodDataUpiMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodDataUsBankAccount {
/// Account holder type: individual or company.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type:
Option<UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType>,
/// Account number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Account type: checkings or savings. Defaults to checking if omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_type: Option<UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType>,
/// The ID of a Financial Connections Account to use as a payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub financial_connections_account: Option<String>,
/// Routing number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing_number: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodDataUsBankAccount").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodDataUsBankAccount {
pub fn new() -> Self {
Self {
account_holder_type: None,
account_number: None,
account_type: None,
financial_connections_account: None,
routing_number: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodDataUsBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Account holder type: individual or company.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
Company,
Individual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*;
match self {
Company => "company",
Individual => "individual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*;
match s {
"company" => Ok(Company),
"individual" => Ok(Individual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountHolderType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Account type: checkings or savings. Defaults to checking if omitted.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
Checking,
Savings,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*;
match self {
Checking => "checking",
Savings => "savings",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType::*;
match s {
"checking" => Ok(Checking),
"savings" => Ok(Savings),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Payment-method-specific configuration for this PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptions {
/// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebit>,
/// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub affirm: Option<UpdatePaymentIntentPaymentMethodOptionsAffirm>,
/// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub afterpay_clearpay: Option<UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay>,
/// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub alipay: Option<UpdatePaymentIntentPaymentMethodOptionsAlipay>,
/// If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub alma: Option<UpdatePaymentIntentPaymentMethodOptionsAlma>,
/// If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_pay: Option<UpdatePaymentIntentPaymentMethodOptionsAmazonPay>,
/// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit>,
/// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<UpdatePaymentIntentPaymentMethodOptionsBacsDebit>,
/// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub bancontact: Option<UpdatePaymentIntentPaymentMethodOptionsBancontact>,
/// If this is a `billie` PaymentMethod, this sub-hash contains details about the Billie payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub billie: Option<UpdatePaymentIntentPaymentMethodOptionsBillie>,
/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub blik: Option<UpdatePaymentIntentPaymentMethodOptionsBlik>,
/// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<UpdatePaymentIntentPaymentMethodOptionsBoleto>,
/// Configuration for any card payments attempted on this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<UpdatePaymentIntentPaymentMethodOptionsCard>,
/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present: Option<UpdatePaymentIntentPaymentMethodOptionsCardPresent>,
/// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp: Option<UpdatePaymentIntentPaymentMethodOptionsCashapp>,
/// If this is a `crypto` PaymentMethod, this sub-hash contains details about the Crypto payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub crypto: Option<UpdatePaymentIntentPaymentMethodOptionsCrypto>,
/// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_balance: Option<UpdatePaymentIntentPaymentMethodOptionsCustomerBalance>,
/// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps: Option<UpdatePaymentIntentPaymentMethodOptionsEps>,
/// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<UpdatePaymentIntentPaymentMethodOptionsFpx>,
/// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub giropay: Option<UpdatePaymentIntentPaymentMethodOptionsGiropay>,
/// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub grabpay: Option<UpdatePaymentIntentPaymentMethodOptionsGrabpay>,
/// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<UpdatePaymentIntentPaymentMethodOptionsIdeal>,
/// If this is a `interac_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub interac_present: Option<miniserde::json::Value>,
/// If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub kakao_pay: Option<UpdatePaymentIntentPaymentMethodOptionsKakaoPay>,
/// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<UpdatePaymentIntentPaymentMethodOptionsKlarna>,
/// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub konbini: Option<UpdatePaymentIntentPaymentMethodOptionsKonbini>,
/// If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub kr_card: Option<UpdatePaymentIntentPaymentMethodOptionsKrCard>,
/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub link: Option<UpdatePaymentIntentPaymentMethodOptionsLink>,
/// If this is a `mb_way` PaymentMethod, this sub-hash contains details about the MB WAY payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub mb_way: Option<UpdatePaymentIntentPaymentMethodOptionsMbWay>,
/// If this is a `MobilePay` PaymentMethod, this sub-hash contains details about the MobilePay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub mobilepay: Option<UpdatePaymentIntentPaymentMethodOptionsMobilepay>,
/// If this is a `multibanco` PaymentMethod, this sub-hash contains details about the Multibanco payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub multibanco: Option<UpdatePaymentIntentPaymentMethodOptionsMultibanco>,
/// If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub naver_pay: Option<UpdatePaymentIntentPaymentMethodOptionsNaverPay>,
/// If this is a `nz_bank_account` PaymentMethod, this sub-hash contains details about the NZ BECS Direct Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub nz_bank_account: Option<UpdatePaymentIntentPaymentMethodOptionsNzBankAccount>,
/// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub oxxo: Option<UpdatePaymentIntentPaymentMethodOptionsOxxo>,
/// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub p24: Option<UpdatePaymentIntentPaymentMethodOptionsP24>,
/// If this is a `pay_by_bank` PaymentMethod, this sub-hash contains details about the PayByBank payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pay_by_bank: Option<miniserde::json::Value>,
/// If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub payco: Option<UpdatePaymentIntentPaymentMethodOptionsPayco>,
/// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub paynow: Option<UpdatePaymentIntentPaymentMethodOptionsPaynow>,
/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<UpdatePaymentIntentPaymentMethodOptionsPaypal>,
/// If this is a `payto` PaymentMethod, this sub-hash contains details about the PayTo payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub payto: Option<UpdatePaymentIntentPaymentMethodOptionsPayto>,
/// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub pix: Option<UpdatePaymentIntentPaymentMethodOptionsPix>,
/// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub promptpay: Option<UpdatePaymentIntentPaymentMethodOptionsPromptpay>,
/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub revolut_pay: Option<UpdatePaymentIntentPaymentMethodOptionsRevolutPay>,
/// If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub samsung_pay: Option<UpdatePaymentIntentPaymentMethodOptionsSamsungPay>,
/// If this is a `satispay` PaymentMethod, this sub-hash contains details about the Satispay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub satispay: Option<UpdatePaymentIntentPaymentMethodOptionsSatispay>,
/// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<UpdatePaymentIntentPaymentMethodOptionsSepaDebit>,
/// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<UpdatePaymentIntentPaymentMethodOptionsSofort>,
/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub swish: Option<UpdatePaymentIntentPaymentMethodOptionsSwish>,
/// If this is a `twint` PaymentMethod, this sub-hash contains details about the TWINT payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub twint: Option<UpdatePaymentIntentPaymentMethodOptionsTwint>,
/// If this is a `upi` PaymentIntent, this sub-hash contains details about the UPI payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub upi: Option<UpdatePaymentIntentPaymentMethodOptionsUpi>,
/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccount>,
/// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub wechat_pay: Option<UpdatePaymentIntentPaymentMethodOptionsWechatPay>,
/// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub zip: Option<UpdatePaymentIntentPaymentMethodOptionsZip>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptions").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptions {
pub fn new() -> Self {
Self {
acss_debit: None,
affirm: None,
afterpay_clearpay: None,
alipay: None,
alma: None,
amazon_pay: None,
au_becs_debit: None,
bacs_debit: None,
bancontact: None,
billie: None,
blik: None,
boleto: None,
card: None,
card_present: None,
cashapp: None,
crypto: None,
customer_balance: None,
eps: None,
fpx: None,
giropay: None,
grabpay: None,
ideal: None,
interac_present: None,
kakao_pay: None,
klarna: None,
konbini: None,
kr_card: None,
link: None,
mb_way: None,
mobilepay: None,
multibanco: None,
naver_pay: None,
nz_bank_account: None,
oxxo: None,
p24: None,
pay_by_bank: None,
payco: None,
paynow: None,
paypal: None,
payto: None,
pix: None,
promptpay: None,
revolut_pay: None,
samsung_pay: None,
satispay: None,
sepa_debit: None,
sofort: None,
swish: None,
twint: None,
upi: None,
us_bank_account: None,
wechat_pay: None,
zip: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
/// Bank account verification method. The default value is `automatic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAcssDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAcssDebit {
pub fn new() -> Self {
Self {
mandate_options: None,
setup_future_usage: None,
target_date: None,
verification_method: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAcssDebit {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
/// A URL for custom mandate text to render during confirmation step.
/// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,.
/// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent.
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_mandate_url: Option<String>,
/// Description of the mandate interval.
/// Only required if 'payment_schedule' parameter is 'interval' or 'combined'.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_description: Option<String>,
/// Payment schedule for the mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_schedule:
Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule>,
/// Transaction type of the mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_type:
Option<UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
pub fn new() -> Self {
Self {
custom_mandate_url: None,
interval_description: None,
payment_schedule: None,
transaction_type: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// Payment schedule for the mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule {
Combined,
Interval,
Sporadic,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*;
match self {
Combined => "combined",
Interval => "interval",
Sporadic => "sporadic",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*;
match s {
"combined" => Ok(Combined),
"interval" => Ok(Interval),
"sporadic" => Ok(Sporadic),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Transaction type of the mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
Business,
Personal,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*;
match self {
Business => "business",
Personal => "personal",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*;
match s {
"business" => Ok(Business),
"personal" => Ok(Personal),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Bank account verification method. The default value is `automatic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
Automatic,
Instant,
Microdeposits,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAffirm {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod>,
/// Preferred language of the Affirm authorization page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirm {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAffirm").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAffirm {
pub fn new() -> Self {
Self { capture_method: None, preferred_locale: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAffirm {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method:
Option<UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod>,
/// An internal identifier or reference that this payment corresponds to.
/// You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes.
/// This field differs from the statement descriptor and item name.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
pub fn new() -> Self {
Self { capture_method: None, reference: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAlipay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlipay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAlipay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAlipay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAlipay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAlma {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlma {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAlma").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAlma {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAlma {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAmazonPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAmazonPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAmazonPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAmazonPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAmazonPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit {
pub fn new() -> Self {
Self { setup_future_usage: None, target_date: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebit {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsBacsDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<PaymentMethodOptionsMandateOptionsParam>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBacsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsBacsDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsBacsDebit {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None, target_date: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsBacsDebit {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsBancontact {
/// Preferred language of the Bancontact authorization page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_language:
Option<UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontact {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsBancontact").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsBancontact {
pub fn new() -> Self {
Self { preferred_language: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsBancontact {
fn default() -> Self {
Self::new()
}
}
/// Preferred language of the Bancontact authorization page that the customer is redirected to.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
De,
En,
Fr,
Nl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*;
match self {
De => "de",
En => "en",
Fr => "fr",
Nl => "nl",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*;
match s {
"de" => Ok(De),
"en" => Ok(En),
"fr" => Ok(Fr),
"nl" => Ok(Nl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsBancontactPreferredLanguage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `billie` PaymentMethod, this sub-hash contains details about the Billie payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsBillie {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBillie {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsBillie").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsBillie {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsBillie {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsBlik {
/// The 6-digit BLIK code that a customer has generated using their banking application.
/// Can only be set on confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBlik {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsBlik").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsBlik {
pub fn new() -> Self {
Self { code: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsBlik {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsBoleto {
/// The number of calendar days before a Boleto voucher expires.
/// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBoleto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsBoleto").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsBoleto {
pub fn new() -> Self {
Self { expires_after_days: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsBoleto {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Configuration for any card payments attempted on this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCard {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod>,
/// A single-use `cvc_update` Token that represents a card CVC value.
/// When provided, the CVC value will be verified during the card payment attempt.
/// This parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub cvc_token: Option<String>,
/// Installment configuration for payments attempted on this PaymentIntent.
///
/// For more information, see the [installments integration guide](https://docs.stripe.com/payments/installments).
#[serde(skip_serializing_if = "Option::is_none")]
pub installments: Option<UpdatePaymentIntentPaymentMethodOptionsCardInstallments>,
/// Configuration options for setting up an eMandate for cards issued in India.
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions>,
/// When specified, this parameter indicates that a transaction will be marked
/// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This
/// parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub moto: Option<bool>,
/// Selected network to process this PaymentIntent on.
/// Depends on the available networks of the card attached to the PaymentIntent.
/// Can be only set confirm-time.
#[serde(skip_serializing_if = "Option::is_none")]
pub network: Option<UpdatePaymentIntentPaymentMethodOptionsCardNetwork>,
/// Request ability to [capture beyond the standard authorization validity window](https://docs.stripe.com/payments/extended-authorization) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_extended_authorization:
Option<UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>,
/// Request ability to [increment the authorization](https://docs.stripe.com/payments/incremental-authorization) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_incremental_authorization:
Option<UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>,
/// Request ability to make [multiple captures](https://docs.stripe.com/payments/multicapture) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_multicapture:
Option<UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture>,
/// Request ability to [overcapture](https://docs.stripe.com/payments/overcapture) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_overcapture: Option<UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture>,
/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://docs.stripe.com/strong-customer-authentication).
/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
/// If not provided, this value defaults to `automatic`.
/// Read our guide on [manually requesting 3D Secure](https://docs.stripe.com/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_three_d_secure:
Option<UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>,
/// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e.
/// using the cvc_token parameter).
#[serde(skip_serializing_if = "Option::is_none")]
pub require_cvc_recollection: Option<bool>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage>,
/// Provides information about a card payment that customers see on their statements.
/// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor.
/// Maximum 22 characters.
/// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor_suffix_kana: Option<String>,
/// Provides information about a card payment that customers see on their statements.
/// Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that’s set on the account to form the complete statement descriptor.
/// Maximum 17 characters.
/// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor_suffix_kanji: Option<String>,
/// If 3D Secure authentication was performed with a third-party provider,
/// the authentication details to use for this payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub three_d_secure: Option<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCard").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCard {
pub fn new() -> Self {
Self {
capture_method: None,
cvc_token: None,
installments: None,
mandate_options: None,
moto: None,
network: None,
request_extended_authorization: None,
request_incremental_authorization: None,
request_multicapture: None,
request_overcapture: None,
request_three_d_secure: None,
require_cvc_recollection: None,
setup_future_usage: None,
statement_descriptor_suffix_kana: None,
statement_descriptor_suffix_kanji: None,
three_d_secure: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Installment configuration for payments attempted on this PaymentIntent.
///
/// For more information, see the [installments integration guide](https://docs.stripe.com/payments/installments).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardInstallments {
/// Setting to true enables installments for this PaymentIntent.
/// This will cause the response to contain a list of available installment plans.
/// Setting to false will prevent any selected plan from applying to a charge.
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
/// The selected installment plan to use for this payment attempt.
/// This parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub plan: Option<UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallments {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardInstallments")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardInstallments {
pub fn new() -> Self {
Self { enabled: None, plan: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCardInstallments {
fn default() -> Self {
Self::new()
}
}
/// The selected installment plan to use for this payment attempt.
/// This parameter can only be provided during confirmation.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
/// For `fixed_count` installment plans, this is required.
/// It represents the number of installment payments your customer will make to their credit card.
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<u64>,
/// For `fixed_count` installment plans, this is required.
/// It represents the interval between installment payments your customer will make to their credit card.
/// One of `month`.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval: Option<UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval>,
/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
#[serde(rename = "type")]
pub type_: UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
pub fn new(
type_: impl Into<UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType>,
) -> Self {
Self { count: None, interval: None, type_: type_.into() }
}
}
/// For `fixed_count` installment plans, this is required.
/// It represents the interval between installment payments your customer will make to their credit card.
/// One of `month`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
Month,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*;
match self {
Month => "month",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*;
match s {
"month" => Ok(Month),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
Bonus,
FixedCount,
Revolving,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*;
match self {
Bonus => "bonus",
FixedCount => "fixed_count",
Revolving => "revolving",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*;
match s {
"bonus" => Ok(Bonus),
"fixed_count" => Ok(FixedCount),
"revolving" => Ok(Revolving),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardInstallmentsPlanType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Configuration options for setting up an eMandate for cards issued in India.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions {
/// Amount to be charged for future payments, specified in the presentment currency.
pub amount: i64,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
pub amount_type: UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
/// If not provided, the mandate will be active until canceled.
/// If provided, end date should be after start date.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`.
pub interval: UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval,
/// The number of intervals between payments.
/// For example, `interval=month` and `interval_count=3` indicates one payment every three months.
/// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks).
/// This parameter is optional when `interval=sporadic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
/// Unique identifier for the mandate or subscription.
pub reference: String,
/// Start date of the mandate or subscription. Start date should not be lesser than yesterday.
pub start_date: stripe_types::Timestamp,
/// Specifies the type of mandates supported. Possible values are `india`.
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_types:
Option<Vec<UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptions {
pub fn new(
amount: impl Into<i64>,
amount_type: impl Into<UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType>,
interval: impl Into<UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval>,
reference: impl Into<String>,
start_date: impl Into<stripe_types::Timestamp>,
) -> Self {
Self {
amount: amount.into(),
amount_type: amount_type.into(),
description: None,
end_date: None,
interval: interval.into(),
interval_count: None,
reference: reference.into(),
start_date: start_date.into(),
supported_types: None,
}
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
Day,
Month,
Sporadic,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*;
match self {
Day => "day",
Month => "month",
Sporadic => "sporadic",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"sporadic" => Ok(Sporadic),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Specifies the type of mandates supported. Possible values are `india`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
India,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*;
match self {
India => "india",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*;
match s {
"india" => Ok(India),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Selected network to process this PaymentIntent on.
/// Depends on the available networks of the card attached to the PaymentIntent.
/// Can be only set confirm-time.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
Amex,
CartesBancaires,
Diners,
Discover,
EftposAu,
Girocard,
Interac,
Jcb,
Link,
Mastercard,
Unionpay,
Unknown,
Visa,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
/// This variant is prefixed with an underscore to avoid conflicts with Stripe's 'Unknown' variant.
_Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardNetwork::*;
match self {
Amex => "amex",
CartesBancaires => "cartes_bancaires",
Diners => "diners",
Discover => "discover",
EftposAu => "eftpos_au",
Girocard => "girocard",
Interac => "interac",
Jcb => "jcb",
Link => "link",
Mastercard => "mastercard",
Unionpay => "unionpay",
Unknown => "unknown",
Visa => "visa",
_Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardNetwork::*;
match s {
"amex" => Ok(Amex),
"cartes_bancaires" => Ok(CartesBancaires),
"diners" => Ok(Diners),
"discover" => Ok(Discover),
"eftpos_au" => Ok(EftposAu),
"girocard" => Ok(Girocard),
"interac" => Ok(Interac),
"jcb" => Ok(Jcb),
"link" => Ok(Link),
"mastercard" => Ok(Mastercard),
"unionpay" => Ok(Unionpay),
"unknown" => Ok(Unknown),
"visa" => Ok(Visa),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardNetwork"
);
Ok(_Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardNetwork))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsCardNetwork {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [capture beyond the standard authorization validity window](https://docs.stripe.com/payments/extended-authorization) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [increment the authorization](https://docs.stripe.com/payments/incremental-authorization) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to make [multiple captures](https://docs.stripe.com/payments/multicapture) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardRequestMulticapture
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [overcapture](https://docs.stripe.com/payments/overcapture) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardRequestOvercapture
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://docs.stripe.com/strong-customer-authentication).
/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
/// If not provided, this value defaults to `automatic`.
/// Read our guide on [manually requesting 3D Secure](https://docs.stripe.com/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
Any,
Automatic,
Challenge,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
match self {
Any => "any",
Automatic => "automatic",
Challenge => "challenge",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
match s {
"any" => Ok(Any),
"automatic" => Ok(Automatic),
"challenge" => Ok(Challenge),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardRequestThreeDSecure
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If 3D Secure authentication was performed with a third-party provider,
/// the authentication details to use for this payment.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure {
/// The `transStatus` returned from the card Issuer’s ACS in the ARes.
#[serde(skip_serializing_if = "Option::is_none")]
pub ares_trans_status:
Option<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus>,
/// The cryptogram, also known as the "authentication value" (AAV, CAVV or
/// AEVV). This value is 20 bytes, base64-encoded into a 28-character string.
/// (Most 3D Secure providers will return the base64-encoded version, which
/// is what you should specify here.)
pub cryptogram: String,
/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure
/// provider and indicates what degree of authentication was performed.
#[serde(skip_serializing_if = "Option::is_none")]
pub electronic_commerce_indicator:
Option<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator>,
/// The exemption requested via 3DS and accepted by the issuer at authentication time.
#[serde(skip_serializing_if = "Option::is_none")]
pub exemption_indicator:
Option<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator>,
/// Network specific 3DS fields. Network specific arguments require an
/// explicit card brand choice. The parameter `payment_method_options.card.network``
/// must be populated accordingly
#[serde(skip_serializing_if = "Option::is_none")]
pub network_options:
Option<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions>,
/// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the
/// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99.
#[serde(skip_serializing_if = "Option::is_none")]
pub requestor_challenge_indicator: Option<String>,
/// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server
/// Transaction ID (dsTransID).
pub transaction_id: String,
/// The version of 3D Secure that was performed.
pub version: UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecure {
pub fn new(
cryptogram: impl Into<String>,
transaction_id: impl Into<String>,
version: impl Into<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion>,
) -> Self {
Self {
ares_trans_status: None,
cryptogram: cryptogram.into(),
electronic_commerce_indicator: None,
exemption_indicator: None,
network_options: None,
requestor_challenge_indicator: None,
transaction_id: transaction_id.into(),
version: version.into(),
}
}
}
/// The `transStatus` returned from the card Issuer’s ACS in the ARes.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
A,
C,
I,
N,
R,
U,
Y,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*;
match self {
A => "A",
C => "C",
I => "I",
N => "N",
R => "R",
U => "U",
Y => "Y",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*;
match s {
"A" => Ok(A),
"C" => Ok(C),
"I" => Ok(I),
"N" => Ok(N),
"R" => Ok(R),
"U" => Ok(U),
"Y" => Ok(Y),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure
/// provider and indicates what degree of authentication was performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator {
V01,
V02,
V05,
V06,
V07,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*;
match self {
V01 => "01",
V02 => "02",
V05 => "05",
V06 => "06",
V07 => "07",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*;
match s {
"01" => Ok(V01),
"02" => Ok(V02),
"05" => Ok(V05),
"06" => Ok(V06),
"07" => Ok(V07),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The exemption requested via 3DS and accepted by the issuer at authentication time.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
LowRisk,
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*;
match self {
LowRisk => "low_risk",
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*;
match s {
"low_risk" => Ok(LowRisk),
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Network specific 3DS fields. Network specific arguments require an
/// explicit card brand choice. The parameter `payment_method_options.card.network``
/// must be populated accordingly
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
/// Cartes Bancaires-specific 3DS fields.
#[serde(skip_serializing_if = "Option::is_none")]
pub cartes_bancaires: Option<
UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires,
>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
pub fn new() -> Self {
Self { cartes_bancaires: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
fn default() -> Self {
Self::new()
}
}
/// Cartes Bancaires-specific 3DS fields.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires {
/// The cryptogram calculation algorithm used by the card Issuer's ACS
/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`.
/// messageExtension: CB-AVALGO
pub cb_avalgo: UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo,
/// The exemption indicator returned from Cartes Bancaires in the ARes.
/// message extension: CB-EXEMPTION; string (4 characters)
/// This is a 3 byte bitmap (low significant byte first and most significant
/// bit first) that has been Base64 encoded
#[serde(skip_serializing_if = "Option::is_none")]
pub cb_exemption: Option<String>,
/// The risk score returned from Cartes Bancaires in the ARes.
/// message extension: CB-SCORE; numeric value 0-99
#[serde(skip_serializing_if = "Option::is_none")]
pub cb_score: Option<i64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires",
)
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires {
pub fn new(
cb_avalgo: impl Into<UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo>,
) -> Self {
Self { cb_avalgo: cb_avalgo.into(), cb_exemption: None, cb_score: None }
}
}
/// The cryptogram calculation algorithm used by the card Issuer's ACS
/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`.
/// messageExtension: CB-AVALGO
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
V0,
V1,
V2,
V3,
V4,
A,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*;
match self {
V0 => "0",
V1 => "1",
V2 => "2",
V3 => "3",
V4 => "4",
A => "A",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*;
match s {
"0" => Ok(V0),
"1" => Ok(V1),
"2" => Ok(V2),
"3" => Ok(V3),
"4" => Ok(V4),
"A" => Ok(A),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo)).finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The version of 3D Secure that was performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
V1_0_2,
V2_1_0,
V2_2_0,
V2_3_0,
V2_3_1,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*;
match self {
V1_0_2 => "1.0.2",
V2_1_0 => "2.1.0",
V2_2_0 => "2.2.0",
V2_3_0 => "2.3.0",
V2_3_1 => "2.3.1",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*;
match s {
"1.0.2" => Ok(V1_0_2),
"2.1.0" => Ok(V2_1_0),
"2.2.0" => Ok(V2_2_0),
"2.3.0" => Ok(V2_3_0),
"2.3.1" => Ok(V2_3_1),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardThreeDSecureVersion
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardPresent {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod>,
/// Request ability to capture this payment beyond the standard [authorization validity window](https://docs.stripe.com/terminal/features/extended-authorizations#authorization-validity).
#[serde(skip_serializing_if = "Option::is_none")]
pub request_extended_authorization: Option<bool>,
/// Request ability to [increment](https://docs.stripe.com/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible.
/// Check [incremental_authorization_supported](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://docs.stripe.com/api/payment_intents/confirm) response to verify support.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_incremental_authorization_support: Option<bool>,
/// Network routing priority on co-branded EMV cards supporting domestic debit and international card schemes.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing: Option<UpdatePaymentIntentPaymentMethodOptionsCardPresentRouting>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardPresent").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self {
capture_method: None,
request_extended_authorization: None,
request_incremental_authorization_support: None,
routing: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
Manual,
ManualPreferred,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod::*;
match self {
Manual => "manual",
ManualPreferred => "manual_preferred",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod::*;
match s {
"manual" => Ok(Manual),
"manual_preferred" => Ok(ManualPreferred),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardPresentCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Network routing priority on co-branded EMV cards supporting domestic debit and international card schemes.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCardPresentRouting {
/// Routing requested priority
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_priority:
Option<UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCardPresentRouting {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCardPresentRouting")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCardPresentRouting {
pub fn new() -> Self {
Self { requested_priority: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCardPresentRouting {
fn default() -> Self {
Self::new()
}
}
/// Routing requested priority
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority {
Domestic,
International,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority::*;
match self {
Domestic => "domestic",
International => "international",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority::*;
match s {
"domestic" => Ok(Domestic),
"international" => Ok(International),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCashapp {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashapp {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCashapp").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCashapp {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCashapp {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCashappSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `crypto` PaymentMethod, this sub-hash contains details about the Crypto payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCrypto {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCrypto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCrypto").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCrypto {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCrypto {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalance {
/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank_transfer: Option<UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer>,
/// The funding method type to be used when there are not enough funds in the customer balance.
/// Permitted values include: `bank_transfer`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding_type: Option<UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalance {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCustomerBalance")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalance {
pub fn new() -> Self {
Self { bank_transfer: None, funding_type: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsCustomerBalance {
fn default() -> Self {
Self::new()
}
}
/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
/// Configuration for the eu_bank_transfer funding type.
#[serde(skip_serializing_if = "Option::is_none")]
pub eu_bank_transfer: Option<EuBankTransferParams>,
/// List of address types that should be returned in the financial_addresses response.
/// If not specified, all valid types will be returned.
///
/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_address_types: Option<
Vec<
UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes,
>,
>,
/// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
#[serde(rename = "type")]
pub type_: UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
pub fn new(
type_: impl Into<UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType>,
) -> Self {
Self { eu_bank_transfer: None, requested_address_types: None, type_: type_.into() }
}
}
/// List of address types that should be returned in the financial_addresses response.
/// If not specified, all valid types will be returned.
///
/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes {
Aba,
Iban,
Sepa,
SortCode,
Spei,
Swift,
Zengin,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*;
match self {
Aba => "aba",
Iban => "iban",
Sepa => "sepa",
SortCode => "sort_code",
Spei => "spei",
Swift => "swift",
Zengin => "zengin",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*;
match s {
"aba" => Ok(Aba),
"iban" => Ok(Iban),
"sepa" => Ok(Sepa),
"sort_code" => Ok(SortCode),
"spei" => Ok(Spei),
"swift" => Ok(Swift),
"zengin" => Ok(Zengin),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
EuBankTransfer,
GbBankTransfer,
JpBankTransfer,
MxBankTransfer,
UsBankTransfer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*;
match self {
EuBankTransfer => "eu_bank_transfer",
GbBankTransfer => "gb_bank_transfer",
JpBankTransfer => "jp_bank_transfer",
MxBankTransfer => "mx_bank_transfer",
UsBankTransfer => "us_bank_transfer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*;
match s {
"eu_bank_transfer" => Ok(EuBankTransfer),
"gb_bank_transfer" => Ok(GbBankTransfer),
"jp_bank_transfer" => Ok(JpBankTransfer),
"mx_bank_transfer" => Ok(MxBankTransfer),
"us_bank_transfer" => Ok(UsBankTransfer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The funding method type to be used when there are not enough funds in the customer balance.
/// Permitted values include: `bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
BankTransfer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*;
match self {
BankTransfer => "bank_transfer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*;
match s {
"bank_transfer" => Ok(BankTransfer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceFundingType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsEps {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsEps {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsEps").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsEps {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsEps {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsFpx {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsFpx {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsFpx").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsFpx {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsFpx {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsGiropay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGiropay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsGiropay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsGiropay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsGiropay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsGrabpay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGrabpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsGrabpay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsGrabpay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsGrabpay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsIdeal {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsIdeal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsIdeal").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsIdeal {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsIdeal {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsKakaoPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKakaoPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsKakaoPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsKakaoPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsKakaoPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsKlarna {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod>,
/// On-demand details if setting up or charging an on-demand payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub on_demand: Option<UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemand>,
/// Preferred language of the Klarna authorization page that the customer is redirected to
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage>,
/// Subscription details if setting up or charging a subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub subscriptions: Option<Vec<UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarna {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsKlarna").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarna {
pub fn new() -> Self {
Self {
capture_method: None,
on_demand: None,
preferred_locale: None,
setup_future_usage: None,
subscriptions: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsKlarna {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// On-demand details if setting up or charging an on-demand payment.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
/// Your average amount value.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub average_amount: Option<i64>,
/// The maximum value you may charge a customer per purchase.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum_amount: Option<i64>,
/// The lowest or minimum value you may charge a customer per purchase.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_amount: Option<i64>,
/// Interval at which the customer is making purchases
#[serde(skip_serializing_if = "Option::is_none")]
pub purchase_interval:
Option<UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval>,
/// The number of `purchase_interval` between charges
#[serde(skip_serializing_if = "Option::is_none")]
pub purchase_interval_count: Option<u64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemand")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
pub fn new() -> Self {
Self {
average_amount: None,
maximum_amount: None,
minimum_amount: None,
purchase_interval: None,
purchase_interval_count: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemand {
fn default() -> Self {
Self::new()
}
}
/// Interval at which the customer is making purchases
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
Day,
Month,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval::*;
match self {
Day => "day",
Month => "month",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Preferred language of the Klarna authorization page that the customer is redirected to
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
CsMinusCz,
DaMinusDk,
DeMinusAt,
DeMinusCh,
DeMinusDe,
ElMinusGr,
EnMinusAt,
EnMinusAu,
EnMinusBe,
EnMinusCa,
EnMinusCh,
EnMinusCz,
EnMinusDe,
EnMinusDk,
EnMinusEs,
EnMinusFi,
EnMinusFr,
EnMinusGb,
EnMinusGr,
EnMinusIe,
EnMinusIt,
EnMinusNl,
EnMinusNo,
EnMinusNz,
EnMinusPl,
EnMinusPt,
EnMinusRo,
EnMinusSe,
EnMinusUs,
EsMinusEs,
EsMinusUs,
FiMinusFi,
FrMinusBe,
FrMinusCa,
FrMinusCh,
FrMinusFr,
ItMinusCh,
ItMinusIt,
NbMinusNo,
NlMinusBe,
NlMinusNl,
PlMinusPl,
PtMinusPt,
RoMinusRo,
SvMinusFi,
SvMinusSe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*;
match self {
CsMinusCz => "cs-CZ",
DaMinusDk => "da-DK",
DeMinusAt => "de-AT",
DeMinusCh => "de-CH",
DeMinusDe => "de-DE",
ElMinusGr => "el-GR",
EnMinusAt => "en-AT",
EnMinusAu => "en-AU",
EnMinusBe => "en-BE",
EnMinusCa => "en-CA",
EnMinusCh => "en-CH",
EnMinusCz => "en-CZ",
EnMinusDe => "en-DE",
EnMinusDk => "en-DK",
EnMinusEs => "en-ES",
EnMinusFi => "en-FI",
EnMinusFr => "en-FR",
EnMinusGb => "en-GB",
EnMinusGr => "en-GR",
EnMinusIe => "en-IE",
EnMinusIt => "en-IT",
EnMinusNl => "en-NL",
EnMinusNo => "en-NO",
EnMinusNz => "en-NZ",
EnMinusPl => "en-PL",
EnMinusPt => "en-PT",
EnMinusRo => "en-RO",
EnMinusSe => "en-SE",
EnMinusUs => "en-US",
EsMinusEs => "es-ES",
EsMinusUs => "es-US",
FiMinusFi => "fi-FI",
FrMinusBe => "fr-BE",
FrMinusCa => "fr-CA",
FrMinusCh => "fr-CH",
FrMinusFr => "fr-FR",
ItMinusCh => "it-CH",
ItMinusIt => "it-IT",
NbMinusNo => "nb-NO",
NlMinusBe => "nl-BE",
NlMinusNl => "nl-NL",
PlMinusPl => "pl-PL",
PtMinusPt => "pt-PT",
RoMinusRo => "ro-RO",
SvMinusFi => "sv-FI",
SvMinusSe => "sv-SE",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*;
match s {
"cs-CZ" => Ok(CsMinusCz),
"da-DK" => Ok(DaMinusDk),
"de-AT" => Ok(DeMinusAt),
"de-CH" => Ok(DeMinusCh),
"de-DE" => Ok(DeMinusDe),
"el-GR" => Ok(ElMinusGr),
"en-AT" => Ok(EnMinusAt),
"en-AU" => Ok(EnMinusAu),
"en-BE" => Ok(EnMinusBe),
"en-CA" => Ok(EnMinusCa),
"en-CH" => Ok(EnMinusCh),
"en-CZ" => Ok(EnMinusCz),
"en-DE" => Ok(EnMinusDe),
"en-DK" => Ok(EnMinusDk),
"en-ES" => Ok(EnMinusEs),
"en-FI" => Ok(EnMinusFi),
"en-FR" => Ok(EnMinusFr),
"en-GB" => Ok(EnMinusGb),
"en-GR" => Ok(EnMinusGr),
"en-IE" => Ok(EnMinusIe),
"en-IT" => Ok(EnMinusIt),
"en-NL" => Ok(EnMinusNl),
"en-NO" => Ok(EnMinusNo),
"en-NZ" => Ok(EnMinusNz),
"en-PL" => Ok(EnMinusPl),
"en-PT" => Ok(EnMinusPt),
"en-RO" => Ok(EnMinusRo),
"en-SE" => Ok(EnMinusSe),
"en-US" => Ok(EnMinusUs),
"es-ES" => Ok(EsMinusEs),
"es-US" => Ok(EsMinusUs),
"fi-FI" => Ok(FiMinusFi),
"fr-BE" => Ok(FrMinusBe),
"fr-CA" => Ok(FrMinusCa),
"fr-CH" => Ok(FrMinusCh),
"fr-FR" => Ok(FrMinusFr),
"it-CH" => Ok(ItMinusCh),
"it-IT" => Ok(ItMinusIt),
"nb-NO" => Ok(NbMinusNo),
"nl-BE" => Ok(NlMinusBe),
"nl-NL" => Ok(NlMinusNl),
"pl-PL" => Ok(PlMinusPl),
"pt-PT" => Ok(PtMinusPt),
"ro-RO" => Ok(RoMinusRo),
"sv-FI" => Ok(SvMinusFi),
"sv-SE" => Ok(SvMinusSe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Subscription details if setting up or charging a subscription.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
/// Unit of time between subscription charges.
pub interval: UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval,
/// The number of intervals (specified in the `interval` attribute) between subscription charges.
/// For example, `interval=month` and `interval_count=3` charges every 3 months.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
/// Name for subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Describes the upcoming charge for this subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_billing: Option<SubscriptionNextBillingParam>,
/// A non-customer-facing reference to correlate subscription charges in the Klarna app.
/// Use a value that persists across subscription charges.
pub reference: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
pub fn new(
interval: impl Into<UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval>,
reference: impl Into<String>,
) -> Self {
Self {
interval: interval.into(),
interval_count: None,
name: None,
next_billing: None,
reference: reference.into(),
}
}
}
/// Unit of time between subscription charges.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
Day,
Month,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval::*;
match self {
Day => "day",
Month => "month",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsKonbini {
/// An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores.
/// Must not consist of only zeroes and could be rejected in case of insufficient uniqueness.
/// We recommend to use the customer's phone number.
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_number: Option<String>,
/// The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire.
/// For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST.
/// Defaults to 3 days.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// The timestamp at which the Konbini payment instructions will expire.
/// Only one of `expires_after_days` or `expires_at` may be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<stripe_types::Timestamp>,
/// A product descriptor of up to 22 characters, which will appear to customers at the convenience store.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_description: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKonbini {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsKonbini").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsKonbini {
pub fn new() -> Self {
Self {
confirmation_number: None,
expires_after_days: None,
expires_at: None,
product_description: None,
setup_future_usage: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsKonbini {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsKrCard {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKrCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsKrCard").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsKrCard {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsKrCard {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsLink {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod>,
/// \[Deprecated\] This is a legacy parameter that no longer has any function.
#[serde(skip_serializing_if = "Option::is_none")]
pub persistent_token: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsLink").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsLink {
pub fn new() -> Self {
Self { capture_method: None, persistent_token: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsLink {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `mb_way` PaymentMethod, this sub-hash contains details about the MB WAY payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsMbWay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMbWay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsMbWay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsMbWay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsMbWay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `MobilePay` PaymentMethod, this sub-hash contains details about the MobilePay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsMobilepay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMobilepay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsMobilepay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsMobilepay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsMobilepay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsMobilepayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `multibanco` PaymentMethod, this sub-hash contains details about the Multibanco payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsMultibanco {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMultibanco {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsMultibanco").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsMultibanco {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsMultibanco {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsNaverPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNaverPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsNaverPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsNaverPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsNaverPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `nz_bank_account` PaymentMethod, this sub-hash contains details about the NZ BECS Direct Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsNzBankAccount {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNzBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsNzBankAccount")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsNzBankAccount {
pub fn new() -> Self {
Self { setup_future_usage: None, target_date: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsNzBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsOxxo {
/// The number of calendar days before an OXXO voucher expires.
/// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsOxxo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsOxxo").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsOxxo {
pub fn new() -> Self {
Self { expires_after_days: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsOxxo {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsP24 {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage>,
/// Confirm that the payer has accepted the P24 terms and conditions.
#[serde(skip_serializing_if = "Option::is_none")]
pub tos_shown_and_accepted: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsP24 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsP24").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsP24 {
pub fn new() -> Self {
Self { setup_future_usage: None, tos_shown_and_accepted: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsP24 {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPayco {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPayco {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPayco").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPayco {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPayco {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPaynow {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaynow {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPaynow").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPaynow {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPaynow {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPaypal {
/// Controls when the funds will be captured from the customer's account.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod>,
/// [Preferred locale](https://docs.stripe.com/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale>,
/// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID.
/// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// The risk correlation ID for an on-session payment using a saved PayPal payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_correlation_id: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPaypal").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self {
capture_method: None,
preferred_locale: None,
reference: None,
risk_correlation_id: None,
setup_future_usage: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds will be captured from the customer's account.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// [Preferred locale](https://docs.stripe.com/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
CsMinusCz,
DaMinusDk,
DeMinusAt,
DeMinusDe,
DeMinusLu,
ElMinusGr,
EnMinusGb,
EnMinusUs,
EsMinusEs,
FiMinusFi,
FrMinusBe,
FrMinusFr,
FrMinusLu,
HuMinusHu,
ItMinusIt,
NlMinusBe,
NlMinusNl,
PlMinusPl,
PtMinusPt,
SkMinusSk,
SvMinusSe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*;
match self {
CsMinusCz => "cs-CZ",
DaMinusDk => "da-DK",
DeMinusAt => "de-AT",
DeMinusDe => "de-DE",
DeMinusLu => "de-LU",
ElMinusGr => "el-GR",
EnMinusGb => "en-GB",
EnMinusUs => "en-US",
EsMinusEs => "es-ES",
FiMinusFi => "fi-FI",
FrMinusBe => "fr-BE",
FrMinusFr => "fr-FR",
FrMinusLu => "fr-LU",
HuMinusHu => "hu-HU",
ItMinusIt => "it-IT",
NlMinusBe => "nl-BE",
NlMinusNl => "nl-NL",
PlMinusPl => "pl-PL",
PtMinusPt => "pt-PT",
SkMinusSk => "sk-SK",
SvMinusSe => "sv-SE",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*;
match s {
"cs-CZ" => Ok(CsMinusCz),
"da-DK" => Ok(DaMinusDk),
"de-AT" => Ok(DeMinusAt),
"de-DE" => Ok(DeMinusDe),
"de-LU" => Ok(DeMinusLu),
"el-GR" => Ok(ElMinusGr),
"en-GB" => Ok(EnMinusGb),
"en-US" => Ok(EnMinusUs),
"es-ES" => Ok(EsMinusEs),
"fi-FI" => Ok(FiMinusFi),
"fr-BE" => Ok(FrMinusBe),
"fr-FR" => Ok(FrMinusFr),
"fr-LU" => Ok(FrMinusLu),
"hu-HU" => Ok(HuMinusHu),
"it-IT" => Ok(ItMinusIt),
"nl-BE" => Ok(NlMinusBe),
"nl-NL" => Ok(NlMinusNl),
"pl-PL" => Ok(PlMinusPl),
"pt-PT" => Ok(PtMinusPt),
"sk-SK" => Ok(SkMinusSk),
"sv-SE" => Ok(SvMinusSe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payto` PaymentMethod, this sub-hash contains details about the PayTo payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPayto {
/// Additional fields for Mandate creation.
/// Only `purpose` field is configurable for PayTo PaymentIntent with `setup_future_usage=none`.
/// Other fields are only applicable to PayTo PaymentIntent with `setup_future_usage=off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPayto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPayto").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPayto {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPayto {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation.
/// Only `purpose` field is configurable for PayTo PaymentIntent with `setup_future_usage=none`.
/// Other fields are only applicable to PayTo PaymentIntent with `setup_future_usage=off_session`.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
/// Amount that will be collected. It is required when `amount_type` is `fixed`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// The type of amount that will be collected.
/// The amount charged must be exact or up to the value of `amount` param for `fixed` or `maximum` type respectively.
/// Defaults to `maximum`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType>,
/// Date, in YYYY-MM-DD format, after which payments will not be collected. Defaults to no end date.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<String>,
/// The periodicity at which payments will be collected. Defaults to `adhoc`.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_schedule:
Option<UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule>,
/// The number of payments that will be made during a payment period.
/// Defaults to 1 except for when `payment_schedule` is `adhoc`.
/// In that case, it defaults to no limit.
#[serde(skip_serializing_if = "Option::is_none")]
pub payments_per_period: Option<i64>,
/// The purpose for which payments are made. Has a default value based on your merchant category code.
#[serde(skip_serializing_if = "Option::is_none")]
pub purpose: Option<UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
pub fn new() -> Self {
Self {
amount: None,
amount_type: None,
end_date: None,
payment_schedule: None,
payments_per_period: None,
purpose: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// The type of amount that will be collected.
/// The amount charged must be exact or up to the value of `amount` param for `fixed` or `maximum` type respectively.
/// Defaults to `maximum`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The periodicity at which payments will be collected. Defaults to `adhoc`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
Adhoc,
Annual,
Daily,
Fortnightly,
Monthly,
Quarterly,
SemiAnnual,
Weekly,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule::*;
match self {
Adhoc => "adhoc",
Annual => "annual",
Daily => "daily",
Fortnightly => "fortnightly",
Monthly => "monthly",
Quarterly => "quarterly",
SemiAnnual => "semi_annual",
Weekly => "weekly",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule::*;
match s {
"adhoc" => Ok(Adhoc),
"annual" => Ok(Annual),
"daily" => Ok(Daily),
"fortnightly" => Ok(Fortnightly),
"monthly" => Ok(Monthly),
"quarterly" => Ok(Quarterly),
"semi_annual" => Ok(SemiAnnual),
"weekly" => Ok(Weekly),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The purpose for which payments are made. Has a default value based on your merchant category code.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
DependantSupport,
Government,
Loan,
Mortgage,
Other,
Pension,
Personal,
Retail,
Salary,
Tax,
Utility,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose::*;
match self {
DependantSupport => "dependant_support",
Government => "government",
Loan => "loan",
Mortgage => "mortgage",
Other => "other",
Pension => "pension",
Personal => "personal",
Retail => "retail",
Salary => "salary",
Tax => "tax",
Utility => "utility",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose::*;
match s {
"dependant_support" => Ok(DependantSupport),
"government" => Ok(Government),
"loan" => Ok(Loan),
"mortgage" => Ok(Mortgage),
"other" => Ok(Other),
"pension" => Ok(Pension),
"personal" => Ok(Personal),
"retail" => Ok(Retail),
"salary" => Ok(Salary),
"tax" => Ok(Tax),
"utility" => Ok(Utility),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPix {
/// Determines if the amount includes the IOF tax. Defaults to `never`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_includes_iof: Option<UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof>,
/// The number of seconds (between 10 and 1209600) after which Pix payment will expire.
/// Defaults to 86400 seconds.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_seconds: Option<i64>,
/// The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future).
/// Defaults to 1 day in the future.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<stripe_types::Timestamp>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPix {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPix").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPix {
pub fn new() -> Self {
Self {
amount_includes_iof: None,
expires_after_seconds: None,
expires_at: None,
setup_future_usage: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPix {
fn default() -> Self {
Self::new()
}
}
/// Determines if the amount includes the IOF tax. Defaults to `never`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
Always,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof::*;
match self {
Always => "always",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof::*;
match s {
"always" => Ok(Always),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsPromptpay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPromptpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsPromptpay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsPromptpay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsPromptpay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsRevolutPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsRevolutPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsRevolutPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsRevolutPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsRevolutPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsSamsungPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSamsungPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsSamsungPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsSamsungPay {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsSamsungPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `satispay` PaymentMethod, this sub-hash contains details about the Satispay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsSatispay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSatispay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsSatispay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsSatispay {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsSatispay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsSepaDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSepaDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsSepaDebit").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsSepaDebit {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None, target_date: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsSepaDebit {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
/// Prefix used to generate the Mandate reference.
/// Must be at most 12 characters long.
/// Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'.
/// Cannot begin with 'STRIPE'.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference_prefix: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
pub fn new() -> Self {
Self { reference_prefix: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsSofort {
/// Language shown to the payer on redirect.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_language: Option<UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsSofort").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsSofort {
pub fn new() -> Self {
Self { preferred_language: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsSofort {
fn default() -> Self {
Self::new()
}
}
/// Language shown to the payer on redirect.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
De,
En,
Es,
Fr,
It,
Nl,
Pl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*;
match self {
De => "de",
En => "en",
Es => "es",
Fr => "fr",
It => "it",
Nl => "nl",
Pl => "pl",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*;
match s {
"de" => Ok(De),
"en" => Ok(En),
"es" => Ok(Es),
"fr" => Ok(Fr),
"it" => Ok(It),
"nl" => Ok(Nl),
"pl" => Ok(Pl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsSofortPreferredLanguage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsSofortSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsSwish {
/// A reference for this payment to be displayed in the Swish app.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSwish {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsSwish").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsSwish {
pub fn new() -> Self {
Self { reference: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsSwish {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `twint` PaymentMethod, this sub-hash contains details about the TWINT payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsTwint {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsTwint {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsTwint").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsTwint {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsTwint {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `upi` PaymentIntent, this sub-hash contains details about the UPI payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUpi {
/// Configuration options for setting up an eMandate
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUpi {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsUpi").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUpi {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUpi {
fn default() -> Self {
Self::new()
}
}
/// Configuration options for setting up an eMandate
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
/// Amount to be charged for future payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType>,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
pub fn new() -> Self {
Self { amount: None, amount_type: None, description: None, end_date: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccount {
/// Additional fields for Financial Connections Session creation
#[serde(skip_serializing_if = "Option::is_none")]
pub financial_connections:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections>,
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions>,
/// Additional fields for network related functions
#[serde(skip_serializing_if = "Option::is_none")]
pub networks: Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
/// The purpose of the transaction.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_purpose:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose>,
/// Bank account verification method. The default value is `automatic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsUsBankAccount")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccount {
pub fn new() -> Self {
Self {
financial_connections: None,
mandate_options: None,
networks: None,
setup_future_usage: None,
target_date: None,
transaction_purpose: None,
verification_method: None,
}
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUsBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Financial Connections Session creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
/// Provide filters for the linked accounts that the customer can select for the payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub filters:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters>,
/// The list of permissions to request.
/// If this parameter is passed, the `payment_method` permission must be included.
/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<
Vec<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions>,
>,
/// List of data features that you would like to retrieve upon account creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prefetch: Option<
Vec<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch>,
>,
/// For webview integrations only.
/// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
#[serde(skip_serializing_if = "Option::is_none")]
pub return_url: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
pub fn new() -> Self {
Self { filters: None, permissions: None, prefetch: None, return_url: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
fn default() -> Self {
Self::new()
}
}
/// Provide filters for the linked accounts that the customer can select for the payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
/// The account subcategories to use to filter for selectable accounts.
/// Valid subcategories are `checking` and `savings`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_subcategories: Option<Vec<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters",
)
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
pub fn new() -> Self {
Self { account_subcategories: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
fn default() -> Self {
Self::new()
}
}
/// The account subcategories to use to filter for selectable accounts.
/// Valid subcategories are `checking` and `savings`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories
{
Checking,
Savings,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories::*;
match self {
Checking => "checking",
Savings => "savings",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories::*;
match s {
"checking" => Ok(Checking),
"savings" => Ok(Savings),
v => { tracing::warn!("Unknown value '{}' for enum '{}'", v, "UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories"); Ok(Unknown(v.to_owned())) }
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories)).finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The list of permissions to request.
/// If this parameter is passed, the `payment_method` permission must be included.
/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
Balances,
Ownership,
PaymentMethod,
Transactions,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*;
match self {
Balances => "balances",
Ownership => "ownership",
PaymentMethod => "payment_method",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*;
match s {
"balances" => Ok(Balances),
"ownership" => Ok(Ownership),
"payment_method" => Ok(PaymentMethod),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// List of data features that you would like to retrieve upon account creation.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
Balances,
Ownership,
Transactions,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*;
match self {
Balances => "balances",
Ownership => "ownership",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*;
match s {
"balances" => Ok(Balances),
"ownership" => Ok(Ownership),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
/// The method used to collect offline mandate customer acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_method:
Option<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
pub fn new() -> Self {
Self { collection_method: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// The method used to collect offline mandate customer acceptance.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod {
Paper,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*;
match self {
Paper => "paper",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*;
match s {
"paper" => Ok(Paper),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Additional fields for network related functions
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
/// Triggers validations to run across the selected networks
#[serde(skip_serializing_if = "Option::is_none")]
pub requested:
Option<Vec<UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks")
.finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
pub fn new() -> Self {
Self { requested: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
fn default() -> Self {
Self::new()
}
}
/// Triggers validations to run across the selected networks
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
Ach,
UsDomesticWire,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*;
match self {
Ach => "ach",
UsDomesticWire => "us_domestic_wire",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*;
match s {
"ach" => Ok(Ach),
"us_domestic_wire" => Ok(UsDomesticWire),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The purpose of the transaction.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
Goods,
Other,
Services,
Unspecified,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match self {
Goods => "goods",
Other => "other",
Services => "services",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match s {
"goods" => Ok(Goods),
"other" => Ok(Other),
"services" => Ok(Services),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Bank account verification method. The default value is `automatic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
Automatic,
Instant,
Microdeposits,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsWechatPay {
/// The app ID registered with WeChat Pay. Only required when client is ios or android.
#[serde(skip_serializing_if = "Option::is_none")]
pub app_id: Option<String>,
/// The client type that the end customer will pay from
#[serde(skip_serializing_if = "Option::is_none")]
pub client: Option<UpdatePaymentIntentPaymentMethodOptionsWechatPayClient>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsWechatPay").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsWechatPay {
pub fn new() -> Self {
Self { app_id: None, client: None, setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsWechatPay {
fn default() -> Self {
Self::new()
}
}
/// The client type that the end customer will pay from
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
Android,
Ios,
Web,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::*;
match self {
Android => "android",
Ios => "ios",
Web => "web",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsWechatPayClient::*;
match s {
"android" => Ok(Android),
"ios" => Ok(Ios),
"web" => Ok(Web),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsWechatPayClient"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsWechatPayClient))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsWechatPayClient {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for UpdatePaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentPaymentMethodOptionsZip {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsZip {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentPaymentMethodOptionsZip").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentPaymentMethodOptionsZip {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for UpdatePaymentIntentPaymentMethodOptionsZip {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
pub fn as_str(&self) -> &str {
use UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for UpdatePaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Shipping information for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentShipping {
/// Shipping address.
pub address: UpdatePaymentIntentShippingAddress,
/// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub carrier: Option<String>,
/// Recipient name.
pub name: String,
/// Recipient phone (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
/// The tracking number for a physical product, obtained from the delivery service.
/// If multiple tracking numbers were generated for this purchase, please separate them with commas.
#[serde(skip_serializing_if = "Option::is_none")]
pub tracking_number: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentShipping {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentShipping").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentShipping {
pub fn new(
address: impl Into<UpdatePaymentIntentShippingAddress>,
name: impl Into<String>,
) -> Self {
Self {
address: address.into(),
carrier: None,
name: name.into(),
phone: None,
tracking_number: None,
}
}
}
/// Shipping address.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentShippingAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Address line 1, such as the street, PO Box, or company name.
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2, such as the apartment, suite, unit, or building.
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentShippingAddress {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentShippingAddress").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentShippingAddress {
pub fn new() -> Self {
Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
}
}
impl Default for UpdatePaymentIntentShippingAddress {
fn default() -> Self {
Self::new()
}
}
/// Use this parameter to automatically create a Transfer when the payment succeeds.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntentTransferData {
/// The amount that will be transferred automatically when a charge succeeds.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntentTransferData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntentTransferData").finish_non_exhaustive()
}
}
impl UpdatePaymentIntentTransferData {
pub fn new() -> Self {
Self { amount: None }
}
}
impl Default for UpdatePaymentIntentTransferData {
fn default() -> Self {
Self::new()
}
}
/// Updates properties on a PaymentIntent object without confirming.
///
/// Depending on which properties you update, you might need to confirm the
/// PaymentIntent again. For example, updating the `payment_method`
/// always requires you to confirm the PaymentIntent again. If you prefer to
/// update and confirm at the same time, we recommend updating properties through
/// the [confirm API](https://stripe.com/docs/api/payment_intents/confirm) instead.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct UpdatePaymentIntent {
inner: UpdatePaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for UpdatePaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("UpdatePaymentIntent").finish_non_exhaustive()
}
}
impl UpdatePaymentIntent {
/// Construct a new `UpdatePaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: UpdatePaymentIntentBuilder::new() }
}
/// Amount intended to be collected by this PaymentIntent.
/// A positive integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency).
/// The minimum amount is $0.50 US or [equivalent in charge currency](https://docs.stripe.com/currencies#minimum-and-maximum-charge-amounts).
/// The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
pub fn amount(mut self, amount: impl Into<i64>) -> Self {
self.inner.amount = Some(amount.into());
self
}
/// Provides industry-specific information about the amount.
pub fn amount_details(
mut self,
amount_details: impl Into<UpdatePaymentIntentAmountDetails>,
) -> Self {
self.inner.amount_details = Some(amount_details.into());
self
}
/// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account.
/// The amount of the application fee collected will be capped at the total amount captured.
/// For more information, see the PaymentIntents [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn application_fee_amount(mut self, application_fee_amount: impl Into<i64>) -> Self {
self.inner.application_fee_amount = Some(application_fee_amount.into());
self
}
/// Controls when the funds will be captured from the customer's account.
pub fn capture_method(
mut self,
capture_method: impl Into<stripe_shared::PaymentIntentCaptureMethod>,
) -> Self {
self.inner.capture_method = Some(capture_method.into());
self
}
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub fn currency(mut self, currency: impl Into<stripe_types::Currency>) -> Self {
self.inner.currency = Some(currency.into());
self
}
/// ID of the Customer this PaymentIntent belongs to, if one exists.
///
/// Payment methods attached to other Customers cannot be used with this PaymentIntent.
///
/// If [setup_future_usage](https://api.stripe.com#payment_intent_object-setup_future_usage) is set and this PaymentIntent's payment method is not `card_present`, then the payment method attaches to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete.
/// If the payment method is `card_present` and isn't a digital wallet, then a [generated_card](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card is created and attached to the Customer instead.
pub fn customer(mut self, customer: impl Into<String>) -> Self {
self.inner.customer = Some(customer.into());
self
}
/// ID of the Account representing the customer that this PaymentIntent belongs to, if one exists.
///
/// Payment methods attached to other Accounts cannot be used with this PaymentIntent.
///
/// If [setup_future_usage](https://api.stripe.com#payment_intent_object-setup_future_usage) is set and this PaymentIntent's payment method is not `card_present`, then the payment method attaches to the Account after the PaymentIntent has been confirmed and any required actions from the user are complete.
/// If the payment method is `card_present` and isn't a digital wallet, then a [generated_card](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card is created and attached to the Account instead.
pub fn customer_account(mut self, customer_account: impl Into<String>) -> Self {
self.inner.customer_account = Some(customer_account.into());
self
}
/// An arbitrary string attached to the object. Often useful for displaying to users.
pub fn description(mut self, description: impl Into<String>) -> Self {
self.inner.description = Some(description.into());
self
}
/// The list of payment method types to exclude from use with this payment.
pub fn excluded_payment_method_types(
mut self,
excluded_payment_method_types: impl Into<
Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>,
>,
) -> Self {
self.inner.excluded_payment_method_types = Some(excluded_payment_method_types.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// Automations to be run during the PaymentIntent lifecycle
pub fn hooks(mut self, hooks: impl Into<AsyncWorkflowsParam>) -> Self {
self.inner.hooks = Some(hooks.into());
self
}
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
/// Provides industry-specific information about the charge.
pub fn payment_details(
mut self,
payment_details: impl Into<UpdatePaymentIntentPaymentDetails>,
) -> Self {
self.inner.payment_details = Some(payment_details.into());
self
}
/// ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://docs.stripe.com/payments/payment-methods/transitioning#compatibility) object) to attach to this PaymentIntent.
/// To unset this field to null, pass in an empty string.
pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
self.inner.payment_method = Some(payment_method.into());
self
}
/// The ID of the [payment method configuration](https://docs.stripe.com/api/payment_method_configurations) to use with this PaymentIntent.
pub fn payment_method_configuration(
mut self,
payment_method_configuration: impl Into<String>,
) -> Self {
self.inner.payment_method_configuration = Some(payment_method_configuration.into());
self
}
/// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear
/// in the [payment_method](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-payment_method).
/// property on the PaymentIntent.
pub fn payment_method_data(
mut self,
payment_method_data: impl Into<UpdatePaymentIntentPaymentMethodData>,
) -> Self {
self.inner.payment_method_data = Some(payment_method_data.into());
self
}
/// Payment-method-specific configuration for this PaymentIntent.
pub fn payment_method_options(
mut self,
payment_method_options: impl Into<UpdatePaymentIntentPaymentMethodOptions>,
) -> Self {
self.inner.payment_method_options = Some(payment_method_options.into());
self
}
/// The list of payment method types (for example, card) that this PaymentIntent can use.
/// Use `automatic_payment_methods` to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods).
/// A list of valid payment method types can be found [here](https://docs.stripe.com/api/payment_methods/object#payment_method_object-type).
pub fn payment_method_types(mut self, payment_method_types: impl Into<Vec<String>>) -> Self {
self.inner.payment_method_types = Some(payment_method_types.into());
self
}
/// Email address that the receipt for the resulting payment will be sent to.
/// If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
pub fn receipt_email(mut self, receipt_email: impl Into<String>) -> Self {
self.inner.receipt_email = Some(receipt_email.into());
self
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
pub fn setup_future_usage(
mut self,
setup_future_usage: impl Into<stripe_shared::PaymentIntentSetupFutureUsage>,
) -> Self {
self.inner.setup_future_usage = Some(setup_future_usage.into());
self
}
/// Shipping information for this PaymentIntent.
pub fn shipping(mut self, shipping: impl Into<UpdatePaymentIntentShipping>) -> Self {
self.inner.shipping = Some(shipping.into());
self
}
/// Text that appears on the customer's statement as the statement descriptor for a non-card charge.
/// This value overrides the account's default statement descriptor.
/// For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors).
///
/// Setting this value for a card charge returns an error.
/// For card charges, set the [statement_descriptor_suffix](https://docs.stripe.com/get-started/account/statement-descriptors#dynamic) instead.
pub fn statement_descriptor(mut self, statement_descriptor: impl Into<String>) -> Self {
self.inner.statement_descriptor = Some(statement_descriptor.into());
self
}
/// Provides information about a card charge.
/// Concatenated to the account's [statement descriptor prefix](https://docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer's statement.
pub fn statement_descriptor_suffix(
mut self,
statement_descriptor_suffix: impl Into<String>,
) -> Self {
self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix.into());
self
}
/// Use this parameter to automatically create a Transfer when the payment succeeds.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn transfer_data(
mut self,
transfer_data: impl Into<UpdatePaymentIntentTransferData>,
) -> Self {
self.inner.transfer_data = Some(transfer_data.into());
self
}
/// A string that identifies the resulting payment as part of a group.
/// You can only provide `transfer_group` if it hasn't been set.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn transfer_group(mut self, transfer_group: impl Into<String>) -> Self {
self.inner.transfer_group = Some(transfer_group.into());
self
}
}
impl UpdatePaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for UpdatePaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}"))
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ApplyCustomerBalancePaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
currency: Option<stripe_types::Currency>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ApplyCustomerBalancePaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ApplyCustomerBalancePaymentIntentBuilder").finish_non_exhaustive()
}
}
impl ApplyCustomerBalancePaymentIntentBuilder {
fn new() -> Self {
Self { amount: None, currency: None, expand: None }
}
}
/// Manually reconcile the remaining amount for a `customer_balance` PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ApplyCustomerBalancePaymentIntent {
inner: ApplyCustomerBalancePaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ApplyCustomerBalancePaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ApplyCustomerBalancePaymentIntent").finish_non_exhaustive()
}
}
impl ApplyCustomerBalancePaymentIntent {
/// Construct a new `ApplyCustomerBalancePaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: ApplyCustomerBalancePaymentIntentBuilder::new() }
}
/// Amount that you intend to apply to this PaymentIntent from the customer’s cash balance.
/// If the PaymentIntent was created by an Invoice, the full amount of the PaymentIntent is applied regardless of this parameter.
///
/// A positive integer representing how much to charge in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal) (for example, 100 cents to charge 1 USD or 100 to charge 100 JPY, a zero-decimal currency).
/// The maximum amount is the amount of the PaymentIntent.
///
/// When you omit the amount, it defaults to the remaining amount requested on the PaymentIntent.
pub fn amount(mut self, amount: impl Into<i64>) -> Self {
self.inner.amount = Some(amount.into());
self
}
/// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
/// Must be a [supported currency](https://stripe.com/docs/currencies).
pub fn currency(mut self, currency: impl Into<stripe_types::Currency>) -> Self {
self.inner.currency = Some(currency.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl ApplyCustomerBalancePaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for ApplyCustomerBalancePaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(
StripeMethod::Post,
format!("/payment_intents/{intent}/apply_customer_balance"),
)
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CancelPaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
cancellation_reason: Option<CancelPaymentIntentCancellationReason>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CancelPaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CancelPaymentIntentBuilder").finish_non_exhaustive()
}
}
impl CancelPaymentIntentBuilder {
fn new() -> Self {
Self { cancellation_reason: None, expand: None }
}
}
/// Reason for canceling this PaymentIntent.
/// Possible values are: `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CancelPaymentIntentCancellationReason {
Abandoned,
Duplicate,
Fraudulent,
RequestedByCustomer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CancelPaymentIntentCancellationReason {
pub fn as_str(&self) -> &str {
use CancelPaymentIntentCancellationReason::*;
match self {
Abandoned => "abandoned",
Duplicate => "duplicate",
Fraudulent => "fraudulent",
RequestedByCustomer => "requested_by_customer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for CancelPaymentIntentCancellationReason {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CancelPaymentIntentCancellationReason::*;
match s {
"abandoned" => Ok(Abandoned),
"duplicate" => Ok(Duplicate),
"fraudulent" => Ok(Fraudulent),
"requested_by_customer" => Ok(RequestedByCustomer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CancelPaymentIntentCancellationReason"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for CancelPaymentIntentCancellationReason {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for CancelPaymentIntentCancellationReason {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CancelPaymentIntentCancellationReason {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(CancelPaymentIntentCancellationReason)).finish_non_exhaustive()
}
}
impl serde::Serialize for CancelPaymentIntentCancellationReason {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for CancelPaymentIntentCancellationReason {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// You can cancel a PaymentIntent object when it’s in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_action` or, [in rare cases](https://stripe.com/docs/payments/intents), `processing`.
///
///
/// After it’s canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error.
/// For PaymentIntents with a `status` of `requires_capture`, the remaining `amount_capturable` is automatically refunded.
///
///
/// You can directly cancel the PaymentIntent for a Checkout Session only when the PaymentIntent has a status of `requires_capture`.
/// Otherwise, you must [expire the Checkout Session](https://stripe.com/docs/api/checkout/sessions/expire).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CancelPaymentIntent {
inner: CancelPaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CancelPaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CancelPaymentIntent").finish_non_exhaustive()
}
}
impl CancelPaymentIntent {
/// Construct a new `CancelPaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: CancelPaymentIntentBuilder::new() }
}
/// Reason for canceling this PaymentIntent.
/// Possible values are: `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned`.
pub fn cancellation_reason(
mut self,
cancellation_reason: impl Into<CancelPaymentIntentCancellationReason>,
) -> Self {
self.inner.cancellation_reason = Some(cancellation_reason.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl CancelPaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for CancelPaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}/cancel"))
.form(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct CapturePaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
amount_details: Option<CapturePaymentIntentAmountDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
amount_to_capture: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
application_fee_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
final_capture: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
hooks: Option<AsyncWorkflowsParam>,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_details: Option<CapturePaymentIntentPaymentDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor_suffix: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
transfer_data: Option<CapturePaymentIntentTransferData>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentBuilder").finish_non_exhaustive()
}
}
impl CapturePaymentIntentBuilder {
fn new() -> Self {
Self {
amount_details: None,
amount_to_capture: None,
application_fee_amount: None,
expand: None,
final_capture: None,
hooks: None,
metadata: None,
payment_details: None,
statement_descriptor: None,
statement_descriptor_suffix: None,
transfer_data: None,
}
}
}
/// Provides industry-specific information about the amount.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentAmountDetails {
/// The total discount applied on the transaction represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[line_items][#][discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Set to `false` to return arithmetic validation errors in the response without failing the request.
/// Use this when you want the operation to proceed regardless of arithmetic errors in the line item data.
///
/// Omit or set to `true` to immediately return a 400 error when arithmetic validation fails.
/// Use this for strict validation that prevents processing with line item data that has arithmetic inconsistencies.
///
/// For card payments, Stripe doesn't send line item data to card networks if there's an arithmetic validation error.
#[serde(skip_serializing_if = "Option::is_none")]
pub enforce_arithmetic_validation: Option<bool>,
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub line_items: Option<Vec<CapturePaymentIntentAmountDetailsLineItems>>,
/// Contains information about the shipping portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<AmountDetailsShippingParam>,
/// Contains information about the tax portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsTaxParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentAmountDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentAmountDetails").finish_non_exhaustive()
}
}
impl CapturePaymentIntentAmountDetails {
pub fn new() -> Self {
Self {
discount_amount: None,
enforce_arithmetic_validation: None,
line_items: None,
shipping: None,
tax: None,
}
}
}
impl Default for CapturePaymentIntentAmountDetails {
fn default() -> Self {
Self::new()
}
}
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentAmountDetailsLineItems {
/// The discount applied on this line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Payment method-specific information for line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_options:
Option<CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptions>,
/// The product code of the line item, such as an SKU.
/// Required for L3 rates.
/// At most 12 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_code: Option<String>,
/// The product name of the line item. Required for L3 rates. At most 1024 characters long.
///
/// For Cards, this field is truncated to 26 alphanumeric characters before being sent to the card networks.
/// For PayPal, this field is truncated to 127 characters.
pub product_name: String,
/// The quantity of items. Required for L3 rates. An integer greater than 0.
pub quantity: u64,
/// Contains information about the tax on the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsLineItemTaxParam>,
/// The unit cost of the line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L3 rates.
/// An integer greater than or equal to 0.
pub unit_cost: i64,
/// A unit of measure for the line item, such as gallons, feet, meters, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_of_measure: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentAmountDetailsLineItems {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentAmountDetailsLineItems").finish_non_exhaustive()
}
}
impl CapturePaymentIntentAmountDetailsLineItems {
pub fn new(
product_name: impl Into<String>,
quantity: impl Into<u64>,
unit_cost: impl Into<i64>,
) -> Self {
Self {
discount_amount: None,
payment_method_options: None,
product_code: None,
product_name: product_name.into(),
quantity: quantity.into(),
tax: None,
unit_cost: unit_cost.into(),
unit_of_measure: None,
}
}
}
/// Payment method-specific information for line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard>,
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present:
Option<CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent>,
/// This sub-hash contains line item details that are specific to the `klarna` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam>,
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptions")
.finish_non_exhaustive()
}
}
impl CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
pub fn new() -> Self {
Self { card: None, card_present: None, klarna: None, paypal: None }
}
}
impl Default for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard")
.finish_non_exhaustive()
}
}
impl CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent")
.finish_non_exhaustive()
}
}
impl CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
/// Type of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub category:
Option<CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory>,
/// Description of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The Stripe account ID of the connected account that sells the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub sold_by: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal")
.finish_non_exhaustive()
}
}
impl CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self { category: None, description: None, sold_by: None }
}
}
impl Default for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Type of the line item.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
DigitalGoods,
Donation,
PhysicalGoods,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
pub fn as_str(&self) -> &str {
use CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match self {
DigitalGoods => "digital_goods",
Donation => "donation",
PhysicalGoods => "physical_goods",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match s {
"digital_goods" => Ok(DigitalGoods),
"donation" => Ok(Donation),
"physical_goods" => Ok(PhysicalGoods),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for CapturePaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Provides industry-specific information about the charge.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentPaymentDetails {
/// A unique value to identify the customer. This field is available only for card payments.
///
/// This field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_reference: Option<String>,
/// A unique value assigned by the business to identify the transaction. Required for L2 and L3 rates.
///
/// For Cards, this field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
/// For Klarna, this field is truncated to 255 characters and is visible to customers when they view the order in the Klarna app.
#[serde(skip_serializing_if = "Option::is_none")]
pub order_reference: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentPaymentDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentPaymentDetails").finish_non_exhaustive()
}
}
impl CapturePaymentIntentPaymentDetails {
pub fn new() -> Self {
Self { customer_reference: None, order_reference: None }
}
}
impl Default for CapturePaymentIntentPaymentDetails {
fn default() -> Self {
Self::new()
}
}
/// The parameters that you can use to automatically create a transfer after the payment
/// is captured.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntentTransferData {
/// The amount that will be transferred automatically when a charge succeeds.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntentTransferData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntentTransferData").finish_non_exhaustive()
}
}
impl CapturePaymentIntentTransferData {
pub fn new() -> Self {
Self { amount: None }
}
}
impl Default for CapturePaymentIntentTransferData {
fn default() -> Self {
Self::new()
}
}
/// Capture the funds of an existing uncaptured PaymentIntent when its status is `requires_capture`.
///
/// Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
///
/// Learn more about [separate authorization and capture](https://stripe.com/docs/payments/capture-later).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct CapturePaymentIntent {
inner: CapturePaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for CapturePaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("CapturePaymentIntent").finish_non_exhaustive()
}
}
impl CapturePaymentIntent {
/// Construct a new `CapturePaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: CapturePaymentIntentBuilder::new() }
}
/// Provides industry-specific information about the amount.
pub fn amount_details(
mut self,
amount_details: impl Into<CapturePaymentIntentAmountDetails>,
) -> Self {
self.inner.amount_details = Some(amount_details.into());
self
}
/// The amount to capture from the PaymentIntent, which must be less than or equal to the original amount.
/// Defaults to the full `amount_capturable` if it's not provided.
pub fn amount_to_capture(mut self, amount_to_capture: impl Into<i64>) -> Self {
self.inner.amount_to_capture = Some(amount_to_capture.into());
self
}
/// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account.
/// The amount of the application fee collected will be capped at the total amount captured.
/// For more information, see the PaymentIntents [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn application_fee_amount(mut self, application_fee_amount: impl Into<i64>) -> Self {
self.inner.application_fee_amount = Some(application_fee_amount.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// Defaults to `true`.
/// When capturing a PaymentIntent, setting `final_capture` to `false` notifies Stripe to not release the remaining uncaptured funds to make sure that they're captured in future requests.
/// You can only use this setting when [multicapture](https://docs.stripe.com/payments/multicapture) is available for PaymentIntents.
pub fn final_capture(mut self, final_capture: impl Into<bool>) -> Self {
self.inner.final_capture = Some(final_capture.into());
self
}
/// Automations to be run during the PaymentIntent lifecycle
pub fn hooks(mut self, hooks: impl Into<AsyncWorkflowsParam>) -> Self {
self.inner.hooks = Some(hooks.into());
self
}
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
/// Provides industry-specific information about the charge.
pub fn payment_details(
mut self,
payment_details: impl Into<CapturePaymentIntentPaymentDetails>,
) -> Self {
self.inner.payment_details = Some(payment_details.into());
self
}
/// Text that appears on the customer's statement as the statement descriptor for a non-card charge.
/// This value overrides the account's default statement descriptor.
/// For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors).
///
/// Setting this value for a card charge returns an error.
/// For card charges, set the [statement_descriptor_suffix](https://docs.stripe.com/get-started/account/statement-descriptors#dynamic) instead.
pub fn statement_descriptor(mut self, statement_descriptor: impl Into<String>) -> Self {
self.inner.statement_descriptor = Some(statement_descriptor.into());
self
}
/// Provides information about a card charge.
/// Concatenated to the account's [statement descriptor prefix](https://docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer's statement.
pub fn statement_descriptor_suffix(
mut self,
statement_descriptor_suffix: impl Into<String>,
) -> Self {
self.inner.statement_descriptor_suffix = Some(statement_descriptor_suffix.into());
self
}
/// The parameters that you can use to automatically create a transfer after the payment
/// is captured.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn transfer_data(
mut self,
transfer_data: impl Into<CapturePaymentIntentTransferData>,
) -> Self {
self.inner.transfer_data = Some(transfer_data.into());
self
}
}
impl CapturePaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for CapturePaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}/capture"))
.form(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct ConfirmPaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
amount_details: Option<ConfirmPaymentIntentAmountDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
capture_method: Option<stripe_shared::PaymentIntentCaptureMethod>,
#[serde(skip_serializing_if = "Option::is_none")]
confirmation_token: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
error_on_requires_action: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
excluded_payment_method_types:
Option<Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
hooks: Option<AsyncWorkflowsParam>,
#[serde(skip_serializing_if = "Option::is_none")]
mandate: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
mandate_data: Option<ConfirmPaymentIntentMandateData>,
#[serde(skip_serializing_if = "Option::is_none")]
off_session: Option<ConfirmPaymentIntentOffSession>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_details: Option<ConfirmPaymentIntentPaymentDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_data: Option<ConfirmPaymentIntentPaymentMethodData>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_options: Option<ConfirmPaymentIntentPaymentMethodOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_method_types: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
radar_options: Option<ConfirmPaymentIntentRadarOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
receipt_email: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
return_url: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
setup_future_usage: Option<stripe_shared::PaymentIntentSetupFutureUsage>,
#[serde(skip_serializing_if = "Option::is_none")]
shipping: Option<ConfirmPaymentIntentShipping>,
#[serde(skip_serializing_if = "Option::is_none")]
use_stripe_sdk: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentBuilder").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentBuilder {
fn new() -> Self {
Self {
amount_details: None,
capture_method: None,
confirmation_token: None,
error_on_requires_action: None,
excluded_payment_method_types: None,
expand: None,
hooks: None,
mandate: None,
mandate_data: None,
off_session: None,
payment_details: None,
payment_method: None,
payment_method_data: None,
payment_method_options: None,
payment_method_types: None,
radar_options: None,
receipt_email: None,
return_url: None,
setup_future_usage: None,
shipping: None,
use_stripe_sdk: None,
}
}
}
/// Provides industry-specific information about the amount.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentAmountDetails {
/// The total discount applied on the transaction represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[line_items][#][discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Set to `false` to return arithmetic validation errors in the response without failing the request.
/// Use this when you want the operation to proceed regardless of arithmetic errors in the line item data.
///
/// Omit or set to `true` to immediately return a 400 error when arithmetic validation fails.
/// Use this for strict validation that prevents processing with line item data that has arithmetic inconsistencies.
///
/// For card payments, Stripe doesn't send line item data to card networks if there's an arithmetic validation error.
#[serde(skip_serializing_if = "Option::is_none")]
pub enforce_arithmetic_validation: Option<bool>,
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub line_items: Option<Vec<ConfirmPaymentIntentAmountDetailsLineItems>>,
/// Contains information about the shipping portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<AmountDetailsShippingParam>,
/// Contains information about the tax portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsTaxParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentAmountDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentAmountDetails").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentAmountDetails {
pub fn new() -> Self {
Self {
discount_amount: None,
enforce_arithmetic_validation: None,
line_items: None,
shipping: None,
tax: None,
}
}
}
impl Default for ConfirmPaymentIntentAmountDetails {
fn default() -> Self {
Self::new()
}
}
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentAmountDetailsLineItems {
/// The discount applied on this line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Payment method-specific information for line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_options:
Option<ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptions>,
/// The product code of the line item, such as an SKU.
/// Required for L3 rates.
/// At most 12 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_code: Option<String>,
/// The product name of the line item. Required for L3 rates. At most 1024 characters long.
///
/// For Cards, this field is truncated to 26 alphanumeric characters before being sent to the card networks.
/// For PayPal, this field is truncated to 127 characters.
pub product_name: String,
/// The quantity of items. Required for L3 rates. An integer greater than 0.
pub quantity: u64,
/// Contains information about the tax on the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsLineItemTaxParam>,
/// The unit cost of the line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L3 rates.
/// An integer greater than or equal to 0.
pub unit_cost: i64,
/// A unit of measure for the line item, such as gallons, feet, meters, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_of_measure: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentAmountDetailsLineItems {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentAmountDetailsLineItems").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentAmountDetailsLineItems {
pub fn new(
product_name: impl Into<String>,
quantity: impl Into<u64>,
unit_cost: impl Into<i64>,
) -> Self {
Self {
discount_amount: None,
payment_method_options: None,
product_code: None,
product_name: product_name.into(),
quantity: quantity.into(),
tax: None,
unit_cost: unit_cost.into(),
unit_of_measure: None,
}
}
}
/// Payment method-specific information for line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard>,
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present:
Option<ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent>,
/// This sub-hash contains line item details that are specific to the `klarna` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam>,
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
pub fn new() -> Self {
Self { card: None, card_present: None, klarna: None, paypal: None }
}
}
impl Default for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
/// Type of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub category:
Option<ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory>,
/// Description of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The Stripe account ID of the connected account that sells the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub sold_by: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self { category: None, description: None, sold_by: None }
}
}
impl Default for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Type of the line item.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
DigitalGoods,
Donation,
PhysicalGoods,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match self {
DigitalGoods => "digital_goods",
Donation => "donation",
PhysicalGoods => "physical_goods",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match s {
"digital_goods" => Ok(DigitalGoods),
"donation" => Ok(Donation),
"physical_goods" => Ok(PhysicalGoods),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ConfirmPaymentIntentMandateData {
#[serde(untagged)]
SecretKeyParam(ConfirmPaymentIntentSecretKeyParam),
#[serde(untagged)]
ClientKeyParam(ConfirmPaymentIntentClientKeyParam),
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentMandateData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentMandateData").finish_non_exhaustive()
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentSecretKeyParam {
/// This hash contains details about the customer acceptance of the Mandate.
pub customer_acceptance: ConfirmPaymentIntentSecretKeyParamCustomerAcceptance,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentSecretKeyParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentSecretKeyParam").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentSecretKeyParam {
pub fn new(
customer_acceptance: impl Into<ConfirmPaymentIntentSecretKeyParamCustomerAcceptance>,
) -> Self {
Self { customer_acceptance: customer_acceptance.into() }
}
}
/// This hash contains details about the customer acceptance of the Mandate.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentSecretKeyParamCustomerAcceptance {
/// The time at which the customer accepted the Mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub accepted_at: Option<stripe_types::Timestamp>,
/// If this is a Mandate accepted offline, this hash contains details about the offline acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub offline: Option<miniserde::json::Value>,
/// If this is a Mandate accepted online, this hash contains details about the online acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
pub online: Option<OnlineParam>,
/// The type of customer acceptance information included with the Mandate.
/// One of `online` or `offline`.
#[serde(rename = "type")]
pub type_: ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentSecretKeyParamCustomerAcceptance {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentSecretKeyParamCustomerAcceptance")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentSecretKeyParamCustomerAcceptance {
pub fn new(type_: impl Into<ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType>) -> Self {
Self { accepted_at: None, offline: None, online: None, type_: type_.into() }
}
}
/// The type of customer acceptance information included with the Mandate.
/// One of `online` or `offline`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
Offline,
Online,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType::*;
match self {
Offline => "offline",
Online => "online",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType::*;
match s {
"offline" => Ok(Offline),
"online" => Ok(Online),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentSecretKeyParamCustomerAcceptanceType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentClientKeyParam {
/// This hash contains details about the customer acceptance of the Mandate.
pub customer_acceptance: ConfirmPaymentIntentClientKeyParamCustomerAcceptance,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentClientKeyParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentClientKeyParam").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentClientKeyParam {
pub fn new(
customer_acceptance: impl Into<ConfirmPaymentIntentClientKeyParamCustomerAcceptance>,
) -> Self {
Self { customer_acceptance: customer_acceptance.into() }
}
}
/// This hash contains details about the customer acceptance of the Mandate.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentClientKeyParamCustomerAcceptance {
/// If this is a Mandate accepted online, this hash contains details about the online acceptance.
pub online: ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline,
/// The type of customer acceptance information included with the Mandate.
#[serde(rename = "type")]
pub type_: ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentClientKeyParamCustomerAcceptance {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentClientKeyParamCustomerAcceptance")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentClientKeyParamCustomerAcceptance {
pub fn new(
online: impl Into<ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline>,
type_: impl Into<ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType>,
) -> Self {
Self { online: online.into(), type_: type_.into() }
}
}
/// If this is a Mandate accepted online, this hash contains details about the online acceptance.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline {
/// The IP address from which the Mandate was accepted by the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub ip_address: Option<String>,
/// The user agent of the browser from which the Mandate was accepted by the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub user_agent: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline {
pub fn new() -> Self {
Self { ip_address: None, user_agent: None }
}
}
impl Default for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceOnline {
fn default() -> Self {
Self::new()
}
}
/// The type of customer acceptance information included with the Mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
Online,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType::*;
match self {
Online => "online",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType::*;
match s {
"online" => Ok(Online),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentClientKeyParamCustomerAcceptanceType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Set to `true` to indicate that the customer isn't in your checkout flow during this payment attempt and can't authenticate.
/// Use this parameter in scenarios where you collect card details and [charge them later](https://docs.stripe.com/payments/cards/charging-saved-cards).
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ConfirmPaymentIntentOffSession {
OneOff,
Recurring,
#[serde(untagged)]
Bool(bool),
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentOffSession {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentOffSession").finish_non_exhaustive()
}
}
/// Provides industry-specific information about the charge.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentDetails {
/// A unique value to identify the customer. This field is available only for card payments.
///
/// This field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_reference: Option<String>,
/// A unique value assigned by the business to identify the transaction. Required for L2 and L3 rates.
///
/// For Cards, this field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
/// For Klarna, this field is truncated to 255 characters and is visible to customers when they view the order in the Klarna app.
#[serde(skip_serializing_if = "Option::is_none")]
pub order_reference: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentDetails").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentDetails {
pub fn new() -> Self {
Self { customer_reference: None, order_reference: None }
}
}
impl Default for ConfirmPaymentIntentPaymentDetails {
fn default() -> Self {
Self::new()
}
}
/// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear
/// in the [payment_method](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-payment_method).
/// property on the PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodData {
/// If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<PaymentMethodParam>,
/// If this is an `affirm` PaymentMethod, this hash contains details about the Affirm payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub affirm: Option<miniserde::json::Value>,
/// If this is an `AfterpayClearpay` PaymentMethod, this hash contains details about the AfterpayClearpay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub afterpay_clearpay: Option<miniserde::json::Value>,
/// If this is an `Alipay` PaymentMethod, this hash contains details about the Alipay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub alipay: Option<miniserde::json::Value>,
/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
/// The field defaults to `unspecified`.
#[serde(skip_serializing_if = "Option::is_none")]
pub allow_redisplay: Option<ConfirmPaymentIntentPaymentMethodDataAllowRedisplay>,
/// If this is a Alma PaymentMethod, this hash contains details about the Alma payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub alma: Option<miniserde::json::Value>,
/// If this is a AmazonPay PaymentMethod, this hash contains details about the AmazonPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub amazon_pay: Option<miniserde::json::Value>,
/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<ConfirmPaymentIntentPaymentMethodDataAuBecsDebit>,
/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<ConfirmPaymentIntentPaymentMethodDataBacsDebit>,
/// If this is a `bancontact` PaymentMethod, this hash contains details about the Bancontact payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub bancontact: Option<miniserde::json::Value>,
/// If this is a `billie` PaymentMethod, this hash contains details about the Billie payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub billie: Option<miniserde::json::Value>,
/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
#[serde(skip_serializing_if = "Option::is_none")]
pub billing_details: Option<ConfirmPaymentIntentPaymentMethodDataBillingDetails>,
/// If this is a `blik` PaymentMethod, this hash contains details about the BLIK payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub blik: Option<miniserde::json::Value>,
/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<ConfirmPaymentIntentPaymentMethodDataBoleto>,
/// If this is a `cashapp` PaymentMethod, this hash contains details about the Cash App Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub cashapp: Option<miniserde::json::Value>,
/// If this is a Crypto PaymentMethod, this hash contains details about the Crypto payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub crypto: Option<miniserde::json::Value>,
/// If this is a `customer_balance` PaymentMethod, this hash contains details about the CustomerBalance payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub customer_balance: Option<miniserde::json::Value>,
/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps: Option<ConfirmPaymentIntentPaymentMethodDataEps>,
/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<ConfirmPaymentIntentPaymentMethodDataFpx>,
/// If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub giropay: Option<miniserde::json::Value>,
/// If this is a `grabpay` PaymentMethod, this hash contains details about the GrabPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub grabpay: Option<miniserde::json::Value>,
/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<ConfirmPaymentIntentPaymentMethodDataIdeal>,
/// If this is an `interac_present` PaymentMethod, this hash contains details about the Interac Present payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub interac_present: Option<miniserde::json::Value>,
/// If this is a `kakao_pay` PaymentMethod, this hash contains details about the Kakao Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub kakao_pay: Option<miniserde::json::Value>,
/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<ConfirmPaymentIntentPaymentMethodDataKlarna>,
/// If this is a `konbini` PaymentMethod, this hash contains details about the Konbini payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub konbini: Option<miniserde::json::Value>,
/// If this is a `kr_card` PaymentMethod, this hash contains details about the Korean Card payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub kr_card: Option<miniserde::json::Value>,
/// If this is an `Link` PaymentMethod, this hash contains details about the Link payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub link: Option<miniserde::json::Value>,
/// If this is a MB WAY PaymentMethod, this hash contains details about the MB WAY payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub mb_way: Option<miniserde::json::Value>,
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
#[serde(skip_serializing_if = "Option::is_none")]
pub metadata: Option<std::collections::HashMap<String, String>>,
/// If this is a `mobilepay` PaymentMethod, this hash contains details about the MobilePay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub mobilepay: Option<miniserde::json::Value>,
/// If this is a `multibanco` PaymentMethod, this hash contains details about the Multibanco payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub multibanco: Option<miniserde::json::Value>,
/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub naver_pay: Option<ConfirmPaymentIntentPaymentMethodDataNaverPay>,
/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub nz_bank_account: Option<ConfirmPaymentIntentPaymentMethodDataNzBankAccount>,
/// If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub oxxo: Option<miniserde::json::Value>,
/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub p24: Option<ConfirmPaymentIntentPaymentMethodDataP24>,
/// If this is a `pay_by_bank` PaymentMethod, this hash contains details about the PayByBank payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pay_by_bank: Option<miniserde::json::Value>,
/// If this is a `payco` PaymentMethod, this hash contains details about the PAYCO payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub payco: Option<miniserde::json::Value>,
/// If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub paynow: Option<miniserde::json::Value>,
/// If this is a `paypal` PaymentMethod, this hash contains details about the PayPal payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub paypal: Option<miniserde::json::Value>,
/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub payto: Option<ConfirmPaymentIntentPaymentMethodDataPayto>,
/// If this is a `pix` PaymentMethod, this hash contains details about the Pix payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pix: Option<miniserde::json::Value>,
/// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub promptpay: Option<miniserde::json::Value>,
/// Options to configure Radar.
/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
#[serde(skip_serializing_if = "Option::is_none")]
pub radar_options: Option<ConfirmPaymentIntentPaymentMethodDataRadarOptions>,
/// If this is a `revolut_pay` PaymentMethod, this hash contains details about the Revolut Pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub revolut_pay: Option<miniserde::json::Value>,
/// If this is a `samsung_pay` PaymentMethod, this hash contains details about the SamsungPay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub samsung_pay: Option<miniserde::json::Value>,
/// If this is a `satispay` PaymentMethod, this hash contains details about the Satispay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub satispay: Option<miniserde::json::Value>,
/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<ConfirmPaymentIntentPaymentMethodDataSepaDebit>,
/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<ConfirmPaymentIntentPaymentMethodDataSofort>,
/// If this is a `swish` PaymentMethod, this hash contains details about the Swish payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub swish: Option<miniserde::json::Value>,
/// If this is a TWINT PaymentMethod, this hash contains details about the TWINT payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub twint: Option<miniserde::json::Value>,
/// The type of the PaymentMethod.
/// An additional hash is included on the PaymentMethod with a name matching this value.
/// It contains additional information specific to the PaymentMethod type.
#[serde(rename = "type")]
pub type_: ConfirmPaymentIntentPaymentMethodDataType,
/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub upi: Option<ConfirmPaymentIntentPaymentMethodDataUpi>,
/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<ConfirmPaymentIntentPaymentMethodDataUsBankAccount>,
/// If this is an `wechat_pay` PaymentMethod, this hash contains details about the wechat_pay payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub wechat_pay: Option<miniserde::json::Value>,
/// If this is a `zip` PaymentMethod, this hash contains details about the Zip payment method.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub zip: Option<miniserde::json::Value>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodData").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodData {
pub fn new(type_: impl Into<ConfirmPaymentIntentPaymentMethodDataType>) -> Self {
Self {
acss_debit: None,
affirm: None,
afterpay_clearpay: None,
alipay: None,
allow_redisplay: None,
alma: None,
amazon_pay: None,
au_becs_debit: None,
bacs_debit: None,
bancontact: None,
billie: None,
billing_details: None,
blik: None,
boleto: None,
cashapp: None,
crypto: None,
customer_balance: None,
eps: None,
fpx: None,
giropay: None,
grabpay: None,
ideal: None,
interac_present: None,
kakao_pay: None,
klarna: None,
konbini: None,
kr_card: None,
link: None,
mb_way: None,
metadata: None,
mobilepay: None,
multibanco: None,
naver_pay: None,
nz_bank_account: None,
oxxo: None,
p24: None,
pay_by_bank: None,
payco: None,
paynow: None,
paypal: None,
payto: None,
pix: None,
promptpay: None,
radar_options: None,
revolut_pay: None,
samsung_pay: None,
satispay: None,
sepa_debit: None,
sofort: None,
swish: None,
twint: None,
type_: type_.into(),
upi: None,
us_bank_account: None,
wechat_pay: None,
zip: None,
}
}
}
/// This field indicates whether this payment method can be shown again to its customer in a checkout flow.
/// Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow.
/// The field defaults to `unspecified`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
Always,
Limited,
Unspecified,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataAllowRedisplay::*;
match self {
Always => "always",
Limited => "limited",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataAllowRedisplay::*;
match s {
"always" => Ok(Always),
"limited" => Ok(Limited),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataAllowRedisplay"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataAllowRedisplay))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataAllowRedisplay {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataAuBecsDebit {
/// The account number for the bank account.
pub account_number: String,
/// Bank-State-Branch number of the bank account.
pub bsb_number: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataAuBecsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataAuBecsDebit").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataAuBecsDebit {
pub fn new(account_number: impl Into<String>, bsb_number: impl Into<String>) -> Self {
Self { account_number: account_number.into(), bsb_number: bsb_number.into() }
}
}
/// If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataBacsDebit {
/// Account number of the bank account that the funds will be debited from.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Sort code of the bank account. (e.g., `10-20-30`)
#[serde(skip_serializing_if = "Option::is_none")]
pub sort_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataBacsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataBacsDebit").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataBacsDebit {
pub fn new() -> Self {
Self { account_number: None, sort_code: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataBacsDebit {
fn default() -> Self {
Self::new()
}
}
/// Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataBillingDetails {
/// Billing address.
#[serde(skip_serializing_if = "Option::is_none")]
pub address: Option<ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress>,
/// Email address.
#[serde(skip_serializing_if = "Option::is_none")]
pub email: Option<String>,
/// Full name.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Billing phone number (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
/// Taxpayer identification number.
/// Used only for transactions between LATAM buyers and non-LATAM sellers.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax_id: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataBillingDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataBillingDetails")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataBillingDetails {
pub fn new() -> Self {
Self { address: None, email: None, name: None, phone: None, tax_id: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataBillingDetails {
fn default() -> Self {
Self::new()
}
}
/// Billing address.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Address line 1, such as the street, PO Box, or company name.
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2, such as the apartment, suite, unit, or building.
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress {
pub fn new() -> Self {
Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataBillingDetailsAddress {
fn default() -> Self {
Self::new()
}
}
/// If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataBoleto {
/// The tax ID of the customer (CPF for individual consumers or CNPJ for businesses consumers)
pub tax_id: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataBoleto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataBoleto").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataBoleto {
pub fn new(tax_id: impl Into<String>) -> Self {
Self { tax_id: tax_id.into() }
}
}
/// If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataEps {
/// The customer's bank.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<ConfirmPaymentIntentPaymentMethodDataEpsBank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataEps {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataEps").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataEps {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataEps {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataEpsBank {
ArzteUndApothekerBank,
AustrianAnadiBankAg,
BankAustria,
BankhausCarlSpangler,
BankhausSchelhammerUndSchatteraAg,
BawagPskAg,
BksBankAg,
BrullKallmusBankAg,
BtvVierLanderBank,
CapitalBankGraweGruppeAg,
DeutscheBankAg,
Dolomitenbank,
EasybankAg,
ErsteBankUndSparkassen,
HypoAlpeadriabankInternationalAg,
HypoBankBurgenlandAktiengesellschaft,
HypoNoeLbFurNiederosterreichUWien,
HypoOberosterreichSalzburgSteiermark,
HypoTirolBankAg,
HypoVorarlbergBankAg,
MarchfelderBank,
OberbankAg,
RaiffeisenBankengruppeOsterreich,
SchoellerbankAg,
SpardaBankWien,
VolksbankGruppe,
VolkskreditbankAg,
VrBankBraunau,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataEpsBank {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataEpsBank::*;
match self {
ArzteUndApothekerBank => "arzte_und_apotheker_bank",
AustrianAnadiBankAg => "austrian_anadi_bank_ag",
BankAustria => "bank_austria",
BankhausCarlSpangler => "bankhaus_carl_spangler",
BankhausSchelhammerUndSchatteraAg => "bankhaus_schelhammer_und_schattera_ag",
BawagPskAg => "bawag_psk_ag",
BksBankAg => "bks_bank_ag",
BrullKallmusBankAg => "brull_kallmus_bank_ag",
BtvVierLanderBank => "btv_vier_lander_bank",
CapitalBankGraweGruppeAg => "capital_bank_grawe_gruppe_ag",
DeutscheBankAg => "deutsche_bank_ag",
Dolomitenbank => "dolomitenbank",
EasybankAg => "easybank_ag",
ErsteBankUndSparkassen => "erste_bank_und_sparkassen",
HypoAlpeadriabankInternationalAg => "hypo_alpeadriabank_international_ag",
HypoBankBurgenlandAktiengesellschaft => "hypo_bank_burgenland_aktiengesellschaft",
HypoNoeLbFurNiederosterreichUWien => "hypo_noe_lb_fur_niederosterreich_u_wien",
HypoOberosterreichSalzburgSteiermark => "hypo_oberosterreich_salzburg_steiermark",
HypoTirolBankAg => "hypo_tirol_bank_ag",
HypoVorarlbergBankAg => "hypo_vorarlberg_bank_ag",
MarchfelderBank => "marchfelder_bank",
OberbankAg => "oberbank_ag",
RaiffeisenBankengruppeOsterreich => "raiffeisen_bankengruppe_osterreich",
SchoellerbankAg => "schoellerbank_ag",
SpardaBankWien => "sparda_bank_wien",
VolksbankGruppe => "volksbank_gruppe",
VolkskreditbankAg => "volkskreditbank_ag",
VrBankBraunau => "vr_bank_braunau",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataEpsBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataEpsBank::*;
match s {
"arzte_und_apotheker_bank" => Ok(ArzteUndApothekerBank),
"austrian_anadi_bank_ag" => Ok(AustrianAnadiBankAg),
"bank_austria" => Ok(BankAustria),
"bankhaus_carl_spangler" => Ok(BankhausCarlSpangler),
"bankhaus_schelhammer_und_schattera_ag" => Ok(BankhausSchelhammerUndSchatteraAg),
"bawag_psk_ag" => Ok(BawagPskAg),
"bks_bank_ag" => Ok(BksBankAg),
"brull_kallmus_bank_ag" => Ok(BrullKallmusBankAg),
"btv_vier_lander_bank" => Ok(BtvVierLanderBank),
"capital_bank_grawe_gruppe_ag" => Ok(CapitalBankGraweGruppeAg),
"deutsche_bank_ag" => Ok(DeutscheBankAg),
"dolomitenbank" => Ok(Dolomitenbank),
"easybank_ag" => Ok(EasybankAg),
"erste_bank_und_sparkassen" => Ok(ErsteBankUndSparkassen),
"hypo_alpeadriabank_international_ag" => Ok(HypoAlpeadriabankInternationalAg),
"hypo_bank_burgenland_aktiengesellschaft" => Ok(HypoBankBurgenlandAktiengesellschaft),
"hypo_noe_lb_fur_niederosterreich_u_wien" => Ok(HypoNoeLbFurNiederosterreichUWien),
"hypo_oberosterreich_salzburg_steiermark" => Ok(HypoOberosterreichSalzburgSteiermark),
"hypo_tirol_bank_ag" => Ok(HypoTirolBankAg),
"hypo_vorarlberg_bank_ag" => Ok(HypoVorarlbergBankAg),
"marchfelder_bank" => Ok(MarchfelderBank),
"oberbank_ag" => Ok(OberbankAg),
"raiffeisen_bankengruppe_osterreich" => Ok(RaiffeisenBankengruppeOsterreich),
"schoellerbank_ag" => Ok(SchoellerbankAg),
"sparda_bank_wien" => Ok(SpardaBankWien),
"volksbank_gruppe" => Ok(VolksbankGruppe),
"volkskreditbank_ag" => Ok(VolkskreditbankAg),
"vr_bank_braunau" => Ok(VrBankBraunau),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataEpsBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataEpsBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataEpsBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataEpsBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataEpsBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataFpx {
/// Account holder type for FPX transaction
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type: Option<ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType>,
/// The customer's bank.
pub bank: ConfirmPaymentIntentPaymentMethodDataFpxBank,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpx {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataFpx").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataFpx {
pub fn new(bank: impl Into<ConfirmPaymentIntentPaymentMethodDataFpxBank>) -> Self {
Self { account_holder_type: None, bank: bank.into() }
}
}
/// Account holder type for FPX transaction
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
Company,
Individual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType::*;
match self {
Company => "company",
Individual => "individual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType::*;
match s {
"company" => Ok(Company),
"individual" => Ok(Individual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataFpxAccountHolderType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataFpxBank {
AffinBank,
Agrobank,
AllianceBank,
Ambank,
BankIslam,
BankMuamalat,
BankOfChina,
BankRakyat,
Bsn,
Cimb,
DeutscheBank,
HongLeongBank,
Hsbc,
Kfh,
Maybank2e,
Maybank2u,
Ocbc,
PbEnterprise,
PublicBank,
Rhb,
StandardChartered,
Uob,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataFpxBank {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataFpxBank::*;
match self {
AffinBank => "affin_bank",
Agrobank => "agrobank",
AllianceBank => "alliance_bank",
Ambank => "ambank",
BankIslam => "bank_islam",
BankMuamalat => "bank_muamalat",
BankOfChina => "bank_of_china",
BankRakyat => "bank_rakyat",
Bsn => "bsn",
Cimb => "cimb",
DeutscheBank => "deutsche_bank",
HongLeongBank => "hong_leong_bank",
Hsbc => "hsbc",
Kfh => "kfh",
Maybank2e => "maybank2e",
Maybank2u => "maybank2u",
Ocbc => "ocbc",
PbEnterprise => "pb_enterprise",
PublicBank => "public_bank",
Rhb => "rhb",
StandardChartered => "standard_chartered",
Uob => "uob",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataFpxBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataFpxBank::*;
match s {
"affin_bank" => Ok(AffinBank),
"agrobank" => Ok(Agrobank),
"alliance_bank" => Ok(AllianceBank),
"ambank" => Ok(Ambank),
"bank_islam" => Ok(BankIslam),
"bank_muamalat" => Ok(BankMuamalat),
"bank_of_china" => Ok(BankOfChina),
"bank_rakyat" => Ok(BankRakyat),
"bsn" => Ok(Bsn),
"cimb" => Ok(Cimb),
"deutsche_bank" => Ok(DeutscheBank),
"hong_leong_bank" => Ok(HongLeongBank),
"hsbc" => Ok(Hsbc),
"kfh" => Ok(Kfh),
"maybank2e" => Ok(Maybank2e),
"maybank2u" => Ok(Maybank2u),
"ocbc" => Ok(Ocbc),
"pb_enterprise" => Ok(PbEnterprise),
"public_bank" => Ok(PublicBank),
"rhb" => Ok(Rhb),
"standard_chartered" => Ok(StandardChartered),
"uob" => Ok(Uob),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataFpxBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataFpxBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataFpxBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataFpxBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataFpxBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataIdeal {
/// The customer's bank.
/// Only use this parameter for existing customers.
/// Don't use it for new customers.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<ConfirmPaymentIntentPaymentMethodDataIdealBank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataIdeal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataIdeal").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataIdeal {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataIdeal {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
/// Only use this parameter for existing customers.
/// Don't use it for new customers.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataIdealBank {
AbnAmro,
Adyen,
AsnBank,
Bunq,
Buut,
Finom,
Handelsbanken,
Ing,
Knab,
Mollie,
Moneyou,
N26,
Nn,
Rabobank,
Regiobank,
Revolut,
SnsBank,
TriodosBank,
VanLanschot,
Yoursafe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataIdealBank {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataIdealBank::*;
match self {
AbnAmro => "abn_amro",
Adyen => "adyen",
AsnBank => "asn_bank",
Bunq => "bunq",
Buut => "buut",
Finom => "finom",
Handelsbanken => "handelsbanken",
Ing => "ing",
Knab => "knab",
Mollie => "mollie",
Moneyou => "moneyou",
N26 => "n26",
Nn => "nn",
Rabobank => "rabobank",
Regiobank => "regiobank",
Revolut => "revolut",
SnsBank => "sns_bank",
TriodosBank => "triodos_bank",
VanLanschot => "van_lanschot",
Yoursafe => "yoursafe",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataIdealBank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataIdealBank::*;
match s {
"abn_amro" => Ok(AbnAmro),
"adyen" => Ok(Adyen),
"asn_bank" => Ok(AsnBank),
"bunq" => Ok(Bunq),
"buut" => Ok(Buut),
"finom" => Ok(Finom),
"handelsbanken" => Ok(Handelsbanken),
"ing" => Ok(Ing),
"knab" => Ok(Knab),
"mollie" => Ok(Mollie),
"moneyou" => Ok(Moneyou),
"n26" => Ok(N26),
"nn" => Ok(Nn),
"rabobank" => Ok(Rabobank),
"regiobank" => Ok(Regiobank),
"revolut" => Ok(Revolut),
"sns_bank" => Ok(SnsBank),
"triodos_bank" => Ok(TriodosBank),
"van_lanschot" => Ok(VanLanschot),
"yoursafe" => Ok(Yoursafe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataIdealBank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataIdealBank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataIdealBank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataIdealBank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataIdealBank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataKlarna {
/// Customer's date of birth
#[serde(skip_serializing_if = "Option::is_none")]
pub dob: Option<DateOfBirth>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataKlarna {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataKlarna").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataKlarna {
pub fn new() -> Self {
Self { dob: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataKlarna {
fn default() -> Self {
Self::new()
}
}
/// If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataNaverPay {
/// Whether to use Naver Pay points or a card to fund this transaction.
/// If not provided, this defaults to `card`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding: Option<ConfirmPaymentIntentPaymentMethodDataNaverPayFunding>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataNaverPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataNaverPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataNaverPay {
pub fn new() -> Self {
Self { funding: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataNaverPay {
fn default() -> Self {
Self::new()
}
}
/// Whether to use Naver Pay points or a card to fund this transaction.
/// If not provided, this defaults to `card`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
Card,
Points,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataNaverPayFunding::*;
match self {
Card => "card",
Points => "points",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataNaverPayFunding::*;
match s {
"card" => Ok(Card),
"points" => Ok(Points),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataNaverPayFunding"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataNaverPayFunding))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataNaverPayFunding {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataNzBankAccount {
/// The name on the bank account.
/// Only required if the account holder name is different from the name of the authorized signatory collected in the PaymentMethod’s billing details.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_name: Option<String>,
/// The account number for the bank account.
pub account_number: String,
/// The numeric code for the bank account's bank.
pub bank_code: String,
/// The numeric code for the bank account's bank branch.
pub branch_code: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// The suffix of the bank account number.
pub suffix: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataNzBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataNzBankAccount").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataNzBankAccount {
pub fn new(
account_number: impl Into<String>,
bank_code: impl Into<String>,
branch_code: impl Into<String>,
suffix: impl Into<String>,
) -> Self {
Self {
account_holder_name: None,
account_number: account_number.into(),
bank_code: bank_code.into(),
branch_code: branch_code.into(),
reference: None,
suffix: suffix.into(),
}
}
}
/// If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataP24 {
/// The customer's bank.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank: Option<ConfirmPaymentIntentPaymentMethodDataP24Bank>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataP24 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataP24").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataP24 {
pub fn new() -> Self {
Self { bank: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataP24 {
fn default() -> Self {
Self::new()
}
}
/// The customer's bank.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataP24Bank {
AliorBank,
BankMillennium,
BankNowyBfgSa,
BankPekaoSa,
BankiSpbdzielcze,
Blik,
BnpParibas,
Boz,
CitiHandlowy,
CreditAgricole,
Envelobank,
EtransferPocztowy24,
GetinBank,
Ideabank,
Ing,
Inteligo,
MbankMtransfer,
NestPrzelew,
NoblePay,
PbacZIpko,
PlusBank,
SantanderPrzelew24,
TmobileUsbugiBankowe,
ToyotaBank,
Velobank,
VolkswagenBank,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataP24Bank {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataP24Bank::*;
match self {
AliorBank => "alior_bank",
BankMillennium => "bank_millennium",
BankNowyBfgSa => "bank_nowy_bfg_sa",
BankPekaoSa => "bank_pekao_sa",
BankiSpbdzielcze => "banki_spbdzielcze",
Blik => "blik",
BnpParibas => "bnp_paribas",
Boz => "boz",
CitiHandlowy => "citi_handlowy",
CreditAgricole => "credit_agricole",
Envelobank => "envelobank",
EtransferPocztowy24 => "etransfer_pocztowy24",
GetinBank => "getin_bank",
Ideabank => "ideabank",
Ing => "ing",
Inteligo => "inteligo",
MbankMtransfer => "mbank_mtransfer",
NestPrzelew => "nest_przelew",
NoblePay => "noble_pay",
PbacZIpko => "pbac_z_ipko",
PlusBank => "plus_bank",
SantanderPrzelew24 => "santander_przelew24",
TmobileUsbugiBankowe => "tmobile_usbugi_bankowe",
ToyotaBank => "toyota_bank",
Velobank => "velobank",
VolkswagenBank => "volkswagen_bank",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataP24Bank {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataP24Bank::*;
match s {
"alior_bank" => Ok(AliorBank),
"bank_millennium" => Ok(BankMillennium),
"bank_nowy_bfg_sa" => Ok(BankNowyBfgSa),
"bank_pekao_sa" => Ok(BankPekaoSa),
"banki_spbdzielcze" => Ok(BankiSpbdzielcze),
"blik" => Ok(Blik),
"bnp_paribas" => Ok(BnpParibas),
"boz" => Ok(Boz),
"citi_handlowy" => Ok(CitiHandlowy),
"credit_agricole" => Ok(CreditAgricole),
"envelobank" => Ok(Envelobank),
"etransfer_pocztowy24" => Ok(EtransferPocztowy24),
"getin_bank" => Ok(GetinBank),
"ideabank" => Ok(Ideabank),
"ing" => Ok(Ing),
"inteligo" => Ok(Inteligo),
"mbank_mtransfer" => Ok(MbankMtransfer),
"nest_przelew" => Ok(NestPrzelew),
"noble_pay" => Ok(NoblePay),
"pbac_z_ipko" => Ok(PbacZIpko),
"plus_bank" => Ok(PlusBank),
"santander_przelew24" => Ok(SantanderPrzelew24),
"tmobile_usbugi_bankowe" => Ok(TmobileUsbugiBankowe),
"toyota_bank" => Ok(ToyotaBank),
"velobank" => Ok(Velobank),
"volkswagen_bank" => Ok(VolkswagenBank),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataP24Bank"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataP24Bank {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataP24Bank))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataP24Bank {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataP24Bank {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payto` PaymentMethod, this hash contains details about the PayTo payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataPayto {
/// The account number for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Bank-State-Branch number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub bsb_number: Option<String>,
/// The PayID alias for the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub pay_id: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataPayto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataPayto").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataPayto {
pub fn new() -> Self {
Self { account_number: None, bsb_number: None, pay_id: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataPayto {
fn default() -> Self {
Self::new()
}
}
/// Options to configure Radar.
/// See [Radar Session](https://docs.stripe.com/radar/radar-session) for more information.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataRadarOptions {
/// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataRadarOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataRadarOptions").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataRadarOptions {
pub fn new() -> Self {
Self { session: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataRadarOptions {
fn default() -> Self {
Self::new()
}
}
/// If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataSepaDebit {
/// IBAN of the bank account.
pub iban: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataSepaDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataSepaDebit").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataSepaDebit {
pub fn new(iban: impl Into<String>) -> Self {
Self { iban: iban.into() }
}
}
/// If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataSofort {
/// Two-letter ISO code representing the country the bank account is located in.
pub country: ConfirmPaymentIntentPaymentMethodDataSofortCountry,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataSofort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataSofort").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataSofort {
pub fn new(country: impl Into<ConfirmPaymentIntentPaymentMethodDataSofortCountry>) -> Self {
Self { country: country.into() }
}
}
/// Two-letter ISO code representing the country the bank account is located in.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataSofortCountry {
At,
Be,
De,
Es,
It,
Nl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataSofortCountry {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataSofortCountry::*;
match self {
At => "AT",
Be => "BE",
De => "DE",
Es => "ES",
It => "IT",
Nl => "NL",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataSofortCountry {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataSofortCountry::*;
match s {
"AT" => Ok(At),
"BE" => Ok(Be),
"DE" => Ok(De),
"ES" => Ok(Es),
"IT" => Ok(It),
"NL" => Ok(Nl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataSofortCountry"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataSofortCountry {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataSofortCountry))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataSofortCountry {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataSofortCountry {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The type of the PaymentMethod.
/// An additional hash is included on the PaymentMethod with a name matching this value.
/// It contains additional information specific to the PaymentMethod type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataType {
AcssDebit,
Affirm,
AfterpayClearpay,
Alipay,
Alma,
AmazonPay,
AuBecsDebit,
BacsDebit,
Bancontact,
Billie,
Blik,
Boleto,
Cashapp,
Crypto,
CustomerBalance,
Eps,
Fpx,
Giropay,
Grabpay,
Ideal,
KakaoPay,
Klarna,
Konbini,
KrCard,
Link,
MbWay,
Mobilepay,
Multibanco,
NaverPay,
NzBankAccount,
Oxxo,
P24,
PayByBank,
Payco,
Paynow,
Paypal,
Payto,
Pix,
Promptpay,
RevolutPay,
SamsungPay,
Satispay,
SepaDebit,
Sofort,
Swish,
Twint,
Upi,
UsBankAccount,
WechatPay,
Zip,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataType::*;
match self {
AcssDebit => "acss_debit",
Affirm => "affirm",
AfterpayClearpay => "afterpay_clearpay",
Alipay => "alipay",
Alma => "alma",
AmazonPay => "amazon_pay",
AuBecsDebit => "au_becs_debit",
BacsDebit => "bacs_debit",
Bancontact => "bancontact",
Billie => "billie",
Blik => "blik",
Boleto => "boleto",
Cashapp => "cashapp",
Crypto => "crypto",
CustomerBalance => "customer_balance",
Eps => "eps",
Fpx => "fpx",
Giropay => "giropay",
Grabpay => "grabpay",
Ideal => "ideal",
KakaoPay => "kakao_pay",
Klarna => "klarna",
Konbini => "konbini",
KrCard => "kr_card",
Link => "link",
MbWay => "mb_way",
Mobilepay => "mobilepay",
Multibanco => "multibanco",
NaverPay => "naver_pay",
NzBankAccount => "nz_bank_account",
Oxxo => "oxxo",
P24 => "p24",
PayByBank => "pay_by_bank",
Payco => "payco",
Paynow => "paynow",
Paypal => "paypal",
Payto => "payto",
Pix => "pix",
Promptpay => "promptpay",
RevolutPay => "revolut_pay",
SamsungPay => "samsung_pay",
Satispay => "satispay",
SepaDebit => "sepa_debit",
Sofort => "sofort",
Swish => "swish",
Twint => "twint",
Upi => "upi",
UsBankAccount => "us_bank_account",
WechatPay => "wechat_pay",
Zip => "zip",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataType::*;
match s {
"acss_debit" => Ok(AcssDebit),
"affirm" => Ok(Affirm),
"afterpay_clearpay" => Ok(AfterpayClearpay),
"alipay" => Ok(Alipay),
"alma" => Ok(Alma),
"amazon_pay" => Ok(AmazonPay),
"au_becs_debit" => Ok(AuBecsDebit),
"bacs_debit" => Ok(BacsDebit),
"bancontact" => Ok(Bancontact),
"billie" => Ok(Billie),
"blik" => Ok(Blik),
"boleto" => Ok(Boleto),
"cashapp" => Ok(Cashapp),
"crypto" => Ok(Crypto),
"customer_balance" => Ok(CustomerBalance),
"eps" => Ok(Eps),
"fpx" => Ok(Fpx),
"giropay" => Ok(Giropay),
"grabpay" => Ok(Grabpay),
"ideal" => Ok(Ideal),
"kakao_pay" => Ok(KakaoPay),
"klarna" => Ok(Klarna),
"konbini" => Ok(Konbini),
"kr_card" => Ok(KrCard),
"link" => Ok(Link),
"mb_way" => Ok(MbWay),
"mobilepay" => Ok(Mobilepay),
"multibanco" => Ok(Multibanco),
"naver_pay" => Ok(NaverPay),
"nz_bank_account" => Ok(NzBankAccount),
"oxxo" => Ok(Oxxo),
"p24" => Ok(P24),
"pay_by_bank" => Ok(PayByBank),
"payco" => Ok(Payco),
"paynow" => Ok(Paynow),
"paypal" => Ok(Paypal),
"payto" => Ok(Payto),
"pix" => Ok(Pix),
"promptpay" => Ok(Promptpay),
"revolut_pay" => Ok(RevolutPay),
"samsung_pay" => Ok(SamsungPay),
"satispay" => Ok(Satispay),
"sepa_debit" => Ok(SepaDebit),
"sofort" => Ok(Sofort),
"swish" => Ok(Swish),
"twint" => Ok(Twint),
"upi" => Ok(Upi),
"us_bank_account" => Ok(UsBankAccount),
"wechat_pay" => Ok(WechatPay),
"zip" => Ok(Zip),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodDataType {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `upi` PaymentMethod, this hash contains details about the UPI payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataUpi {
/// Configuration options for setting up an eMandate
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<ConfirmPaymentIntentPaymentMethodDataUpiMandateOptions>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUpi {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataUpi").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataUpi {
pub fn new() -> Self {
Self { mandate_options: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataUpi {
fn default() -> Self {
Self::new()
}
}
/// Configuration options for setting up an eMandate
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataUpiMandateOptions {
/// Amount to be charged for future payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType>,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataUpiMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataUpiMandateOptions {
pub fn new() -> Self {
Self { amount: None, amount_type: None, description: None, end_date: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodDataUpiMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodDataUsBankAccount {
/// Account holder type: individual or company.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_holder_type:
Option<ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType>,
/// Account number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_number: Option<String>,
/// Account type: checkings or savings. Defaults to checking if omitted.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_type: Option<ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType>,
/// The ID of a Financial Connections Account to use as a payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub financial_connections_account: Option<String>,
/// Routing number of the bank account.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing_number: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodDataUsBankAccount").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodDataUsBankAccount {
pub fn new() -> Self {
Self {
account_holder_type: None,
account_number: None,
account_type: None,
financial_connections_account: None,
routing_number: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodDataUsBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Account holder type: individual or company.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
Company,
Individual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*;
match self {
Company => "company",
Individual => "individual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType::*;
match s {
"company" => Ok(Company),
"individual" => Ok(Individual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountHolderType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Account type: checkings or savings. Defaults to checking if omitted.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
Checking,
Savings,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType::*;
match self {
Checking => "checking",
Savings => "savings",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType::*;
match s {
"checking" => Ok(Checking),
"savings" => Ok(Savings),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodDataUsBankAccountAccountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Payment method-specific configuration for this PaymentIntent.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptions {
/// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub acss_debit: Option<ConfirmPaymentIntentPaymentMethodOptionsAcssDebit>,
/// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub affirm: Option<ConfirmPaymentIntentPaymentMethodOptionsAffirm>,
/// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub afterpay_clearpay: Option<ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay>,
/// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub alipay: Option<ConfirmPaymentIntentPaymentMethodOptionsAlipay>,
/// If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub alma: Option<ConfirmPaymentIntentPaymentMethodOptionsAlma>,
/// If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub amazon_pay: Option<ConfirmPaymentIntentPaymentMethodOptionsAmazonPay>,
/// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub au_becs_debit: Option<ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit>,
/// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub bacs_debit: Option<ConfirmPaymentIntentPaymentMethodOptionsBacsDebit>,
/// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub bancontact: Option<ConfirmPaymentIntentPaymentMethodOptionsBancontact>,
/// If this is a `billie` PaymentMethod, this sub-hash contains details about the Billie payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub billie: Option<ConfirmPaymentIntentPaymentMethodOptionsBillie>,
/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub blik: Option<ConfirmPaymentIntentPaymentMethodOptionsBlik>,
/// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub boleto: Option<ConfirmPaymentIntentPaymentMethodOptionsBoleto>,
/// Configuration for any card payments attempted on this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub card: Option<ConfirmPaymentIntentPaymentMethodOptionsCard>,
/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present: Option<ConfirmPaymentIntentPaymentMethodOptionsCardPresent>,
/// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub cashapp: Option<ConfirmPaymentIntentPaymentMethodOptionsCashapp>,
/// If this is a `crypto` PaymentMethod, this sub-hash contains details about the Crypto payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub crypto: Option<ConfirmPaymentIntentPaymentMethodOptionsCrypto>,
/// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_balance: Option<ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance>,
/// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub eps: Option<ConfirmPaymentIntentPaymentMethodOptionsEps>,
/// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub fpx: Option<ConfirmPaymentIntentPaymentMethodOptionsFpx>,
/// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub giropay: Option<ConfirmPaymentIntentPaymentMethodOptionsGiropay>,
/// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub grabpay: Option<ConfirmPaymentIntentPaymentMethodOptionsGrabpay>,
/// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub ideal: Option<ConfirmPaymentIntentPaymentMethodOptionsIdeal>,
/// If this is a `interac_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub interac_present: Option<miniserde::json::Value>,
/// If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub kakao_pay: Option<ConfirmPaymentIntentPaymentMethodOptionsKakaoPay>,
/// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<ConfirmPaymentIntentPaymentMethodOptionsKlarna>,
/// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub konbini: Option<ConfirmPaymentIntentPaymentMethodOptionsKonbini>,
/// If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub kr_card: Option<ConfirmPaymentIntentPaymentMethodOptionsKrCard>,
/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub link: Option<ConfirmPaymentIntentPaymentMethodOptionsLink>,
/// If this is a `mb_way` PaymentMethod, this sub-hash contains details about the MB WAY payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub mb_way: Option<ConfirmPaymentIntentPaymentMethodOptionsMbWay>,
/// If this is a `MobilePay` PaymentMethod, this sub-hash contains details about the MobilePay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub mobilepay: Option<ConfirmPaymentIntentPaymentMethodOptionsMobilepay>,
/// If this is a `multibanco` PaymentMethod, this sub-hash contains details about the Multibanco payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub multibanco: Option<ConfirmPaymentIntentPaymentMethodOptionsMultibanco>,
/// If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub naver_pay: Option<ConfirmPaymentIntentPaymentMethodOptionsNaverPay>,
/// If this is a `nz_bank_account` PaymentMethod, this sub-hash contains details about the NZ BECS Direct Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub nz_bank_account: Option<ConfirmPaymentIntentPaymentMethodOptionsNzBankAccount>,
/// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub oxxo: Option<ConfirmPaymentIntentPaymentMethodOptionsOxxo>,
/// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub p24: Option<ConfirmPaymentIntentPaymentMethodOptionsP24>,
/// If this is a `pay_by_bank` PaymentMethod, this sub-hash contains details about the PayByBank payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(with = "stripe_types::with_serde_json_opt")]
pub pay_by_bank: Option<miniserde::json::Value>,
/// If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub payco: Option<ConfirmPaymentIntentPaymentMethodOptionsPayco>,
/// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub paynow: Option<ConfirmPaymentIntentPaymentMethodOptionsPaynow>,
/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal: Option<ConfirmPaymentIntentPaymentMethodOptionsPaypal>,
/// If this is a `payto` PaymentMethod, this sub-hash contains details about the PayTo payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub payto: Option<ConfirmPaymentIntentPaymentMethodOptionsPayto>,
/// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub pix: Option<ConfirmPaymentIntentPaymentMethodOptionsPix>,
/// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub promptpay: Option<ConfirmPaymentIntentPaymentMethodOptionsPromptpay>,
/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub revolut_pay: Option<ConfirmPaymentIntentPaymentMethodOptionsRevolutPay>,
/// If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub samsung_pay: Option<ConfirmPaymentIntentPaymentMethodOptionsSamsungPay>,
/// If this is a `satispay` PaymentMethod, this sub-hash contains details about the Satispay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub satispay: Option<ConfirmPaymentIntentPaymentMethodOptionsSatispay>,
/// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub sepa_debit: Option<ConfirmPaymentIntentPaymentMethodOptionsSepaDebit>,
/// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub sofort: Option<ConfirmPaymentIntentPaymentMethodOptionsSofort>,
/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub swish: Option<ConfirmPaymentIntentPaymentMethodOptionsSwish>,
/// If this is a `twint` PaymentMethod, this sub-hash contains details about the TWINT payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub twint: Option<ConfirmPaymentIntentPaymentMethodOptionsTwint>,
/// If this is a `upi` PaymentIntent, this sub-hash contains details about the UPI payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub upi: Option<ConfirmPaymentIntentPaymentMethodOptionsUpi>,
/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub us_bank_account: Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount>,
/// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub wechat_pay: Option<ConfirmPaymentIntentPaymentMethodOptionsWechatPay>,
/// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options.
#[serde(skip_serializing_if = "Option::is_none")]
pub zip: Option<ConfirmPaymentIntentPaymentMethodOptionsZip>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptions").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptions {
pub fn new() -> Self {
Self {
acss_debit: None,
affirm: None,
afterpay_clearpay: None,
alipay: None,
alma: None,
amazon_pay: None,
au_becs_debit: None,
bacs_debit: None,
bancontact: None,
billie: None,
blik: None,
boleto: None,
card: None,
card_present: None,
cashapp: None,
crypto: None,
customer_balance: None,
eps: None,
fpx: None,
giropay: None,
grabpay: None,
ideal: None,
interac_present: None,
kakao_pay: None,
klarna: None,
konbini: None,
kr_card: None,
link: None,
mb_way: None,
mobilepay: None,
multibanco: None,
naver_pay: None,
nz_bank_account: None,
oxxo: None,
p24: None,
pay_by_bank: None,
payco: None,
paynow: None,
paypal: None,
payto: None,
pix: None,
promptpay: None,
revolut_pay: None,
samsung_pay: None,
satispay: None,
sepa_debit: None,
sofort: None,
swish: None,
twint: None,
upi: None,
us_bank_account: None,
wechat_pay: None,
zip: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// If this is a `acss_debit` PaymentMethod, this sub-hash contains details about the ACSS Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAcssDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
/// Bank account verification method. The default value is `automatic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAcssDebit").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebit {
pub fn new() -> Self {
Self {
mandate_options: None,
setup_future_usage: None,
target_date: None,
verification_method: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAcssDebit {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
/// A URL for custom mandate text to render during confirmation step.
/// The URL will be rendered with additional GET parameters `payment_intent` and `payment_intent_client_secret` when confirming a Payment Intent,.
/// or `setup_intent` and `setup_intent_client_secret` when confirming a Setup Intent.
#[serde(skip_serializing_if = "Option::is_none")]
pub custom_mandate_url: Option<String>,
/// Description of the mandate interval.
/// Only required if 'payment_schedule' parameter is 'interval' or 'combined'.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_description: Option<String>,
/// Payment schedule for the mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_schedule:
Option<ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule>,
/// Transaction type of the mandate.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_type:
Option<ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
pub fn new() -> Self {
Self {
custom_mandate_url: None,
interval_description: None,
payment_schedule: None,
transaction_type: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// Payment schedule for the mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule {
Combined,
Interval,
Sporadic,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*;
match self {
Combined => "combined",
Interval => "interval",
Sporadic => "sporadic",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule::*;
match s {
"combined" => Ok(Combined),
"interval" => Ok(Interval),
"sporadic" => Ok(Sporadic),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsPaymentSchedule
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Transaction type of the mandate.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
Business,
Personal,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*;
match self {
Business => "business",
Personal => "personal",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType::*;
match s {
"business" => Ok(Business),
"personal" => Ok(Personal),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitMandateOptionsTransactionType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Bank account verification method. The default value is `automatic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
Automatic,
Instant,
Microdeposits,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAcssDebitVerificationMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is an `affirm` PaymentMethod, this sub-hash contains details about the Affirm payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAffirm {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod>,
/// Preferred language of the Affirm authorization page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirm {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAffirm").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAffirm {
pub fn new() -> Self {
Self { capture_method: None, preferred_locale: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAffirm {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsAffirmCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAffirmSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `afterpay_clearpay` PaymentMethod, this sub-hash contains details about the Afterpay Clearpay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method:
Option<ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod>,
/// An internal identifier or reference that this payment corresponds to.
/// You must limit the identifier to 128 characters, and it can only contain letters, numbers, underscores, backslashes, and dashes.
/// This field differs from the statement descriptor and item name.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay {
pub fn new() -> Self {
Self { capture_method: None, reference: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAfterpayClearpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `alipay` PaymentMethod, this sub-hash contains details about the Alipay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAlipay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlipay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAlipay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAlipay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAlipay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAlipaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `alma` PaymentMethod, this sub-hash contains details about the Alma payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAlma {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlma {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAlma").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAlma {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAlma {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsAlmaCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `amazon_pay` PaymentMethod, this sub-hash contains details about the Amazon Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAmazonPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAmazonPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAmazonPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAmazonPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAmazonPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAmazonPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAmazonPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `au_becs_debit` PaymentMethod, this sub-hash contains details about the AU BECS Direct Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit {
pub fn new() -> Self {
Self { setup_future_usage: None, target_date: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebit {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsAuBecsDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `bacs_debit` PaymentMethod, this sub-hash contains details about the BACS Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsBacsDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<PaymentMethodOptionsMandateOptionsParam>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBacsDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsBacsDebit").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsBacsDebit {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None, target_date: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsBacsDebit {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsBacsDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `bancontact` PaymentMethod, this sub-hash contains details about the Bancontact payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsBancontact {
/// Preferred language of the Bancontact authorization page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_language:
Option<ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontact {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsBancontact").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsBancontact {
pub fn new() -> Self {
Self { preferred_language: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsBancontact {
fn default() -> Self {
Self::new()
}
}
/// Preferred language of the Bancontact authorization page that the customer is redirected to.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
De,
En,
Fr,
Nl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*;
match self {
De => "de",
En => "en",
Fr => "fr",
Nl => "nl",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage::*;
match s {
"de" => Ok(De),
"en" => Ok(En),
"fr" => Ok(Fr),
"nl" => Ok(Nl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsBancontactPreferredLanguage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsBancontactSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `billie` PaymentMethod, this sub-hash contains details about the Billie payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsBillie {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBillie {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsBillie").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsBillie {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsBillie {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsBillieCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `blik` PaymentMethod, this sub-hash contains details about the BLIK payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsBlik {
/// The 6-digit BLIK code that a customer has generated using their banking application.
/// Can only be set on confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBlik {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsBlik").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsBlik {
pub fn new() -> Self {
Self { code: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsBlik {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsBlikSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `boleto` PaymentMethod, this sub-hash contains details about the Boleto payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsBoleto {
/// The number of calendar days before a Boleto voucher expires.
/// For example, if you create a Boleto voucher on Monday and you set expires_after_days to 2, the Boleto invoice will expire on Wednesday at 23:59 America/Sao_Paulo time.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBoleto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsBoleto").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsBoleto {
pub fn new() -> Self {
Self { expires_after_days: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsBoleto {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsBoletoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Configuration for any card payments attempted on this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCard {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod>,
/// A single-use `cvc_update` Token that represents a card CVC value.
/// When provided, the CVC value will be verified during the card payment attempt.
/// This parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub cvc_token: Option<String>,
/// Installment configuration for payments attempted on this PaymentIntent.
///
/// For more information, see the [installments integration guide](https://docs.stripe.com/payments/installments).
#[serde(skip_serializing_if = "Option::is_none")]
pub installments: Option<ConfirmPaymentIntentPaymentMethodOptionsCardInstallments>,
/// Configuration options for setting up an eMandate for cards issued in India.
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions>,
/// When specified, this parameter indicates that a transaction will be marked
/// as MOTO (Mail Order Telephone Order) and thus out of scope for SCA. This
/// parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub moto: Option<bool>,
/// Selected network to process this PaymentIntent on.
/// Depends on the available networks of the card attached to the PaymentIntent.
/// Can be only set confirm-time.
#[serde(skip_serializing_if = "Option::is_none")]
pub network: Option<ConfirmPaymentIntentPaymentMethodOptionsCardNetwork>,
/// Request ability to [capture beyond the standard authorization validity window](https://docs.stripe.com/payments/extended-authorization) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_extended_authorization:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization>,
/// Request ability to [increment the authorization](https://docs.stripe.com/payments/incremental-authorization) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_incremental_authorization:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization>,
/// Request ability to make [multiple captures](https://docs.stripe.com/payments/multicapture) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_multicapture:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture>,
/// Request ability to [overcapture](https://docs.stripe.com/payments/overcapture) for this PaymentIntent.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_overcapture: Option<ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture>,
/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://docs.stripe.com/strong-customer-authentication).
/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
/// If not provided, this value defaults to `automatic`.
/// Read our guide on [manually requesting 3D Secure](https://docs.stripe.com/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_three_d_secure:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure>,
/// When enabled, using a card that is attached to a customer will require the CVC to be provided again (i.e.
/// using the cvc_token parameter).
#[serde(skip_serializing_if = "Option::is_none")]
pub require_cvc_recollection: Option<bool>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage>,
/// Provides information about a card payment that customers see on their statements.
/// Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that’s set on the account to form the complete statement descriptor.
/// Maximum 22 characters.
/// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor_suffix_kana: Option<String>,
/// Provides information about a card payment that customers see on their statements.
/// Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that’s set on the account to form the complete statement descriptor.
/// Maximum 17 characters.
/// On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub statement_descriptor_suffix_kanji: Option<String>,
/// If 3D Secure authentication was performed with a third-party provider,
/// the authentication details to use for this payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub three_d_secure: Option<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCard").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCard {
pub fn new() -> Self {
Self {
capture_method: None,
cvc_token: None,
installments: None,
mandate_options: None,
moto: None,
network: None,
request_extended_authorization: None,
request_incremental_authorization: None,
request_multicapture: None,
request_overcapture: None,
request_three_d_secure: None,
require_cvc_recollection: None,
setup_future_usage: None,
statement_descriptor_suffix_kana: None,
statement_descriptor_suffix_kanji: None,
three_d_secure: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsCardCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Installment configuration for payments attempted on this PaymentIntent.
///
/// For more information, see the [installments integration guide](https://docs.stripe.com/payments/installments).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardInstallments {
/// Setting to true enables installments for this PaymentIntent.
/// This will cause the response to contain a list of available installment plans.
/// Setting to false will prevent any selected plan from applying to a charge.
#[serde(skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
/// The selected installment plan to use for this payment attempt.
/// This parameter can only be provided during confirmation.
#[serde(skip_serializing_if = "Option::is_none")]
pub plan: Option<ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallments {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardInstallments")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallments {
pub fn new() -> Self {
Self { enabled: None, plan: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCardInstallments {
fn default() -> Self {
Self::new()
}
}
/// The selected installment plan to use for this payment attempt.
/// This parameter can only be provided during confirmation.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
/// For `fixed_count` installment plans, this is required.
/// It represents the number of installment payments your customer will make to their credit card.
#[serde(skip_serializing_if = "Option::is_none")]
pub count: Option<u64>,
/// For `fixed_count` installment plans, this is required.
/// It represents the interval between installment payments your customer will make to their credit card.
/// One of `month`.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval: Option<ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval>,
/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
#[serde(rename = "type")]
pub type_: ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlan {
pub fn new(
type_: impl Into<ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType>,
) -> Self {
Self { count: None, interval: None, type_: type_.into() }
}
}
/// For `fixed_count` installment plans, this is required.
/// It represents the interval between installment payments your customer will make to their credit card.
/// One of `month`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
Month,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*;
match self {
Month => "month",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval::*;
match s {
"month" => Ok(Month),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Type of installment plan, one of `fixed_count`, `bonus`, or `revolving`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
Bonus,
FixedCount,
Revolving,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*;
match self {
Bonus => "bonus",
FixedCount => "fixed_count",
Revolving => "revolving",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType::*;
match s {
"bonus" => Ok(Bonus),
"fixed_count" => Ok(FixedCount),
"revolving" => Ok(Revolving),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardInstallmentsPlanType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Configuration options for setting up an eMandate for cards issued in India.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions {
/// Amount to be charged for future payments, specified in the presentment currency.
pub amount: i64,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
pub amount_type: ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
/// If not provided, the mandate will be active until canceled.
/// If provided, end date should be after start date.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`.
pub interval: ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval,
/// The number of intervals between payments.
/// For example, `interval=month` and `interval_count=3` indicates one payment every three months.
/// Maximum of one year interval allowed (1 year, 12 months, or 52 weeks).
/// This parameter is optional when `interval=sporadic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
/// Unique identifier for the mandate or subscription.
pub reference: String,
/// Start date of the mandate or subscription. Start date should not be lesser than yesterday.
pub start_date: stripe_types::Timestamp,
/// Specifies the type of mandates supported. Possible values are `india`.
#[serde(skip_serializing_if = "Option::is_none")]
pub supported_types:
Option<Vec<ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptions {
pub fn new(
amount: impl Into<i64>,
amount_type: impl Into<ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType>,
interval: impl Into<ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval>,
reference: impl Into<String>,
start_date: impl Into<stripe_types::Timestamp>,
) -> Self {
Self {
amount: amount.into(),
amount_type: amount_type.into(),
description: None,
end_date: None,
interval: interval.into(),
interval_count: None,
reference: reference.into(),
start_date: start_date.into(),
supported_types: None,
}
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Specifies payment frequency. One of `day`, `week`, `month`, `year`, or `sporadic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
Day,
Month,
Sporadic,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*;
match self {
Day => "day",
Month => "month",
Sporadic => "sporadic",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"sporadic" => Ok(Sporadic),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Specifies the type of mandates supported. Possible values are `india`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
India,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*;
match self {
India => "india",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes::*;
match s {
"india" => Ok(India),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardMandateOptionsSupportedTypes
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Selected network to process this PaymentIntent on.
/// Depends on the available networks of the card attached to the PaymentIntent.
/// Can be only set confirm-time.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
Amex,
CartesBancaires,
Diners,
Discover,
EftposAu,
Girocard,
Interac,
Jcb,
Link,
Mastercard,
Unionpay,
Unknown,
Visa,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
/// This variant is prefixed with an underscore to avoid conflicts with Stripe's 'Unknown' variant.
_Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardNetwork::*;
match self {
Amex => "amex",
CartesBancaires => "cartes_bancaires",
Diners => "diners",
Discover => "discover",
EftposAu => "eftpos_au",
Girocard => "girocard",
Interac => "interac",
Jcb => "jcb",
Link => "link",
Mastercard => "mastercard",
Unionpay => "unionpay",
Unknown => "unknown",
Visa => "visa",
_Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardNetwork::*;
match s {
"amex" => Ok(Amex),
"cartes_bancaires" => Ok(CartesBancaires),
"diners" => Ok(Diners),
"discover" => Ok(Discover),
"eftpos_au" => Ok(EftposAu),
"girocard" => Ok(Girocard),
"interac" => Ok(Interac),
"jcb" => Ok(Jcb),
"link" => Ok(Link),
"mastercard" => Ok(Mastercard),
"unionpay" => Ok(Unionpay),
"unknown" => Ok(Unknown),
"visa" => Ok(Visa),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardNetwork"
);
Ok(_Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardNetwork))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsCardNetwork {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [capture beyond the standard authorization validity window](https://docs.stripe.com/payments/extended-authorization) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestExtendedAuthorization
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [increment the authorization](https://docs.stripe.com/payments/incremental-authorization) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestIncrementalAuthorization
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to make [multiple captures](https://docs.stripe.com/payments/multicapture) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestMulticapture
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Request ability to [overcapture](https://docs.stripe.com/payments/overcapture) for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
IfAvailable,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
match self {
IfAvailable => "if_available",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture::*;
match s {
"if_available" => Ok(IfAvailable),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestOvercapture
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://docs.stripe.com/strong-customer-authentication).
/// However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option.
/// If not provided, this value defaults to `automatic`.
/// Read our guide on [manually requesting 3D Secure](https://docs.stripe.com/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
Any,
Automatic,
Challenge,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
match self {
Any => "any",
Automatic => "automatic",
Challenge => "challenge",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure::*;
match s {
"any" => Ok(Any),
"automatic" => Ok(Automatic),
"challenge" => Ok(Challenge),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardRequestThreeDSecure
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsCardSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If 3D Secure authentication was performed with a third-party provider,
/// the authentication details to use for this payment.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure {
/// The `transStatus` returned from the card Issuer’s ACS in the ARes.
#[serde(skip_serializing_if = "Option::is_none")]
pub ares_trans_status:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus>,
/// The cryptogram, also known as the "authentication value" (AAV, CAVV or
/// AEVV). This value is 20 bytes, base64-encoded into a 28-character string.
/// (Most 3D Secure providers will return the base64-encoded version, which
/// is what you should specify here.)
pub cryptogram: String,
/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure
/// provider and indicates what degree of authentication was performed.
#[serde(skip_serializing_if = "Option::is_none")]
pub electronic_commerce_indicator:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator>,
/// The exemption requested via 3DS and accepted by the issuer at authentication time.
#[serde(skip_serializing_if = "Option::is_none")]
pub exemption_indicator:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator>,
/// Network specific 3DS fields. Network specific arguments require an
/// explicit card brand choice. The parameter `payment_method_options.card.network``
/// must be populated accordingly
#[serde(skip_serializing_if = "Option::is_none")]
pub network_options:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions>,
/// The challenge indicator (`threeDSRequestorChallengeInd`) which was requested in the
/// AReq sent to the card Issuer's ACS. A string containing 2 digits from 01-99.
#[serde(skip_serializing_if = "Option::is_none")]
pub requestor_challenge_indicator: Option<String>,
/// For 3D Secure 1, the XID. For 3D Secure 2, the Directory Server
/// Transaction ID (dsTransID).
pub transaction_id: String,
/// The version of 3D Secure that was performed.
pub version: ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecure {
pub fn new(
cryptogram: impl Into<String>,
transaction_id: impl Into<String>,
version: impl Into<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion>,
) -> Self {
Self {
ares_trans_status: None,
cryptogram: cryptogram.into(),
electronic_commerce_indicator: None,
exemption_indicator: None,
network_options: None,
requestor_challenge_indicator: None,
transaction_id: transaction_id.into(),
version: version.into(),
}
}
}
/// The `transStatus` returned from the card Issuer’s ACS in the ARes.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
A,
C,
I,
N,
R,
U,
Y,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*;
match self {
A => "A",
C => "C",
I => "I",
N => "N",
R => "R",
U => "U",
Y => "Y",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus::*;
match s {
"A" => Ok(A),
"C" => Ok(C),
"I" => Ok(I),
"N" => Ok(N),
"R" => Ok(R),
"U" => Ok(U),
"Y" => Ok(Y),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureAresTransStatus
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The Electronic Commerce Indicator (ECI) is returned by your 3D Secure
/// provider and indicates what degree of authentication was performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator {
V01,
V02,
V05,
V06,
V07,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*;
match self {
V01 => "01",
V02 => "02",
V05 => "05",
V06 => "06",
V07 => "07",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator::*;
match s {
"01" => Ok(V01),
"02" => Ok(V02),
"05" => Ok(V05),
"06" => Ok(V06),
"07" => Ok(V07),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureElectronicCommerceIndicator
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The exemption requested via 3DS and accepted by the issuer at authentication time.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
LowRisk,
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*;
match self {
LowRisk => "low_risk",
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator::*;
match s {
"low_risk" => Ok(LowRisk),
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureExemptionIndicator
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Network specific 3DS fields. Network specific arguments require an
/// explicit card brand choice. The parameter `payment_method_options.card.network``
/// must be populated accordingly
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
/// Cartes Bancaires-specific 3DS fields.
#[serde(skip_serializing_if = "Option::is_none")]
pub cartes_bancaires: Option<
ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires,
>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
pub fn new() -> Self {
Self { cartes_bancaires: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptions {
fn default() -> Self {
Self::new()
}
}
/// Cartes Bancaires-specific 3DS fields.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires {
/// The cryptogram calculation algorithm used by the card Issuer's ACS
/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`.
/// messageExtension: CB-AVALGO
pub cb_avalgo: ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo,
/// The exemption indicator returned from Cartes Bancaires in the ARes.
/// message extension: CB-EXEMPTION; string (4 characters)
/// This is a 3 byte bitmap (low significant byte first and most significant
/// bit first) that has been Base64 encoded
#[serde(skip_serializing_if = "Option::is_none")]
pub cb_exemption: Option<String>,
/// The risk score returned from Cartes Bancaires in the ARes.
/// message extension: CB-SCORE; numeric value 0-99
#[serde(skip_serializing_if = "Option::is_none")]
pub cb_score: Option<i64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires",
)
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancaires {
pub fn new(
cb_avalgo: impl Into<ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo>,
) -> Self {
Self { cb_avalgo: cb_avalgo.into(), cb_exemption: None, cb_score: None }
}
}
/// The cryptogram calculation algorithm used by the card Issuer's ACS
/// to calculate the Authentication cryptogram. Also known as `cavvAlgorithm`.
/// messageExtension: CB-AVALGO
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo
{
V0,
V1,
V2,
V3,
V4,
A,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*;
match self {
V0 => "0",
V1 => "1",
V2 => "2",
V3 => "3",
V4 => "4",
A => "A",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo::*;
match s {
"0" => Ok(V0),
"1" => Ok(V1),
"2" => Ok(V2),
"3" => Ok(V3),
"4" => Ok(V4),
"A" => Ok(A),
v => { tracing::warn!("Unknown value '{}' for enum '{}'", v, "ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo"); Ok(Unknown(v.to_owned())) }
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo)).finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureNetworkOptionsCartesBancairesCbAvalgo {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The version of 3D Secure that was performed.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
V1_0_2,
V2_1_0,
V2_2_0,
V2_3_0,
V2_3_1,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*;
match self {
V1_0_2 => "1.0.2",
V2_1_0 => "2.1.0",
V2_2_0 => "2.2.0",
V2_3_0 => "2.3.0",
V2_3_1 => "2.3.1",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion::*;
match s {
"1.0.2" => Ok(V1_0_2),
"2.1.0" => Ok(V2_1_0),
"2.2.0" => Ok(V2_2_0),
"2.3.0" => Ok(V2_3_0),
"2.3.1" => Ok(V2_3_1),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardThreeDSecureVersion
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardPresent {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod>,
/// Request ability to capture this payment beyond the standard [authorization validity window](https://docs.stripe.com/terminal/features/extended-authorizations#authorization-validity).
#[serde(skip_serializing_if = "Option::is_none")]
pub request_extended_authorization: Option<bool>,
/// Request ability to [increment](https://docs.stripe.com/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible.
/// Check [incremental_authorization_supported](https://docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://docs.stripe.com/api/payment_intents/confirm) response to verify support.
#[serde(skip_serializing_if = "Option::is_none")]
pub request_incremental_authorization_support: Option<bool>,
/// Network routing priority on co-branded EMV cards supporting domestic debit and international card schemes.
#[serde(skip_serializing_if = "Option::is_none")]
pub routing: Option<ConfirmPaymentIntentPaymentMethodOptionsCardPresentRouting>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardPresent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardPresent")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self {
capture_method: None,
request_extended_authorization: None,
request_incremental_authorization_support: None,
routing: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCardPresent {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
Manual,
ManualPreferred,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod::*;
match self {
Manual => "manual",
ManualPreferred => "manual_preferred",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod::*;
match s {
"manual" => Ok(Manual),
"manual_preferred" => Ok(ManualPreferred),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Network routing priority on co-branded EMV cards supporting domestic debit and international card schemes.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCardPresentRouting {
/// Routing requested priority
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_priority:
Option<ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRouting {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCardPresentRouting")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardPresentRouting {
pub fn new() -> Self {
Self { requested_priority: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRouting {
fn default() -> Self {
Self::new()
}
}
/// Routing requested priority
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority {
Domestic,
International,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority::*;
match self {
Domestic => "domestic",
International => "international",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority::*;
match s {
"domestic" => Ok(Domestic),
"international" => Ok(International),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCardPresentRoutingRequestedPriority
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `cashapp` PaymentMethod, this sub-hash contains details about the Cash App Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCashapp {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashapp {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCashapp").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCashapp {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCashapp {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsCashappCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCashappSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `crypto` PaymentMethod, this sub-hash contains details about the Crypto payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCrypto {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCrypto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCrypto").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCrypto {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCrypto {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCryptoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `customer balance` PaymentMethod, this sub-hash contains details about the customer balance payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance {
/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
#[serde(skip_serializing_if = "Option::is_none")]
pub bank_transfer: Option<ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer>,
/// The funding method type to be used when there are not enough funds in the customer balance.
/// Permitted values include: `bank_transfer`.
#[serde(skip_serializing_if = "Option::is_none")]
pub funding_type: Option<ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance {
pub fn new() -> Self {
Self { bank_transfer: None, funding_type: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalance {
fn default() -> Self {
Self::new()
}
}
/// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
/// Configuration for the eu_bank_transfer funding type.
#[serde(skip_serializing_if = "Option::is_none")]
pub eu_bank_transfer: Option<EuBankTransferParams>,
/// List of address types that should be returned in the financial_addresses response.
/// If not specified, all valid types will be returned.
///
/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
#[serde(skip_serializing_if = "Option::is_none")]
pub requested_address_types: Option<Vec<ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes>>,
/// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
#[serde(rename = "type")]
pub type_: ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransfer {
pub fn new(
type_: impl Into<ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType>,
) -> Self {
Self { eu_bank_transfer: None, requested_address_types: None, type_: type_.into() }
}
}
/// List of address types that should be returned in the financial_addresses response.
/// If not specified, all valid types will be returned.
///
/// Permitted values include: `sort_code`, `zengin`, `iban`, or `spei`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes {
Aba,
Iban,
Sepa,
SortCode,
Spei,
Swift,
Zengin,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*;
match self {
Aba => "aba",
Iban => "iban",
Sepa => "sepa",
SortCode => "sort_code",
Spei => "spei",
Swift => "swift",
Zengin => "zengin",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes::*;
match s {
"aba" => Ok(Aba),
"iban" => Ok(Iban),
"sepa" => Ok(Sepa),
"sort_code" => Ok(SortCode),
"spei" => Ok(Spei),
"swift" => Ok(Swift),
"zengin" => Ok(Zengin),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes)).finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferRequestedAddressTypes
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The list of bank transfer types that this PaymentIntent is allowed to use for funding Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
EuBankTransfer,
GbBankTransfer,
JpBankTransfer,
MxBankTransfer,
UsBankTransfer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*;
match self {
EuBankTransfer => "eu_bank_transfer",
GbBankTransfer => "gb_bank_transfer",
JpBankTransfer => "jp_bank_transfer",
MxBankTransfer => "mx_bank_transfer",
UsBankTransfer => "us_bank_transfer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType::*;
match s {
"eu_bank_transfer" => Ok(EuBankTransfer),
"gb_bank_transfer" => Ok(GbBankTransfer),
"jp_bank_transfer" => Ok(JpBankTransfer),
"mx_bank_transfer" => Ok(MxBankTransfer),
"us_bank_transfer" => Ok(UsBankTransfer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The funding method type to be used when there are not enough funds in the customer balance.
/// Permitted values include: `bank_transfer`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
BankTransfer,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*;
match self {
BankTransfer => "bank_transfer",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType::*;
match s {
"bank_transfer" => Ok(BankTransfer),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceFundingType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsCustomerBalanceSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsEps {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsEps {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsEps").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsEps {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsEps {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsEpsSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsFpx {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsFpx {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsFpx").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsFpx {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsFpx {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsFpxSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsGiropay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGiropay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsGiropay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsGiropay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsGiropay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsGiropaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsGrabpay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGrabpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsGrabpay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsGrabpay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsGrabpay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsGrabpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsIdeal {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsIdeal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsIdeal").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsIdeal {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsIdeal {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsIdealSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `kakao_pay` PaymentMethod, this sub-hash contains details about the Kakao Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsKakaoPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKakaoPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsKakaoPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsKakaoPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsKakaoPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKakaoPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKakaoPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `klarna` PaymentMethod, this sub-hash contains details about the Klarna payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsKlarna {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod>,
/// On-demand details if setting up or charging an on-demand payment.
#[serde(skip_serializing_if = "Option::is_none")]
pub on_demand: Option<ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemand>,
/// Preferred language of the Klarna authorization page that the customer is redirected to
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage>,
/// Subscription details if setting up or charging a subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub subscriptions: Option<Vec<ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptions>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarna {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsKlarna").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarna {
pub fn new() -> Self {
Self {
capture_method: None,
on_demand: None,
preferred_locale: None,
setup_future_usage: None,
subscriptions: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsKlarna {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsKlarnaCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// On-demand details if setting up or charging an on-demand payment.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemand {
/// Your average amount value.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub average_amount: Option<i64>,
/// The maximum value you may charge a customer per purchase.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub maximum_amount: Option<i64>,
/// The lowest or minimum value you may charge a customer per purchase.
/// You can use a value across your customer base, or segment based on customer type, country, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub minimum_amount: Option<i64>,
/// Interval at which the customer is making purchases
#[serde(skip_serializing_if = "Option::is_none")]
pub purchase_interval:
Option<ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval>,
/// The number of `purchase_interval` between charges
#[serde(skip_serializing_if = "Option::is_none")]
pub purchase_interval_count: Option<u64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemand {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemand")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemand {
pub fn new() -> Self {
Self {
average_amount: None,
maximum_amount: None,
minimum_amount: None,
purchase_interval: None,
purchase_interval_count: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemand {
fn default() -> Self {
Self::new()
}
}
/// Interval at which the customer is making purchases
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
Day,
Month,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval::*;
match self {
Day => "day",
Month => "month",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKlarnaOnDemandPurchaseInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Preferred language of the Klarna authorization page that the customer is redirected to
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
CsMinusCz,
DaMinusDk,
DeMinusAt,
DeMinusCh,
DeMinusDe,
ElMinusGr,
EnMinusAt,
EnMinusAu,
EnMinusBe,
EnMinusCa,
EnMinusCh,
EnMinusCz,
EnMinusDe,
EnMinusDk,
EnMinusEs,
EnMinusFi,
EnMinusFr,
EnMinusGb,
EnMinusGr,
EnMinusIe,
EnMinusIt,
EnMinusNl,
EnMinusNo,
EnMinusNz,
EnMinusPl,
EnMinusPt,
EnMinusRo,
EnMinusSe,
EnMinusUs,
EsMinusEs,
EsMinusUs,
FiMinusFi,
FrMinusBe,
FrMinusCa,
FrMinusCh,
FrMinusFr,
ItMinusCh,
ItMinusIt,
NbMinusNo,
NlMinusBe,
NlMinusNl,
PlMinusPl,
PtMinusPt,
RoMinusRo,
SvMinusFi,
SvMinusSe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*;
match self {
CsMinusCz => "cs-CZ",
DaMinusDk => "da-DK",
DeMinusAt => "de-AT",
DeMinusCh => "de-CH",
DeMinusDe => "de-DE",
ElMinusGr => "el-GR",
EnMinusAt => "en-AT",
EnMinusAu => "en-AU",
EnMinusBe => "en-BE",
EnMinusCa => "en-CA",
EnMinusCh => "en-CH",
EnMinusCz => "en-CZ",
EnMinusDe => "en-DE",
EnMinusDk => "en-DK",
EnMinusEs => "en-ES",
EnMinusFi => "en-FI",
EnMinusFr => "en-FR",
EnMinusGb => "en-GB",
EnMinusGr => "en-GR",
EnMinusIe => "en-IE",
EnMinusIt => "en-IT",
EnMinusNl => "en-NL",
EnMinusNo => "en-NO",
EnMinusNz => "en-NZ",
EnMinusPl => "en-PL",
EnMinusPt => "en-PT",
EnMinusRo => "en-RO",
EnMinusSe => "en-SE",
EnMinusUs => "en-US",
EsMinusEs => "es-ES",
EsMinusUs => "es-US",
FiMinusFi => "fi-FI",
FrMinusBe => "fr-BE",
FrMinusCa => "fr-CA",
FrMinusCh => "fr-CH",
FrMinusFr => "fr-FR",
ItMinusCh => "it-CH",
ItMinusIt => "it-IT",
NbMinusNo => "nb-NO",
NlMinusBe => "nl-BE",
NlMinusNl => "nl-NL",
PlMinusPl => "pl-PL",
PtMinusPt => "pt-PT",
RoMinusRo => "ro-RO",
SvMinusFi => "sv-FI",
SvMinusSe => "sv-SE",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale::*;
match s {
"cs-CZ" => Ok(CsMinusCz),
"da-DK" => Ok(DaMinusDk),
"de-AT" => Ok(DeMinusAt),
"de-CH" => Ok(DeMinusCh),
"de-DE" => Ok(DeMinusDe),
"el-GR" => Ok(ElMinusGr),
"en-AT" => Ok(EnMinusAt),
"en-AU" => Ok(EnMinusAu),
"en-BE" => Ok(EnMinusBe),
"en-CA" => Ok(EnMinusCa),
"en-CH" => Ok(EnMinusCh),
"en-CZ" => Ok(EnMinusCz),
"en-DE" => Ok(EnMinusDe),
"en-DK" => Ok(EnMinusDk),
"en-ES" => Ok(EnMinusEs),
"en-FI" => Ok(EnMinusFi),
"en-FR" => Ok(EnMinusFr),
"en-GB" => Ok(EnMinusGb),
"en-GR" => Ok(EnMinusGr),
"en-IE" => Ok(EnMinusIe),
"en-IT" => Ok(EnMinusIt),
"en-NL" => Ok(EnMinusNl),
"en-NO" => Ok(EnMinusNo),
"en-NZ" => Ok(EnMinusNz),
"en-PL" => Ok(EnMinusPl),
"en-PT" => Ok(EnMinusPt),
"en-RO" => Ok(EnMinusRo),
"en-SE" => Ok(EnMinusSe),
"en-US" => Ok(EnMinusUs),
"es-ES" => Ok(EsMinusEs),
"es-US" => Ok(EsMinusUs),
"fi-FI" => Ok(FiMinusFi),
"fr-BE" => Ok(FrMinusBe),
"fr-CA" => Ok(FrMinusCa),
"fr-CH" => Ok(FrMinusCh),
"fr-FR" => Ok(FrMinusFr),
"it-CH" => Ok(ItMinusCh),
"it-IT" => Ok(ItMinusIt),
"nb-NO" => Ok(NbMinusNo),
"nl-BE" => Ok(NlMinusBe),
"nl-NL" => Ok(NlMinusNl),
"pl-PL" => Ok(PlMinusPl),
"pt-PT" => Ok(PtMinusPt),
"ro-RO" => Ok(RoMinusRo),
"sv-FI" => Ok(SvMinusFi),
"sv-SE" => Ok(SvMinusSe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKlarnaPreferredLocale
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Subscription details if setting up or charging a subscription.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
/// Unit of time between subscription charges.
pub interval: ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval,
/// The number of intervals (specified in the `interval` attribute) between subscription charges.
/// For example, `interval=month` and `interval_count=3` charges every 3 months.
#[serde(skip_serializing_if = "Option::is_none")]
pub interval_count: Option<u64>,
/// Name for subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// Describes the upcoming charge for this subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_billing: Option<SubscriptionNextBillingParam>,
/// A non-customer-facing reference to correlate subscription charges in the Klarna app.
/// Use a value that persists across subscription charges.
pub reference: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptions {
pub fn new(
interval: impl Into<ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval>,
reference: impl Into<String>,
) -> Self {
Self {
interval: interval.into(),
interval_count: None,
name: None,
next_billing: None,
reference: reference.into(),
}
}
}
/// Unit of time between subscription charges.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
Day,
Month,
Week,
Year,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval::*;
match self {
Day => "day",
Month => "month",
Week => "week",
Year => "year",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval::*;
match s {
"day" => Ok(Day),
"month" => Ok(Month),
"week" => Ok(Week),
"year" => Ok(Year),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKlarnaSubscriptionsInterval
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `konbini` PaymentMethod, this sub-hash contains details about the Konbini payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsKonbini {
/// An optional 10 to 11 digit numeric-only string determining the confirmation code at applicable convenience stores.
/// Must not consist of only zeroes and could be rejected in case of insufficient uniqueness.
/// We recommend to use the customer's phone number.
#[serde(skip_serializing_if = "Option::is_none")]
pub confirmation_number: Option<String>,
/// The number of calendar days (between 1 and 60) after which Konbini payment instructions will expire.
/// For example, if a PaymentIntent is confirmed with Konbini and `expires_after_days` set to 2 on Monday JST, the instructions will expire on Wednesday 23:59:59 JST.
/// Defaults to 3 days.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// The timestamp at which the Konbini payment instructions will expire.
/// Only one of `expires_after_days` or `expires_at` may be set.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<stripe_types::Timestamp>,
/// A product descriptor of up to 22 characters, which will appear to customers at the convenience store.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_description: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKonbini {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsKonbini").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsKonbini {
pub fn new() -> Self {
Self {
confirmation_number: None,
expires_after_days: None,
expires_at: None,
product_description: None,
setup_future_usage: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsKonbini {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKonbiniSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `kr_card` PaymentMethod, this sub-hash contains details about the KR Card payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsKrCard {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKrCard {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsKrCard").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsKrCard {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsKrCard {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsKrCardCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsKrCardSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `link` PaymentMethod, this sub-hash contains details about the Link payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsLink {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod>,
/// \[Deprecated\] This is a legacy parameter that no longer has any function.
#[serde(skip_serializing_if = "Option::is_none")]
pub persistent_token: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLink {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsLink").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsLink {
pub fn new() -> Self {
Self { capture_method: None, persistent_token: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsLink {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsLinkCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsLinkSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `mb_way` PaymentMethod, this sub-hash contains details about the MB WAY payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsMbWay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMbWay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsMbWay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsMbWay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsMbWay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsMbWaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `MobilePay` PaymentMethod, this sub-hash contains details about the MobilePay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsMobilepay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMobilepay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsMobilepay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsMobilepay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsMobilepay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsMobilepayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsMobilepaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `multibanco` PaymentMethod, this sub-hash contains details about the Multibanco payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsMultibanco {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMultibanco {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsMultibanco").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsMultibanco {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsMultibanco {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsMultibancoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `naver_pay` PaymentMethod, this sub-hash contains details about the Naver Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsNaverPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNaverPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsNaverPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsNaverPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsNaverPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsNaverPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsNaverPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `nz_bank_account` PaymentMethod, this sub-hash contains details about the NZ BECS Direct Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsNzBankAccount {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsNzBankAccount")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsNzBankAccount {
pub fn new() -> Self {
Self { setup_future_usage: None, target_date: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsNzBankAccountSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `oxxo` PaymentMethod, this sub-hash contains details about the OXXO payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsOxxo {
/// The number of calendar days before an OXXO voucher expires.
/// For example, if you create an OXXO voucher on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_days: Option<u32>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsOxxo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsOxxo").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsOxxo {
pub fn new() -> Self {
Self { expires_after_days: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsOxxo {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsOxxoSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `p24` PaymentMethod, this sub-hash contains details about the Przelewy24 payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsP24 {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage>,
/// Confirm that the payer has accepted the P24 terms and conditions.
#[serde(skip_serializing_if = "Option::is_none")]
pub tos_shown_and_accepted: Option<bool>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsP24 {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsP24").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsP24 {
pub fn new() -> Self {
Self { setup_future_usage: None, tos_shown_and_accepted: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsP24 {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsP24SetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payco` PaymentMethod, this sub-hash contains details about the PAYCO payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPayco {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPayco {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPayco").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPayco {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPayco {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsPaycoCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPaynow {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaynow {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPaynow").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaynow {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPaynow {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaynowSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `paypal` PaymentMethod, this sub-hash contains details about the PayPal payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPaypal {
/// Controls when the funds will be captured from the customer's account.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod>,
/// [Preferred locale](https://docs.stripe.com/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_locale: Option<ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale>,
/// A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID.
/// This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// The risk correlation ID for an on-session payment using a saved PayPal payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub risk_correlation_id: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypal {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPaypal").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self {
capture_method: None,
preferred_locale: None,
reference: None,
risk_correlation_id: None,
setup_future_usage: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPaypal {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds will be captured from the customer's account.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsPaypalCaptureMethod {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// [Preferred locale](https://docs.stripe.com/payments/paypal/supported-locales) of the PayPal checkout page that the customer is redirected to.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
CsMinusCz,
DaMinusDk,
DeMinusAt,
DeMinusDe,
DeMinusLu,
ElMinusGr,
EnMinusGb,
EnMinusUs,
EsMinusEs,
FiMinusFi,
FrMinusBe,
FrMinusFr,
FrMinusLu,
HuMinusHu,
ItMinusIt,
NlMinusBe,
NlMinusNl,
PlMinusPl,
PtMinusPt,
SkMinusSk,
SvMinusSe,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*;
match self {
CsMinusCz => "cs-CZ",
DaMinusDk => "da-DK",
DeMinusAt => "de-AT",
DeMinusDe => "de-DE",
DeMinusLu => "de-LU",
ElMinusGr => "el-GR",
EnMinusGb => "en-GB",
EnMinusUs => "en-US",
EsMinusEs => "es-ES",
FiMinusFi => "fi-FI",
FrMinusBe => "fr-BE",
FrMinusFr => "fr-FR",
FrMinusLu => "fr-LU",
HuMinusHu => "hu-HU",
ItMinusIt => "it-IT",
NlMinusBe => "nl-BE",
NlMinusNl => "nl-NL",
PlMinusPl => "pl-PL",
PtMinusPt => "pt-PT",
SkMinusSk => "sk-SK",
SvMinusSe => "sv-SE",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale::*;
match s {
"cs-CZ" => Ok(CsMinusCz),
"da-DK" => Ok(DaMinusDk),
"de-AT" => Ok(DeMinusAt),
"de-DE" => Ok(DeMinusDe),
"de-LU" => Ok(DeMinusLu),
"el-GR" => Ok(ElMinusGr),
"en-GB" => Ok(EnMinusGb),
"en-US" => Ok(EnMinusUs),
"es-ES" => Ok(EsMinusEs),
"fi-FI" => Ok(FiMinusFi),
"fr-BE" => Ok(FrMinusBe),
"fr-FR" => Ok(FrMinusFr),
"fr-LU" => Ok(FrMinusLu),
"hu-HU" => Ok(HuMinusHu),
"it-IT" => Ok(ItMinusIt),
"nl-BE" => Ok(NlMinusBe),
"nl-NL" => Ok(NlMinusNl),
"pl-PL" => Ok(PlMinusPl),
"pt-PT" => Ok(PtMinusPt),
"sk-SK" => Ok(SkMinusSk),
"sv-SE" => Ok(SvMinusSe),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaypalPreferredLocale
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaypalSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `payto` PaymentMethod, this sub-hash contains details about the PayTo payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPayto {
/// Additional fields for Mandate creation.
/// Only `purpose` field is configurable for PayTo PaymentIntent with `setup_future_usage=none`.
/// Other fields are only applicable to PayTo PaymentIntent with `setup_future_usage=off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPayto {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPayto").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPayto {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPayto {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation.
/// Only `purpose` field is configurable for PayTo PaymentIntent with `setup_future_usage=none`.
/// Other fields are only applicable to PayTo PaymentIntent with `setup_future_usage=off_session`.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptions {
/// Amount that will be collected. It is required when `amount_type` is `fixed`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// The type of amount that will be collected.
/// The amount charged must be exact or up to the value of `amount` param for `fixed` or `maximum` type respectively.
/// Defaults to `maximum`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType>,
/// Date, in YYYY-MM-DD format, after which payments will not be collected. Defaults to no end date.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<String>,
/// The periodicity at which payments will be collected. Defaults to `adhoc`.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_schedule:
Option<ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule>,
/// The number of payments that will be made during a payment period.
/// Defaults to 1 except for when `payment_schedule` is `adhoc`.
/// In that case, it defaults to no limit.
#[serde(skip_serializing_if = "Option::is_none")]
pub payments_per_period: Option<i64>,
/// The purpose for which payments are made. Has a default value based on your merchant category code.
#[serde(skip_serializing_if = "Option::is_none")]
pub purpose: Option<ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptions {
pub fn new() -> Self {
Self {
amount: None,
amount_type: None,
end_date: None,
payment_schedule: None,
payments_per_period: None,
purpose: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// The type of amount that will be collected.
/// The amount charged must be exact or up to the value of `amount` param for `fixed` or `maximum` type respectively.
/// Defaults to `maximum`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The periodicity at which payments will be collected. Defaults to `adhoc`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
Adhoc,
Annual,
Daily,
Fortnightly,
Monthly,
Quarterly,
SemiAnnual,
Weekly,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule::*;
match self {
Adhoc => "adhoc",
Annual => "annual",
Daily => "daily",
Fortnightly => "fortnightly",
Monthly => "monthly",
Quarterly => "quarterly",
SemiAnnual => "semi_annual",
Weekly => "weekly",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule::*;
match s {
"adhoc" => Ok(Adhoc),
"annual" => Ok(Annual),
"daily" => Ok(Daily),
"fortnightly" => Ok(Fortnightly),
"monthly" => Ok(Monthly),
"quarterly" => Ok(Quarterly),
"semi_annual" => Ok(SemiAnnual),
"weekly" => Ok(Weekly),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPaymentSchedule
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The purpose for which payments are made. Has a default value based on your merchant category code.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
DependantSupport,
Government,
Loan,
Mortgage,
Other,
Pension,
Personal,
Retail,
Salary,
Tax,
Utility,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose::*;
match self {
DependantSupport => "dependant_support",
Government => "government",
Loan => "loan",
Mortgage => "mortgage",
Other => "other",
Pension => "pension",
Personal => "personal",
Retail => "retail",
Salary => "salary",
Tax => "tax",
Utility => "utility",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose::*;
match s {
"dependant_support" => Ok(DependantSupport),
"government" => Ok(Government),
"loan" => Ok(Loan),
"mortgage" => Ok(Mortgage),
"other" => Ok(Other),
"pension" => Ok(Pension),
"personal" => Ok(Personal),
"retail" => Ok(Retail),
"salary" => Ok(Salary),
"tax" => Ok(Tax),
"utility" => Ok(Utility),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaytoMandateOptionsPurpose
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPaytoSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `pix` PaymentMethod, this sub-hash contains details about the Pix payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPix {
/// Determines if the amount includes the IOF tax. Defaults to `never`.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_includes_iof: Option<ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof>,
/// The number of seconds (between 10 and 1209600) after which Pix payment will expire.
/// Defaults to 86400 seconds.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_after_seconds: Option<i64>,
/// The timestamp at which the Pix expires (between 10 and 1209600 seconds in the future).
/// Defaults to 1 day in the future.
#[serde(skip_serializing_if = "Option::is_none")]
pub expires_at: Option<stripe_types::Timestamp>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPix {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPix").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPix {
pub fn new() -> Self {
Self {
amount_includes_iof: None,
expires_after_seconds: None,
expires_at: None,
setup_future_usage: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPix {
fn default() -> Self {
Self::new()
}
}
/// Determines if the amount includes the IOF tax. Defaults to `never`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
Always,
Never,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof::*;
match self {
Always => "always",
Never => "never",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof::*;
match s {
"always" => Ok(Always),
"never" => Ok(Never),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsPixAmountIncludesIof {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsPixSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsPromptpay {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPromptpay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsPromptpay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsPromptpay {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsPromptpay {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `revolut_pay` PaymentMethod, this sub-hash contains details about the Revolut Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsRevolutPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsRevolutPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsRevolutPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPay {
pub fn new() -> Self {
Self { capture_method: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsRevolutPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsRevolutPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsRevolutPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `samsung_pay` PaymentMethod, this sub-hash contains details about the Samsung Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsSamsungPay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSamsungPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsSamsungPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsSamsungPay {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsSamsungPay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsSamsungPayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `satispay` PaymentMethod, this sub-hash contains details about the Satispay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsSatispay {
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[serde(skip_serializing_if = "Option::is_none")]
pub capture_method: Option<ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSatispay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsSatispay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsSatispay {
pub fn new() -> Self {
Self { capture_method: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsSatispay {
fn default() -> Self {
Self::new()
}
}
/// Controls when the funds are captured from the customer's account.
///
/// If provided, this parameter overrides the behavior of the top-level [capture_method](/api/payment_intents/update#update_payment_intent-capture_method) for this payment method type when finalizing the payment with this payment method type.
///
/// If `capture_method` is already set on the PaymentIntent, providing an empty value for this parameter unsets the stored value for this payment method type.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
Manual,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod::*;
match self {
Manual => "manual",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod::*;
match s {
"manual" => Ok(Manual),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsSatispayCaptureMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsSepaDebit {
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<ConfirmPaymentIntentPaymentMethodOptionsSepaDebitMandateOptions>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSepaDebit {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsSepaDebit").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsSepaDebit {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None, target_date: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsSepaDebit {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
/// Prefix used to generate the Mandate reference.
/// Must be at most 12 characters long.
/// Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'.
/// Cannot begin with 'STRIPE'.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference_prefix: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsSepaDebitMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
pub fn new() -> Self {
Self { reference_prefix: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsSepaDebitSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsSofort {
/// Language shown to the payer on redirect.
#[serde(skip_serializing_if = "Option::is_none")]
pub preferred_language: Option<ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofort {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsSofort").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsSofort {
pub fn new() -> Self {
Self { preferred_language: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsSofort {
fn default() -> Self {
Self::new()
}
}
/// Language shown to the payer on redirect.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
De,
En,
Es,
Fr,
It,
Nl,
Pl,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*;
match self {
De => "de",
En => "en",
Es => "es",
Fr => "fr",
It => "it",
Nl => "nl",
Pl => "pl",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage::*;
match s {
"de" => Ok(De),
"en" => Ok(En),
"es" => Ok(Es),
"fr" => Ok(Fr),
"it" => Ok(It),
"nl" => Ok(Nl),
"pl" => Ok(Pl),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsSofortPreferredLanguage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
None,
OffSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsSofortSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `Swish` PaymentMethod, this sub-hash contains details about the Swish payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsSwish {
/// A reference for this payment to be displayed in the Swish app.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSwish {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsSwish").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsSwish {
pub fn new() -> Self {
Self { reference: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsSwish {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsSwishSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `twint` PaymentMethod, this sub-hash contains details about the TWINT payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsTwint {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsTwint {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsTwint").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsTwint {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsTwint {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsTwintSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `upi` PaymentIntent, this sub-hash contains details about the UPI payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUpi {
/// Configuration options for setting up an eMandate
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options: Option<ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptions>,
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUpi {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsUpi").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUpi {
pub fn new() -> Self {
Self { mandate_options: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUpi {
fn default() -> Self {
Self::new()
}
}
/// Configuration options for setting up an eMandate
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptions {
/// Amount to be charged for future payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount_type: Option<ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType>,
/// A description of the mandate or subscription that is meant to be displayed to the customer.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// End date of the mandate or subscription.
#[serde(skip_serializing_if = "Option::is_none")]
pub end_date: Option<stripe_types::Timestamp>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptions {
pub fn new() -> Self {
Self { amount: None, amount_type: None, description: None, end_date: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// One of `fixed` or `maximum`.
/// If `fixed`, the `amount` param refers to the exact amount to be charged in future payments.
/// If `maximum`, the amount charged can be up to the value passed for the `amount` param.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
Fixed,
Maximum,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType::*;
match self {
Fixed => "fixed",
Maximum => "maximum",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType::*;
match s {
"fixed" => Ok(Fixed),
"maximum" => Ok(Maximum),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUpiMandateOptionsAmountType
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsUpiSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `us_bank_account` PaymentMethod, this sub-hash contains details about the US bank account payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount {
/// Additional fields for Financial Connections Session creation
#[serde(skip_serializing_if = "Option::is_none")]
pub financial_connections:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections>,
/// Additional fields for Mandate creation
#[serde(skip_serializing_if = "Option::is_none")]
pub mandate_options:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions>,
/// Additional fields for network related functions
#[serde(skip_serializing_if = "Option::is_none")]
pub networks: Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage>,
/// Controls when Stripe will attempt to debit the funds from the customer's account.
/// The date must be a string in YYYY-MM-DD format.
/// The date must be in the future and between 3 and 15 calendar days from now.
#[serde(skip_serializing_if = "Option::is_none")]
pub target_date: Option<String>,
/// The purpose of the transaction.
#[serde(skip_serializing_if = "Option::is_none")]
pub transaction_purpose:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose>,
/// Bank account verification method. The default value is `automatic`.
#[serde(skip_serializing_if = "Option::is_none")]
pub verification_method:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount {
pub fn new() -> Self {
Self {
financial_connections: None,
mandate_options: None,
networks: None,
setup_future_usage: None,
target_date: None,
transaction_purpose: None,
verification_method: None,
}
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccount {
fn default() -> Self {
Self::new()
}
}
/// Additional fields for Financial Connections Session creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
/// Provide filters for the linked accounts that the customer can select for the payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub filters:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters>,
/// The list of permissions to request.
/// If this parameter is passed, the `payment_method` permission must be included.
/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
#[serde(skip_serializing_if = "Option::is_none")]
pub permissions: Option<
Vec<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions>,
>,
/// List of data features that you would like to retrieve upon account creation.
#[serde(skip_serializing_if = "Option::is_none")]
pub prefetch: Option<
Vec<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch>,
>,
/// For webview integrations only.
/// Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
#[serde(skip_serializing_if = "Option::is_none")]
pub return_url: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
pub fn new() -> Self {
Self { filters: None, permissions: None, prefetch: None, return_url: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnections {
fn default() -> Self {
Self::new()
}
}
/// Provide filters for the linked accounts that the customer can select for the payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
/// The account subcategories to use to filter for selectable accounts.
/// Valid subcategories are `checking` and `savings`.
#[serde(skip_serializing_if = "Option::is_none")]
pub account_subcategories: Option<Vec<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters",
)
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
pub fn new() -> Self {
Self { account_subcategories: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFilters {
fn default() -> Self {
Self::new()
}
}
/// The account subcategories to use to filter for selectable accounts.
/// Valid subcategories are `checking` and `savings`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories
{
Checking,
Savings,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories::*;
match self {
Checking => "checking",
Savings => "savings",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories::*;
match s {
"checking" => Ok(Checking),
"savings" => Ok(Savings),
v => { tracing::warn!("Unknown value '{}' for enum '{}'", v, "ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories"); Ok(Unknown(v.to_owned())) }
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories)).finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: serde::Serializer {
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsFiltersAccountSubcategories {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The list of permissions to request.
/// If this parameter is passed, the `payment_method` permission must be included.
/// Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
Balances,
Ownership,
PaymentMethod,
Transactions,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*;
match self {
Balances => "balances",
Ownership => "ownership",
PaymentMethod => "payment_method",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions::*;
match s {
"balances" => Ok(Balances),
"ownership" => Ok(Ownership),
"payment_method" => Ok(PaymentMethod),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPermissions
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// List of data features that you would like to retrieve upon account creation.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
Balances,
Ownership,
Transactions,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*;
match self {
Balances => "balances",
Ownership => "ownership",
Transactions => "transactions",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch::*;
match s {
"balances" => Ok(Balances),
"ownership" => Ok(Ownership),
"transactions" => Ok(Transactions),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountFinancialConnectionsPrefetch
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Additional fields for Mandate creation
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
/// The method used to collect offline mandate customer acceptance.
#[serde(skip_serializing_if = "Option::is_none")]
pub collection_method:
Option<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
pub fn new() -> Self {
Self { collection_method: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptions {
fn default() -> Self {
Self::new()
}
}
/// The method used to collect offline mandate customer acceptance.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod {
Paper,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*;
match self {
Paper => "paper",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod::*;
match s {
"paper" => Ok(Paper),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountMandateOptionsCollectionMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Additional fields for network related functions
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
/// Triggers validations to run across the selected networks
#[serde(skip_serializing_if = "Option::is_none")]
pub requested:
Option<Vec<ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks")
.finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
pub fn new() -> Self {
Self { requested: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworks {
fn default() -> Self {
Self::new()
}
}
/// Triggers validations to run across the selected networks
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
Ach,
UsDomesticWire,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*;
match self {
Ach => "ach",
UsDomesticWire => "us_domestic_wire",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested::*;
match s {
"ach" => Ok(Ach),
"us_domestic_wire" => Ok(UsDomesticWire),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountNetworksRequested
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
None,
OffSession,
OnSession,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match self {
None => "none",
OffSession => "off_session",
OnSession => "on_session",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage::*;
match s {
"none" => Ok(None),
"off_session" => Ok(OffSession),
"on_session" => Ok(OnSession),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountSetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// The purpose of the transaction.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
Goods,
Other,
Services,
Unspecified,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match self {
Goods => "goods",
Other => "other",
Services => "services",
Unspecified => "unspecified",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose::*;
match s {
"goods" => Ok(Goods),
"other" => Ok(Other),
"services" => Ok(Services),
"unspecified" => Ok(Unspecified),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountTransactionPurpose
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Bank account verification method. The default value is `automatic`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
Automatic,
Instant,
Microdeposits,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match self {
Automatic => "automatic",
Instant => "instant",
Microdeposits => "microdeposits",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod::*;
match s {
"automatic" => Ok(Automatic),
"instant" => Ok(Instant),
"microdeposits" => Ok(Microdeposits),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsUsBankAccountVerificationMethod
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `wechat_pay` PaymentMethod, this sub-hash contains details about the WeChat Pay payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsWechatPay {
/// The app ID registered with WeChat Pay. Only required when client is ios or android.
#[serde(skip_serializing_if = "Option::is_none")]
pub app_id: Option<String>,
/// The client type that the end customer will pay from
#[serde(skip_serializing_if = "Option::is_none")]
pub client: Option<ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient>,
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage:
Option<ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPay {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsWechatPay").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsWechatPay {
pub fn new() -> Self {
Self { app_id: None, client: None, setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsWechatPay {
fn default() -> Self {
Self::new()
}
}
/// The client type that the end customer will pay from
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
Android,
Ios,
Web,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient::*;
match self {
Android => "android",
Ios => "ios",
Web => "web",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient::*;
match s {
"android" => Ok(Android),
"ios" => Ok(Ios),
"web" => Ok(Web),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsWechatPayClient {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(
ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage
))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for ConfirmPaymentIntentPaymentMethodOptionsWechatPaySetupFutureUsage
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// If this is a `zip` PaymentMethod, this sub-hash contains details about the Zip payment method options.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentPaymentMethodOptionsZip {
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[serde(skip_serializing_if = "Option::is_none")]
pub setup_future_usage: Option<ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsZip {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentPaymentMethodOptionsZip").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentPaymentMethodOptionsZip {
pub fn new() -> Self {
Self { setup_future_usage: None }
}
}
impl Default for ConfirmPaymentIntentPaymentMethodOptionsZip {
fn default() -> Self {
Self::new()
}
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
None,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
pub fn as_str(&self) -> &str {
use ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*;
match self {
None => "none",
Unknown(v) => v,
}
}
}
impl std::str::FromStr for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage::*;
match s {
"none" => Ok(None),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage))
.finish_non_exhaustive()
}
}
impl serde::Serialize for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de> for ConfirmPaymentIntentPaymentMethodOptionsZipSetupFutureUsage {
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Options to configure Radar.
/// Learn more about [Radar Sessions](https://docs.stripe.com/radar/radar-session).
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentRadarOptions {
/// A [Radar Session](https://docs.stripe.com/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments.
#[serde(skip_serializing_if = "Option::is_none")]
pub session: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentRadarOptions {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentRadarOptions").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentRadarOptions {
pub fn new() -> Self {
Self { session: None }
}
}
impl Default for ConfirmPaymentIntentRadarOptions {
fn default() -> Self {
Self::new()
}
}
/// Shipping information for this PaymentIntent.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentShipping {
/// Shipping address.
pub address: ConfirmPaymentIntentShippingAddress,
/// The delivery service that shipped a physical product, such as Fedex, UPS, USPS, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub carrier: Option<String>,
/// Recipient name.
pub name: String,
/// Recipient phone (including extension).
#[serde(skip_serializing_if = "Option::is_none")]
pub phone: Option<String>,
/// The tracking number for a physical product, obtained from the delivery service.
/// If multiple tracking numbers were generated for this purchase, please separate them with commas.
#[serde(skip_serializing_if = "Option::is_none")]
pub tracking_number: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentShipping {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentShipping").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentShipping {
pub fn new(
address: impl Into<ConfirmPaymentIntentShippingAddress>,
name: impl Into<String>,
) -> Self {
Self {
address: address.into(),
carrier: None,
name: name.into(),
phone: None,
tracking_number: None,
}
}
}
/// Shipping address.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntentShippingAddress {
/// City, district, suburb, town, or village.
#[serde(skip_serializing_if = "Option::is_none")]
pub city: Option<String>,
/// Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub country: Option<String>,
/// Address line 1, such as the street, PO Box, or company name.
#[serde(skip_serializing_if = "Option::is_none")]
pub line1: Option<String>,
/// Address line 2, such as the apartment, suite, unit, or building.
#[serde(skip_serializing_if = "Option::is_none")]
pub line2: Option<String>,
/// ZIP or postal code.
#[serde(skip_serializing_if = "Option::is_none")]
pub postal_code: Option<String>,
/// State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
#[serde(skip_serializing_if = "Option::is_none")]
pub state: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntentShippingAddress {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntentShippingAddress").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntentShippingAddress {
pub fn new() -> Self {
Self { city: None, country: None, line1: None, line2: None, postal_code: None, state: None }
}
}
impl Default for ConfirmPaymentIntentShippingAddress {
fn default() -> Self {
Self::new()
}
}
/// Confirm that your customer intends to pay with current or provided
/// payment method. Upon confirmation, the PaymentIntent will attempt to initiate
/// a payment.
///
/// If the selected payment method requires additional authentication steps, the
/// PaymentIntent will transition to the `requires_action` status and
/// suggest additional actions via `next_action`. If payment fails,
/// the PaymentIntent transitions to the `requires_payment_method` status or the
/// `canceled` status if the confirmation limit is reached. If
/// payment succeeds, the PaymentIntent will transition to the `succeeded`
/// status (or `requires_capture`, if `capture_method` is set to `manual`).
///
/// If the `confirmation_method` is `automatic`, payment may be attempted
/// using our [client SDKs](https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment)
/// and the PaymentIntent’s [client_secret](https://stripe.com/docs/api#payment_intent_object-client_secret).
/// After `next_action`s are handled by the client, no additional
/// confirmation is required to complete the payment.
///
/// If the `confirmation_method` is `manual`, all payment attempts must be
/// initiated using a secret key.
///
/// If any actions are required for the payment, the PaymentIntent will
/// return to the `requires_confirmation` state
/// after those actions are completed. Your server needs to then
/// explicitly re-confirm the PaymentIntent to initiate the next payment
/// attempt.
///
/// There is a variable upper limit on how many times a PaymentIntent can be confirmed.
/// After this limit is reached, any further calls to this endpoint will
/// transition the PaymentIntent to the `canceled` state.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct ConfirmPaymentIntent {
inner: ConfirmPaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for ConfirmPaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("ConfirmPaymentIntent").finish_non_exhaustive()
}
}
impl ConfirmPaymentIntent {
/// Construct a new `ConfirmPaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: ConfirmPaymentIntentBuilder::new() }
}
/// Provides industry-specific information about the amount.
pub fn amount_details(
mut self,
amount_details: impl Into<ConfirmPaymentIntentAmountDetails>,
) -> Self {
self.inner.amount_details = Some(amount_details.into());
self
}
/// Controls when the funds will be captured from the customer's account.
pub fn capture_method(
mut self,
capture_method: impl Into<stripe_shared::PaymentIntentCaptureMethod>,
) -> Self {
self.inner.capture_method = Some(capture_method.into());
self
}
/// ID of the ConfirmationToken used to confirm this PaymentIntent.
///
/// If the provided ConfirmationToken contains properties that are also being provided in this request, such as `payment_method`, then the values in this request will take precedence.
pub fn confirmation_token(mut self, confirmation_token: impl Into<String>) -> Self {
self.inner.confirmation_token = Some(confirmation_token.into());
self
}
/// Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`.
/// This parameter is intended for simpler integrations that do not handle customer actions, like [saving cards without authentication](https://docs.stripe.com/payments/save-card-without-authentication).
pub fn error_on_requires_action(mut self, error_on_requires_action: impl Into<bool>) -> Self {
self.inner.error_on_requires_action = Some(error_on_requires_action.into());
self
}
/// The list of payment method types to exclude from use with this payment.
pub fn excluded_payment_method_types(
mut self,
excluded_payment_method_types: impl Into<
Vec<stripe_shared::PaymentIntentExcludedPaymentMethodTypes>,
>,
) -> Self {
self.inner.excluded_payment_method_types = Some(excluded_payment_method_types.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// Automations to be run during the PaymentIntent lifecycle
pub fn hooks(mut self, hooks: impl Into<AsyncWorkflowsParam>) -> Self {
self.inner.hooks = Some(hooks.into());
self
}
/// ID of the mandate that's used for this payment.
pub fn mandate(mut self, mandate: impl Into<String>) -> Self {
self.inner.mandate = Some(mandate.into());
self
}
pub fn mandate_data(
mut self,
mandate_data: impl Into<ConfirmPaymentIntentMandateData>,
) -> Self {
self.inner.mandate_data = Some(mandate_data.into());
self
}
/// Set to `true` to indicate that the customer isn't in your checkout flow during this payment attempt and can't authenticate.
/// Use this parameter in scenarios where you collect card details and [charge them later](https://docs.stripe.com/payments/cards/charging-saved-cards).
pub fn off_session(mut self, off_session: impl Into<ConfirmPaymentIntentOffSession>) -> Self {
self.inner.off_session = Some(off_session.into());
self
}
/// Provides industry-specific information about the charge.
pub fn payment_details(
mut self,
payment_details: impl Into<ConfirmPaymentIntentPaymentDetails>,
) -> Self {
self.inner.payment_details = Some(payment_details.into());
self
}
/// ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://docs.stripe.com/payments/payment-methods/transitioning#compatibility) object) to attach to this PaymentIntent.
/// If the payment method is attached to a Customer, it must match the [customer](https://api.stripe.com#create_payment_intent-customer) that is set on this PaymentIntent.
pub fn payment_method(mut self, payment_method: impl Into<String>) -> Self {
self.inner.payment_method = Some(payment_method.into());
self
}
/// If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear
/// in the [payment_method](https://docs.stripe.com/api/payment_intents/object#payment_intent_object-payment_method).
/// property on the PaymentIntent.
pub fn payment_method_data(
mut self,
payment_method_data: impl Into<ConfirmPaymentIntentPaymentMethodData>,
) -> Self {
self.inner.payment_method_data = Some(payment_method_data.into());
self
}
/// Payment method-specific configuration for this PaymentIntent.
pub fn payment_method_options(
mut self,
payment_method_options: impl Into<ConfirmPaymentIntentPaymentMethodOptions>,
) -> Self {
self.inner.payment_method_options = Some(payment_method_options.into());
self
}
/// The list of payment method types (for example, a card) that this PaymentIntent can use.
/// Use `automatic_payment_methods` to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods).
/// A list of valid payment method types can be found [here](https://docs.stripe.com/api/payment_methods/object#payment_method_object-type).
pub fn payment_method_types(mut self, payment_method_types: impl Into<Vec<String>>) -> Self {
self.inner.payment_method_types = Some(payment_method_types.into());
self
}
/// Options to configure Radar.
/// Learn more about [Radar Sessions](https://docs.stripe.com/radar/radar-session).
pub fn radar_options(
mut self,
radar_options: impl Into<ConfirmPaymentIntentRadarOptions>,
) -> Self {
self.inner.radar_options = Some(radar_options.into());
self
}
/// Email address that the receipt for the resulting payment will be sent to.
/// If `receipt_email` is specified for a payment in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails).
pub fn receipt_email(mut self, receipt_email: impl Into<String>) -> Self {
self.inner.receipt_email = Some(receipt_email.into());
self
}
/// The URL to redirect your customer back to after they authenticate or cancel their payment on the payment method's app or site.
/// If you'd prefer to redirect to a mobile application, you can alternatively supply an application URI scheme.
/// This parameter is only used for cards and other redirect-based payment methods.
pub fn return_url(mut self, return_url: impl Into<String>) -> Self {
self.inner.return_url = Some(return_url.into());
self
}
/// Indicates that you intend to make future payments with this PaymentIntent's payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this parameter to [attach the payment method](/payments/save-during-payment) to the Customer after the PaymentIntent is confirmed and the customer completes any required actions.
/// If you don't provide a Customer, you can still [attach](/api/payment_methods/attach) the payment method to a Customer after the transaction completes.
///
/// If the payment method is `card_present` and isn't a digital wallet, Stripe creates and attaches a [generated_card](/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card to the Customer instead.
///
/// When processing card payments, Stripe uses `setup_future_usage` to help you comply with regional legislation and network rules, such as [SCA](/strong-customer-authentication).
///
/// If you've already set `setup_future_usage` and you're performing a request using a publishable key, you can only update the value from `on_session` to `off_session`.
pub fn setup_future_usage(
mut self,
setup_future_usage: impl Into<stripe_shared::PaymentIntentSetupFutureUsage>,
) -> Self {
self.inner.setup_future_usage = Some(setup_future_usage.into());
self
}
/// Shipping information for this PaymentIntent.
pub fn shipping(mut self, shipping: impl Into<ConfirmPaymentIntentShipping>) -> Self {
self.inner.shipping = Some(shipping.into());
self
}
/// Set to `true` when confirming server-side and using Stripe.js, iOS, or Android client-side SDKs to handle the next actions.
pub fn use_stripe_sdk(mut self, use_stripe_sdk: impl Into<bool>) -> Self {
self.inner.use_stripe_sdk = Some(use_stripe_sdk.into());
self
}
}
impl ConfirmPaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for ConfirmPaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(StripeMethod::Post, format!("/payment_intents/{intent}/confirm"))
.form(&self.inner)
}
}
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct IncrementAuthorizationPaymentIntentBuilder {
amount: i64,
#[serde(skip_serializing_if = "Option::is_none")]
amount_details: Option<IncrementAuthorizationPaymentIntentAmountDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
application_fee_amount: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
description: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
#[serde(skip_serializing_if = "Option::is_none")]
hooks: Option<AsyncWorkflowsParam>,
#[serde(skip_serializing_if = "Option::is_none")]
metadata: Option<std::collections::HashMap<String, String>>,
#[serde(skip_serializing_if = "Option::is_none")]
payment_details: Option<IncrementAuthorizationPaymentIntentPaymentDetails>,
#[serde(skip_serializing_if = "Option::is_none")]
statement_descriptor: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
transfer_data: Option<IncrementAuthorizationPaymentIntentTransferData>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for IncrementAuthorizationPaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntentBuilder").finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentBuilder {
fn new(amount: impl Into<i64>) -> Self {
Self {
amount: amount.into(),
amount_details: None,
application_fee_amount: None,
description: None,
expand: None,
hooks: None,
metadata: None,
payment_details: None,
statement_descriptor: None,
transfer_data: None,
}
}
}
/// Provides industry-specific information about the amount.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentAmountDetails {
/// The total discount applied on the transaction represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[line_items][#][discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Set to `false` to return arithmetic validation errors in the response without failing the request.
/// Use this when you want the operation to proceed regardless of arithmetic errors in the line item data.
///
/// Omit or set to `true` to immediately return a 400 error when arithmetic validation fails.
/// Use this for strict validation that prevents processing with line item data that has arithmetic inconsistencies.
///
/// For card payments, Stripe doesn't send line item data to card networks if there's an arithmetic validation error.
#[serde(skip_serializing_if = "Option::is_none")]
pub enforce_arithmetic_validation: Option<bool>,
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub line_items: Option<Vec<IncrementAuthorizationPaymentIntentAmountDetailsLineItems>>,
/// Contains information about the shipping portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub shipping: Option<AmountDetailsShippingParam>,
/// Contains information about the tax portion of the amount.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsTaxParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for IncrementAuthorizationPaymentIntentAmountDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntentAmountDetails").finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentAmountDetails {
pub fn new() -> Self {
Self {
discount_amount: None,
enforce_arithmetic_validation: None,
line_items: None,
shipping: None,
tax: None,
}
}
}
impl Default for IncrementAuthorizationPaymentIntentAmountDetails {
fn default() -> Self {
Self::new()
}
}
/// A list of line items, each containing information about a product in the PaymentIntent.
/// There is a maximum of 200 line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentAmountDetailsLineItems {
/// The discount applied on this line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than 0.
///
/// This field is mutually exclusive with the `amount_details[discount_amount]` field.
#[serde(skip_serializing_if = "Option::is_none")]
pub discount_amount: Option<i64>,
/// Payment method-specific information for line items.
#[serde(skip_serializing_if = "Option::is_none")]
pub payment_method_options:
Option<IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptions>,
/// The product code of the line item, such as an SKU.
/// Required for L3 rates.
/// At most 12 characters long.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_code: Option<String>,
/// The product name of the line item. Required for L3 rates. At most 1024 characters long.
///
/// For Cards, this field is truncated to 26 alphanumeric characters before being sent to the card networks.
/// For PayPal, this field is truncated to 127 characters.
pub product_name: String,
/// The quantity of items. Required for L3 rates. An integer greater than 0.
pub quantity: u64,
/// Contains information about the tax on the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AmountDetailsLineItemTaxParam>,
/// The unit cost of the line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L3 rates.
/// An integer greater than or equal to 0.
pub unit_cost: i64,
/// A unit of measure for the line item, such as gallons, feet, meters, etc.
#[serde(skip_serializing_if = "Option::is_none")]
pub unit_of_measure: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for IncrementAuthorizationPaymentIntentAmountDetailsLineItems {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntentAmountDetailsLineItems")
.finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentAmountDetailsLineItems {
pub fn new(
product_name: impl Into<String>,
quantity: impl Into<u64>,
unit_cost: impl Into<i64>,
) -> Self {
Self {
discount_amount: None,
payment_method_options: None,
product_code: None,
product_name: product_name.into(),
quantity: quantity.into(),
tax: None,
unit_cost: unit_cost.into(),
unit_of_measure: None,
}
}
}
/// Payment method-specific information for line items.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card:
Option<IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard>,
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub card_present: Option<
IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent,
>,
/// This sub-hash contains line item details that are specific to the `klarna` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub klarna: Option<PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam>,
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[serde(skip_serializing_if = "Option::is_none")]
pub paypal:
Option<IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptions
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptions",
)
.finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
pub fn new() -> Self {
Self { card: None, card_present: None, klarna: None, paypal: None }
}
}
impl Default for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptions {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard",
)
.finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCard {
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `card_present` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent
{
/// Identifier that categorizes the items being purchased using a standardized commodity scheme such as (but not limited to) UNSPSC, NAICS, NAPCS, and so on.
#[serde(skip_serializing_if = "Option::is_none")]
pub commodity_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent").finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent {
pub fn new() -> Self {
Self { commodity_code: None }
}
}
impl Default
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsCardPresent
{
fn default() -> Self {
Self::new()
}
}
/// This sub-hash contains line item details that are specific to the `paypal` payment method.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
/// Type of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub category: Option<
IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory,
>,
/// Description of the line item.
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
/// The Stripe account ID of the connected account that sells the item.
#[serde(skip_serializing_if = "Option::is_none")]
pub sold_by: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(
"IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal",
)
.finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal {
pub fn new() -> Self {
Self { category: None, description: None, sold_by: None }
}
}
impl Default
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypal
{
fn default() -> Self {
Self::new()
}
}
/// Type of the line item.
#[derive(Clone, Eq, PartialEq)]
#[non_exhaustive]
pub enum IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
DigitalGoods,
Donation,
PhysicalGoods,
/// An unrecognized value from Stripe. Should not be used as a request parameter.
Unknown(String),
}
impl IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory {
pub fn as_str(&self) -> &str {
use IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match self {
DigitalGoods => "digital_goods",
Donation => "donation",
PhysicalGoods => "physical_goods",
Unknown(v) => v,
}
}
}
impl std::str::FromStr
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
type Err = std::convert::Infallible;
fn from_str(s: &str) -> Result<Self, Self::Err> {
use IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory::*;
match s {
"digital_goods" => Ok(DigitalGoods),
"donation" => Ok(Donation),
"physical_goods" => Ok(PhysicalGoods),
v => {
tracing::warn!(
"Unknown value '{}' for enum '{}'",
v,
"IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory"
);
Ok(Unknown(v.to_owned()))
}
}
}
}
impl std::fmt::Display
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(not(feature = "redact-generated-debug"))]
impl std::fmt::Debug
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct(stringify!(IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory)).finish_non_exhaustive()
}
}
impl serde::Serialize
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
serializer.serialize_str(self.as_str())
}
}
#[cfg(feature = "deserialize")]
impl<'de> serde::Deserialize<'de>
for IncrementAuthorizationPaymentIntentAmountDetailsLineItemsPaymentMethodOptionsPaypalCategory
{
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use std::str::FromStr;
let s: std::borrow::Cow<'de, str> = serde::Deserialize::deserialize(deserializer)?;
Ok(Self::from_str(&s).expect("infallible"))
}
}
/// Provides industry-specific information about the charge.
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentPaymentDetails {
/// A unique value to identify the customer. This field is available only for card payments.
///
/// This field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
#[serde(skip_serializing_if = "Option::is_none")]
pub customer_reference: Option<String>,
/// A unique value assigned by the business to identify the transaction. Required for L2 and L3 rates.
///
/// For Cards, this field is truncated to 25 alphanumeric characters, excluding spaces, before being sent to card networks.
/// For Klarna, this field is truncated to 255 characters and is visible to customers when they view the order in the Klarna app.
#[serde(skip_serializing_if = "Option::is_none")]
pub order_reference: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for IncrementAuthorizationPaymentIntentPaymentDetails {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntentPaymentDetails").finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentPaymentDetails {
pub fn new() -> Self {
Self { customer_reference: None, order_reference: None }
}
}
impl Default for IncrementAuthorizationPaymentIntentPaymentDetails {
fn default() -> Self {
Self::new()
}
}
/// The parameters used to automatically create a transfer after the payment is captured.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntentTransferData {
/// The amount that will be transferred automatically when a charge succeeds.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for IncrementAuthorizationPaymentIntentTransferData {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntentTransferData").finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntentTransferData {
pub fn new() -> Self {
Self { amount: None }
}
}
impl Default for IncrementAuthorizationPaymentIntentTransferData {
fn default() -> Self {
Self::new()
}
}
/// Perform an incremental authorization on an eligible
/// [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
/// PaymentIntent’s status must be `requires_capture` and
/// [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported).
/// must be `true`.
///
/// Incremental authorizations attempt to increase the authorized amount on
/// your customer’s card to the new, higher `amount` provided. Similar to the
/// initial authorization, incremental authorizations can be declined. A
/// single PaymentIntent can call this endpoint multiple times to further
/// increase the authorized amount.
///
/// If the incremental authorization succeeds, the PaymentIntent object
/// returns with the updated
/// [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
/// If the incremental authorization fails, a
/// [card_declined](https://stripe.com/docs/error-codes#card-declined) error returns, and no other
/// fields on the PaymentIntent or Charge update. The PaymentIntent
/// object remains capturable for the previously authorized amount.
///
/// Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
/// After it’s captured, a PaymentIntent can no longer be incremented.
///
/// Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct IncrementAuthorizationPaymentIntent {
inner: IncrementAuthorizationPaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for IncrementAuthorizationPaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("IncrementAuthorizationPaymentIntent").finish_non_exhaustive()
}
}
impl IncrementAuthorizationPaymentIntent {
/// Construct a new `IncrementAuthorizationPaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>, amount: impl Into<i64>) -> Self {
Self {
intent: intent.into(),
inner: IncrementAuthorizationPaymentIntentBuilder::new(amount.into()),
}
}
/// Provides industry-specific information about the amount.
pub fn amount_details(
mut self,
amount_details: impl Into<IncrementAuthorizationPaymentIntentAmountDetails>,
) -> Self {
self.inner.amount_details = Some(amount_details.into());
self
}
/// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account.
/// The amount of the application fee collected will be capped at the total amount captured.
/// For more information, see the PaymentIntents [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn application_fee_amount(mut self, application_fee_amount: impl Into<i64>) -> Self {
self.inner.application_fee_amount = Some(application_fee_amount.into());
self
}
/// An arbitrary string attached to the object. Often useful for displaying to users.
pub fn description(mut self, description: impl Into<String>) -> Self {
self.inner.description = Some(description.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
/// Automations to be run during the PaymentIntent lifecycle
pub fn hooks(mut self, hooks: impl Into<AsyncWorkflowsParam>) -> Self {
self.inner.hooks = Some(hooks.into());
self
}
/// Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object.
/// This can be useful for storing additional information about the object in a structured format.
/// Individual keys can be unset by posting an empty value to them.
/// All keys can be unset by posting an empty value to `metadata`.
pub fn metadata(
mut self,
metadata: impl Into<std::collections::HashMap<String, String>>,
) -> Self {
self.inner.metadata = Some(metadata.into());
self
}
/// Provides industry-specific information about the charge.
pub fn payment_details(
mut self,
payment_details: impl Into<IncrementAuthorizationPaymentIntentPaymentDetails>,
) -> Self {
self.inner.payment_details = Some(payment_details.into());
self
}
/// Text that appears on the customer's statement as the statement descriptor for a non-card or card charge.
/// This value overrides the account's default statement descriptor.
/// For information about requirements, including the 22-character limit, see [the Statement Descriptor docs](https://docs.stripe.com/get-started/account/statement-descriptors).
pub fn statement_descriptor(mut self, statement_descriptor: impl Into<String>) -> Self {
self.inner.statement_descriptor = Some(statement_descriptor.into());
self
}
/// The parameters used to automatically create a transfer after the payment is captured.
/// Learn more about the [use case for connected accounts](https://docs.stripe.com/payments/connected-accounts).
pub fn transfer_data(
mut self,
transfer_data: impl Into<IncrementAuthorizationPaymentIntentTransferData>,
) -> Self {
self.inner.transfer_data = Some(transfer_data.into());
self
}
}
impl IncrementAuthorizationPaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for IncrementAuthorizationPaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(
StripeMethod::Post,
format!("/payment_intents/{intent}/increment_authorization"),
)
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
struct VerifyMicrodepositsPaymentIntentBuilder {
#[serde(skip_serializing_if = "Option::is_none")]
amounts: Option<Vec<i64>>,
#[serde(skip_serializing_if = "Option::is_none")]
descriptor_code: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
expand: Option<Vec<String>>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for VerifyMicrodepositsPaymentIntentBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("VerifyMicrodepositsPaymentIntentBuilder").finish_non_exhaustive()
}
}
impl VerifyMicrodepositsPaymentIntentBuilder {
fn new() -> Self {
Self { amounts: None, descriptor_code: None, expand: None }
}
}
/// Verifies microdeposits on a PaymentIntent object.
#[derive(Clone)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct VerifyMicrodepositsPaymentIntent {
inner: VerifyMicrodepositsPaymentIntentBuilder,
intent: stripe_shared::PaymentIntentId,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for VerifyMicrodepositsPaymentIntent {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("VerifyMicrodepositsPaymentIntent").finish_non_exhaustive()
}
}
impl VerifyMicrodepositsPaymentIntent {
/// Construct a new `VerifyMicrodepositsPaymentIntent`.
pub fn new(intent: impl Into<stripe_shared::PaymentIntentId>) -> Self {
Self { intent: intent.into(), inner: VerifyMicrodepositsPaymentIntentBuilder::new() }
}
/// Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account.
pub fn amounts(mut self, amounts: impl Into<Vec<i64>>) -> Self {
self.inner.amounts = Some(amounts.into());
self
}
/// A six-character code starting with SM present in the microdeposit sent to the bank account.
pub fn descriptor_code(mut self, descriptor_code: impl Into<String>) -> Self {
self.inner.descriptor_code = Some(descriptor_code.into());
self
}
/// Specifies which fields in the response should be expanded.
pub fn expand(mut self, expand: impl Into<Vec<String>>) -> Self {
self.inner.expand = Some(expand.into());
self
}
}
impl VerifyMicrodepositsPaymentIntent {
/// Send the request and return the deserialized response.
pub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send(client).await
}
/// Send the request and return the deserialized response, blocking until completion.
pub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err> {
self.customize().send_blocking(client)
}
}
impl StripeRequest for VerifyMicrodepositsPaymentIntent {
type Output = stripe_shared::PaymentIntent;
fn build(&self) -> RequestBuilder {
let intent = &self.intent;
RequestBuilder::new(
StripeMethod::Post,
format!("/payment_intents/{intent}/verify_microdeposits"),
)
.form(&self.inner)
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam {
/// URL to an image for the product. Max length, 4096 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_url: Option<String>,
/// URL to the product page. Max length, 4096 characters.
#[serde(skip_serializing_if = "Option::is_none")]
pub product_url: Option<String>,
/// Unique reference for this line item to correlate it with your system’s internal records.
/// The field is displayed in the Klarna Consumer App if passed.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference: Option<String>,
/// Reference for the subscription this line item is for.
#[serde(skip_serializing_if = "Option::is_none")]
pub subscription_reference: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam")
.finish_non_exhaustive()
}
}
impl PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam {
pub fn new() -> Self {
Self { image_url: None, product_url: None, reference: None, subscription_reference: None }
}
}
impl Default for PaymentIntentAmountDetailsLineItemPaymentMethodOptionsParam {
fn default() -> Self {
Self::new()
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct AmountDetailsLineItemTaxParam {
/// The total amount of tax on a single line item represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L3 rates.
/// An integer greater than or equal to 0.
///
/// This field is mutually exclusive with the `amount_details[tax][total_tax_amount]` field.
pub total_tax_amount: i64,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for AmountDetailsLineItemTaxParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("AmountDetailsLineItemTaxParam").finish_non_exhaustive()
}
}
impl AmountDetailsLineItemTaxParam {
pub fn new(total_tax_amount: impl Into<i64>) -> Self {
Self { total_tax_amount: total_tax_amount.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct AmountDetailsShippingParam {
/// If a physical good is being shipped, the cost of shipping represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// An integer greater than or equal to 0.
#[serde(skip_serializing_if = "Option::is_none")]
pub amount: Option<i64>,
/// If a physical good is being shipped, the postal code of where it is being shipped from.
/// At most 10 alphanumeric characters long, hyphens are allowed.
#[serde(skip_serializing_if = "Option::is_none")]
pub from_postal_code: Option<String>,
/// If a physical good is being shipped, the postal code of where it is being shipped to.
/// At most 10 alphanumeric characters long, hyphens are allowed.
#[serde(skip_serializing_if = "Option::is_none")]
pub to_postal_code: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for AmountDetailsShippingParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("AmountDetailsShippingParam").finish_non_exhaustive()
}
}
impl AmountDetailsShippingParam {
pub fn new() -> Self {
Self { amount: None, from_postal_code: None, to_postal_code: None }
}
}
impl Default for AmountDetailsShippingParam {
fn default() -> Self {
Self::new()
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct AmountDetailsTaxParam {
/// The total amount of tax on the transaction represented in the [smallest currency unit](https://docs.stripe.com/currencies#zero-decimal).
/// Required for L2 rates.
/// An integer greater than or equal to 0.
///
/// This field is mutually exclusive with the `amount_details[line_items][#][tax][total_tax_amount]` field.
pub total_tax_amount: i64,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for AmountDetailsTaxParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("AmountDetailsTaxParam").finish_non_exhaustive()
}
}
impl AmountDetailsTaxParam {
pub fn new(total_tax_amount: impl Into<i64>) -> Self {
Self { total_tax_amount: total_tax_amount.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct AsyncWorkflowsInputsTaxParam {
/// The [TaxCalculation](https://docs.stripe.com/api/tax/calculations) id
pub calculation: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for AsyncWorkflowsInputsTaxParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("AsyncWorkflowsInputsTaxParam").finish_non_exhaustive()
}
}
impl AsyncWorkflowsInputsTaxParam {
pub fn new(calculation: impl Into<String>) -> Self {
Self { calculation: calculation.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct OnlineParam {
/// The IP address from which the Mandate was accepted by the customer.
pub ip_address: String,
/// The user agent of the browser from which the Mandate was accepted by the customer.
pub user_agent: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for OnlineParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("OnlineParam").finish_non_exhaustive()
}
}
impl OnlineParam {
pub fn new(ip_address: impl Into<String>, user_agent: impl Into<String>) -> Self {
Self { ip_address: ip_address.into(), user_agent: user_agent.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct PaymentMethodParam {
/// Customer's bank account number.
pub account_number: String,
/// Institution number of the customer's bank.
pub institution_number: String,
/// Transit number of the customer's bank.
pub transit_number: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for PaymentMethodParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PaymentMethodParam").finish_non_exhaustive()
}
}
impl PaymentMethodParam {
pub fn new(
account_number: impl Into<String>,
institution_number: impl Into<String>,
transit_number: impl Into<String>,
) -> Self {
Self {
account_number: account_number.into(),
institution_number: institution_number.into(),
transit_number: transit_number.into(),
}
}
}
#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct DateOfBirth {
/// The day of birth, between 1 and 31.
pub day: i64,
/// The month of birth, between 1 and 12.
pub month: i64,
/// The four-digit year of birth.
pub year: i64,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for DateOfBirth {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("DateOfBirth").finish_non_exhaustive()
}
}
impl DateOfBirth {
pub fn new(day: impl Into<i64>, month: impl Into<i64>, year: impl Into<i64>) -> Self {
Self { day: day.into(), month: month.into(), year: year.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct PaymentMethodOptionsMandateOptionsParam {
/// Prefix used to generate the Mandate reference.
/// Must be at most 12 characters long.
/// Must consist of only uppercase letters, numbers, spaces, or the following special characters: '/', '_', '-', '&', '.'.
/// Cannot begin with 'DDIC' or 'STRIPE'.
#[serde(skip_serializing_if = "Option::is_none")]
pub reference_prefix: Option<String>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for PaymentMethodOptionsMandateOptionsParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("PaymentMethodOptionsMandateOptionsParam").finish_non_exhaustive()
}
}
impl PaymentMethodOptionsMandateOptionsParam {
pub fn new() -> Self {
Self { reference_prefix: None }
}
}
impl Default for PaymentMethodOptionsMandateOptionsParam {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct EuBankTransferParams {
/// The desired country code of the bank account information.
/// Permitted values include: `DE`, `FR`, `IE`, or `NL`.
pub country: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for EuBankTransferParams {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("EuBankTransferParams").finish_non_exhaustive()
}
}
impl EuBankTransferParams {
pub fn new(country: impl Into<String>) -> Self {
Self { country: country.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct SubscriptionNextBillingParam {
/// The amount of the next charge for the subscription.
pub amount: i64,
/// The date of the next charge for the subscription in YYYY-MM-DD format.
pub date: String,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for SubscriptionNextBillingParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("SubscriptionNextBillingParam").finish_non_exhaustive()
}
}
impl SubscriptionNextBillingParam {
pub fn new(amount: impl Into<i64>, date: impl Into<String>) -> Self {
Self { amount: amount.into(), date: date.into() }
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct AsyncWorkflowsInputsParam {
/// Tax arguments for automations
#[serde(skip_serializing_if = "Option::is_none")]
pub tax: Option<AsyncWorkflowsInputsTaxParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for AsyncWorkflowsInputsParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("AsyncWorkflowsInputsParam").finish_non_exhaustive()
}
}
impl AsyncWorkflowsInputsParam {
pub fn new() -> Self {
Self { tax: None }
}
}
impl Default for AsyncWorkflowsInputsParam {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Eq, PartialEq)]
#[cfg_attr(not(feature = "redact-generated-debug"), derive(Debug))]
#[derive(serde::Serialize)]
pub struct AsyncWorkflowsParam {
/// Arguments passed in automations
#[serde(skip_serializing_if = "Option::is_none")]
pub inputs: Option<AsyncWorkflowsInputsParam>,
}
#[cfg(feature = "redact-generated-debug")]
impl std::fmt::Debug for AsyncWorkflowsParam {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.debug_struct("AsyncWorkflowsParam").finish_non_exhaustive()
}
}
impl AsyncWorkflowsParam {
pub fn new() -> Self {
Self { inputs: None }
}
}
impl Default for AsyncWorkflowsParam {
fn default() -> Self {
Self::new()
}
}