pub struct CreateSubscriptionItem { /* private fields */ }
Expand description
Adds a new item to an existing subscription. No existing items will be changed or replaced.
Implementations§
Source§impl CreateSubscriptionItem
impl CreateSubscriptionItem
Sourcepub fn billing_thresholds(
self,
billing_thresholds: impl Into<ItemBillingThresholdsParam>,
) -> Self
pub fn billing_thresholds( self, billing_thresholds: impl Into<ItemBillingThresholdsParam>, ) -> Self
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
Sourcepub fn discounts(self, discounts: impl Into<Vec<DiscountsDataParam>>) -> Self
pub fn discounts(self, discounts: impl Into<Vec<DiscountsDataParam>>) -> Self
The coupons to redeem into discounts for the subscription item.
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 metadata(self, metadata: impl Into<HashMap<String, String>>) -> Self
pub fn metadata(self, metadata: impl Into<HashMap<String, String>>) -> Self
Set of key-value pairs 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
.
Sourcepub fn payment_behavior(
self,
payment_behavior: impl Into<CreateSubscriptionItemPaymentBehavior>,
) -> Self
pub fn payment_behavior( self, payment_behavior: impl Into<CreateSubscriptionItemPaymentBehavior>, ) -> Self
Use allow_incomplete
to transition the subscription to status=past_due
if a payment is required but cannot be paid.
This allows you to manage scenarios where additional user actions are needed to pay a subscription’s invoice.
For example, SCA regulation may require 3DS authentication to complete payment.
See the SCA Migration Guide for Billing to learn more.
This is the default behavior.
Use default_incomplete
to transition the subscription to status=past_due
when payment is required and await explicit confirmation of the invoice’s payment intent.
This allows simpler management of scenarios where additional user actions are needed to pay a subscription’s invoice.
Such as failed payments, SCA regulation, or collecting a mandate for a bank debit payment method.
Use pending_if_incomplete
to update the subscription using pending updates.
When you use pending_if_incomplete
you can only pass the parameters supported by pending updates.
Use error_if_incomplete
if you want Stripe to return an HTTP 402 status code if a subscription’s invoice cannot be paid.
For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead.
This was the default behavior for API versions prior to 2019-03-14.
See the changelog to learn more.
Sourcepub fn plan(self, plan: impl Into<String>) -> Self
pub fn plan(self, plan: impl Into<String>) -> Self
The identifier of the plan to add to the subscription.
Sourcepub fn price_data(
self,
price_data: impl Into<CreateSubscriptionItemPriceData>,
) -> Self
pub fn price_data( self, price_data: impl Into<CreateSubscriptionItemPriceData>, ) -> Self
Data used to generate a new Price object inline.
Sourcepub fn proration_behavior(
self,
proration_behavior: impl Into<CreateSubscriptionItemProrationBehavior>,
) -> Self
pub fn proration_behavior( self, proration_behavior: impl Into<CreateSubscriptionItemProrationBehavior>, ) -> Self
Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now
, or starting a trial), or if an item’s quantity
changes.
The default value is create_prorations
.
Sourcepub fn proration_date(self, proration_date: impl Into<Timestamp>) -> Self
pub fn proration_date(self, proration_date: impl Into<Timestamp>) -> Self
If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the upcoming invoice endpoint.
Source§impl CreateSubscriptionItem
impl CreateSubscriptionItem
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 CreateSubscriptionItem
impl Clone for CreateSubscriptionItem
Source§fn clone(&self) -> CreateSubscriptionItem
fn clone(&self) -> CreateSubscriptionItem
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more