Create a subscription item ​
Adds a new item to an existing subscription. No existing items will be changed or replaced.
Returns ​
Returns the created Subscription Item object, if successful. Otherwise, this call raises an error.
Parameters ​
subscription(string, required) The identifier of the subscription to modify.billing_thresholds(object, optional) 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.billing_thresholds.usage_gte(integer, required) Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 monetary threshold)
discounts(array of objects, optional) The coupons to redeem into discounts for the subscription item.discounts.coupon(string, optional) ID of the coupon to create a new discount for.discounts.discount(string, optional) ID of an existing discount on the object (or one of its ancestors) to reuse.discounts.promotion_code(string, optional) ID of the promotion code to create a new discount for.
metadata(object, optional) 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 tometadata.payment_behavior(enum, optional) Useallow_incompleteto transition the subscription tostatus=past_dueif 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_incompleteto transition the subscription tostatus=past_duewhen 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_incompleteto update the subscription using pending updates. When you usepending_if_incompleteyou can only pass the parameters supported by pending updates.Use
error_if_incompleteif 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. Possible enum values:allow_incompletedefault_incompleteerror_if_incompletepending_if_incomplete
price(string, optional) The ID of the price object.price_data(object, optional) Data used to generate a new Price object inline.price_data.currency(enum, required) Three-letter ISO currency code, in lowercase. Must be a supported currency.price_data.product(string, required) The ID of the Product that this Price will belong to.price_data.recurring(object, required) The recurring components of a price such asintervalandinterval_count.price_data.recurring.interval(enum, required) Specifies billing frequency. Eitherday,week,monthoryear. Possible enum values:daymonthweekyear
price_data.recurring.interval_count(integer, optional) The number of intervals between subscription billings. For example,interval=monthandinterval_count=3bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
price_data.tax_behavior(enum, recommended if calculating taxes) Only required if a default tax behavior) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One ofinclusive,exclusive, orunspecified. Once specified as eitherinclusiveorexclusive, it cannot be changed. Possible enum values:exclusiveinclusiveunspecified
price_data.unit_amount(integer, optional) A positive integer in the smallest currency unit (or 0 for a free price) representing how much to charge.price_data.unit_amount_decimal(string, required conditionally) Same asunit_amount, but accepts a decimal value in the smallest currency unit with at most 12 decimal places. Only one ofunit_amountandunit_amount_decimalcan be set.
proration_behavior(enum, optional) Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resettingbilling_cycle_anchor=now, or starting a trial), or if an item’squantitychanges. The default value iscreate_prorations. Possible enum values:always_invoiceAlways invoice immediately for prorations.create_prorationsWill cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under certain conditions.noneDisable creating prorations in this request.
proration_date(timestamp, optional) 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.quantity(integer, optional) The quantity you’d like to apply to the subscription item you’re creating.tax_rates(array of strings, optional) A list of Tax Rate ids. These Tax Rates will override thedefault_tax_rateson the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
curl
curl https://api.stripe.com/v1/subscription_items \
-u "<<YOUR_SECRET_KEY>>" \
-d subscription={{SUBSCRIPTION_ID}} \
-d price={{PRICE_ID}} \
-d quantity=2Response ​
json
{
"id": "si_NcLYdDxLHxlFo7",
"object": "subscription_item",
"created": 1680126546,
"metadata": {},
"price": {
"id": "price_1Mr6rdLkdIwHu7ixwPmiybbR",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1680126545,
"currency": "usd",
"custom_unit_amount": null,
"discounts": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_NcLYGKH0eY5b8s",
"recurring": {
"interval": "month",
"interval_count": 1,
"trial_period_days": null,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1000,
"unit_amount_decimal": "1000"
},
"quantity": 2,
"subscription": "sub_1Mr6rbLkdIwHu7ix4Xm9Ahtd",
"tax_rates": []
}