Subscription Items
Subscription items allow you to create customer subscriptions with more than one plan, making it easy to represent complex billing relationships.
The Subscription Item object
Attributes
- idstring
Unique identifier for the object.
- metadataobject
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.
- priceobject
The price the customer is subscribed to.
- quantitynullable integer
The quantity of the plan to which the customer should be subscribed.
- subscriptionstring
The
subscription
thissubscription_item
belongs to.
More attributes
- objectstring
- billing_
thresholdsnullable object - createdinteger
- discountsarray of stringsExpandable
- tax_
ratesnullable array of objects
Create a subscription item
Adds a new item to an existing subscription. No existing items will be changed or replaced.
Parameters
- subscriptionstringRequired
The identifier of the subscription to modify.
- metadataobject
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
. - payment_
behaviorenum Use
allow_incomplete
to transition the subscription tostatus=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 tostatus=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 usepending_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. - pricestring
The ID of the price object.
- proration_
behaviorenum 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’squantity
changes. The default value iscreate_prorations
. - quantityinteger
The quantity you’d like to apply to the subscription item you’re creating.
More parameters
- billing_
thresholdsobject - discountsarray of objects
- price_
dataobject - proration_
datetimestamp - tax_
ratesarray of strings
Returns
Returns the created Subscription Item
object, if successful. Otherwise, this call raises an error.
Update a subscription item
Updates the plan or quantity of an item on a current subscription.
Parameters
- metadataobject
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
. - payment_
behaviorenum Use
allow_incomplete
to transition the subscription tostatus=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 tostatus=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 usepending_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. - pricestring
The ID of the price object. When changing a subscription item’s price,
quantity
is set to 1 unless aquantity
parameter is provided. - proration_
behaviorenum 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’squantity
changes. The default value iscreate_prorations
. - quantityinteger
The quantity you’d like to apply to the subscription item you’re creating.
More parameters
- billing_
thresholdsobject - discountsarray of objects
- off_
sessionboolean - price_
dataobject - proration_
datetimestamp - tax_
ratesarray of strings
Returns
Retrieve a subscription item
Retrieves the subscription item with the given ID.
Parameters
No parameters.
Returns
Returns a subscription item if a valid subscription item ID was provided. Raises an error otherwise.