pub struct CancelSubscription { /* private fields */ }
Expand description
Cancels a customer’s subscription immediately. The customer won’t be charged again for the subscription. After it’s canceled, you can no longer update the subscription or its metadata.
Any pending invoice items that you’ve created are still charged at the end of the period, unless manually deleted.
If you’ve set the subscription to cancel at the end of the period, any pending prorations are also left in place and collected at the end of the period.
But if the subscription is set to cancel immediately, pending prorations are removed if invoice_now
and prorate
are both set to true.
By default, upon subscription cancellation, Stripe stops automatic collection of all finalized invoices for the customer. This is intended to prevent unexpected payment attempts after the customer has canceled a subscription. However, you can resume automatic collection of the invoices manually after subscription cancellation to have us proceed. Or, you could check for unpaid invoices before allowing the customer to cancel the subscription at all.
Implementations§
Source§impl CancelSubscription
impl CancelSubscription
Sourcepub fn new(subscription_exposed_id: impl Into<SubscriptionId>) -> Self
pub fn new(subscription_exposed_id: impl Into<SubscriptionId>) -> Self
Construct a new CancelSubscription
.
Sourcepub fn cancellation_details(
self,
cancellation_details: impl Into<CancelSubscriptionCancellationDetails>,
) -> Self
pub fn cancellation_details( self, cancellation_details: impl Into<CancelSubscriptionCancellationDetails>, ) -> Self
Details about why this subscription was cancelled
Sourcepub fn expand(self, expand: impl Into<Vec<String>>) -> Self
pub fn expand(self, expand: impl Into<Vec<String>>) -> Self
Specifies which fields in the response should be expanded.
Sourcepub fn invoice_now(self, invoice_now: impl Into<bool>) -> Self
pub fn invoice_now(self, invoice_now: impl Into<bool>) -> Self
Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items.
Defaults to false
.
Source§impl CancelSubscription
impl CancelSubscription
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 CancelSubscription
impl Clone for CancelSubscription
Source§fn clone(&self) -> CancelSubscription
fn clone(&self) -> CancelSubscription
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more