pub struct AttachPaymentMethod { /* private fields */ }Expand description
Attaches a PaymentMethod object to a Customer.
To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntent.
or a PaymentIntent with setup_future_usage.
These approaches will perform any necessary steps to set up the PaymentMethod for future payments.
Using the /v1/payment_methods/:id/attach.
endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage does not optimize the PaymentMethod for.
future use, which makes later declines and payment friction more likely.
See Optimizing cards for future payments for more information about setting up.
future payments.
To use this PaymentMethod as the default for invoice or subscription payments,
set invoice_settings.default_payment_method,.
on the Customer to the PaymentMethod’s ID.
Implementations§
Source§impl AttachPaymentMethod
impl AttachPaymentMethod
Sourcepub fn new(payment_method: impl Into<PaymentMethodId>) -> Self
pub fn new(payment_method: impl Into<PaymentMethodId>) -> Self
Construct a new AttachPaymentMethod.
Sourcepub fn customer(self, customer: impl Into<String>) -> Self
pub fn customer(self, customer: impl Into<String>) -> Self
The ID of the customer to which to attach the PaymentMethod.
Sourcepub fn customer_account(self, customer_account: impl Into<String>) -> Self
pub fn customer_account(self, customer_account: impl Into<String>) -> Self
The ID of the Account representing the customer to which to attach the PaymentMethod.
Source§impl AttachPaymentMethod
impl AttachPaymentMethod
Sourcepub async fn send<C: StripeClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err>
pub async fn send<C: StripeClient>( &self, client: &C, ) -> Result<<Self as StripeRequest>::Output, C::Err>
Send the request and return the deserialized response.
Sourcepub fn send_blocking<C: StripeBlockingClient>(
&self,
client: &C,
) -> Result<<Self as StripeRequest>::Output, C::Err>
pub fn send_blocking<C: StripeBlockingClient>( &self, client: &C, ) -> Result<<Self as StripeRequest>::Output, C::Err>
Send the request and return the deserialized response, blocking until completion.
Trait Implementations§
Source§impl Clone for AttachPaymentMethod
impl Clone for AttachPaymentMethod
Source§fn clone(&self) -> AttachPaymentMethod
fn clone(&self) -> AttachPaymentMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more