Retrieves the subscription with the given ID.
Parameters
No parameters.
Returns
Returns the subscription object.
{ "id": "sub_1MowQVLkdIwHu7ixeRlqHVzs", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": { "enabled": false, "liability": null }, "billing_cycle_anchor": 1679609767, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": { "comment": null, "feedback": null, "reason": null }, "collection_method": "charge_automatically", "created": 1679609767, "currency": "usd", "current_period_end": 1682288167, "current_period_start": 1679609767, "customer": "cus_Na6dX7aXxi11N4", "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": null, "ended_at": null, "invoice_settings": { "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_Na6dzxczY5fwHx", "object": "subscription_item", "billing_thresholds": null, "created": 1679609768, "metadata": {}, "plan": { "id": "price_1MowQULkdIwHu7ixraBm864M", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1000, "amount_decimal": "1000", "billing_scheme": "per_unit", "created": 1679609766, "currency": "usd", "discounts": null, "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_Na6dGcTsmU0I4R", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1MowQULkdIwHu7ixraBm864M", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1679609766, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_Na6dGcTsmU0I4R", "recurring": { "aggregate_usage": null, "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": 1, "subscription": "sub_1MowQVLkdIwHu7ixeRlqHVzs", "tax_rates": [] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1MowQVLkdIwHu7ixeRlqHVzs" }, "latest_invoice": "in_1MowQWLkdIwHu7ixuzkSPfKd", "livemode": false, "metadata": {}, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "off" }, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "schedule": null, "start_date": 1679609767, "status": "active", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": { "end_behavior": { "missing_payment_method": "create_invoice" } }, "trial_start": null}
By default, returns a list of subscriptions that have not been canceled. In order to list canceled subscriptions, specify status=canceled
.
Parameters
- customerstring
The ID of the customer whose subscriptions will be retrieved.
- pricestring
Filter for subscriptions that contain this recurring price ID.
- statusenum
The status of the subscriptions to retrieve. Passing in a value of
canceled
will return all canceled subscriptions, including those belonging to deleted customers. Passended
to find subscriptions that are canceled and subscriptions that are expired due to incomplete payment. Passing in a value ofall
will return subscriptions of all statuses. If no value is supplied, all subscriptions that have not been canceled are returned.
More parameters
- automatic_
taxobject - collection_
methodenum - createdobject
- current_
period_ endobject - current_
period_ startobject - ending_
beforestring - limitinteger
- starting_
afterstring - test_
clockstring
Returns
Returns a list of subscriptions.
{ "object": "list", "url": "/v1/subscriptions", "has_more": false, "data": [ { "id": "sub_1MowQVLkdIwHu7ixeRlqHVzs", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": { "enabled": false, "liability": null }, "billing_cycle_anchor": 1679609767, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": { "comment": null, "feedback": null, "reason": null }, "collection_method": "charge_automatically", "created": 1679609767, "currency": "usd", "current_period_end": 1682288167, "current_period_start": 1679609767, "customer": "cus_Na6dX7aXxi11N4", "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "discounts": null, "ended_at": null, "invoice_settings": { "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_Na6dzxczY5fwHx", "object": "subscription_item", "billing_thresholds": null, "created": 1679609768, "metadata": {}, "plan": { "id": "price_1MowQULkdIwHu7ixraBm864M", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1000, "amount_decimal": "1000", "billing_scheme": "per_unit", "created": 1679609766, "currency": "usd", "discounts": null, "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_Na6dGcTsmU0I4R", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1MowQULkdIwHu7ixraBm864M", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1679609766, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_Na6dGcTsmU0I4R", "recurring": { "aggregate_usage": null, "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": 1, "subscription": "sub_1MowQVLkdIwHu7ixeRlqHVzs", "tax_rates": [] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1MowQVLkdIwHu7ixeRlqHVzs" }, "latest_invoice": "in_1MowQWLkdIwHu7ixuzkSPfKd", "livemode": false, "metadata": {}, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "off" }, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "schedule": null, "start_date": 1679609767, "status": "active", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": { "end_behavior": { "missing_payment_method": "create_invoice" } }, "trial_start": null } ]}
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.
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.
Parameters
No parameters.
More parameters
- cancellation_
detailsobject - invoice_
nowboolean - prorateboolean
Returns
The canceled Subscription
object. Its subscription status will be set to canceled
.
{ "id": "sub_1MlPf9LkdIwHu7ixB6VIYRyX", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": { "enabled": false, "liability": null }, "billing_cycle_anchor": 1678768838, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": 1678768842, "cancellation_details": { "comment": null, "feedback": null, "reason": "cancellation_requested" }, "collection_method": "charge_automatically", "created": 1678768838, "currency": "usd", "current_period_end": 1681447238, "current_period_start": 1678768838, "customer": "cus_NWSaVkvdacCUi4", "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "ended_at": 1678768842, "invoice_settings": { "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_NWSaWTp80M123q", "object": "subscription_item", "billing_thresholds": null, "created": 1678768839, "metadata": {}, "plan": { "id": "price_1MlPf7LkdIwHu7ixgcbP7cwE", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1099, "amount_decimal": "1099", "billing_scheme": "per_unit", "created": 1678768837, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_NWSaMgipulx8IQ", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1MlPf7LkdIwHu7ixgcbP7cwE", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1678768837, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_NWSaMgipulx8IQ", "recurring": { "aggregate_usage": null, "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": 1099, "unit_amount_decimal": "1099" }, "quantity": 1, "subscription": "sub_1MlPf9LkdIwHu7ixB6VIYRyX", "tax_rates": [] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1MlPf9LkdIwHu7ixB6VIYRyX" }, "latest_invoice": "in_1MlPf9LkdIwHu7ixEo6hdgCw", "livemode": false, "metadata": {}, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "off" }, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": { "id": "price_1MlPf7LkdIwHu7ixgcbP7cwE", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1099, "amount_decimal": "1099", "billing_scheme": "per_unit", "created": 1678768837, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_NWSaMgipulx8IQ", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "quantity": 1, "schedule": null, "start_date": 1678768838, "status": "canceled", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": { "end_behavior": { "missing_payment_method": "create_invoice" } }, "trial_start": null}
Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active
, and if payment fails the subscription will be past_
. The resumption invoice will void automatically if not paid by the expiration date.
Parameters
- billing_
cycle_ anchorenum The billing cycle anchor that applies when the subscription is resumed. Either
now
orunchanged
. The default isnow
. For more information, see the billing cycle documentation.Possible enum valuesnow
Reset the subscription’s billing cycle anchor to the current time (in UTC) and start a new billing period.
unchanged
Advance the subscription to the period that surrounds the current time without resetting the billing cycle anchor.
- proration_
behaviorenum Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting
billing_
, or starting a trial), or if an item’scycle_ anchor=now quantity
changes. The default value iscreate_
.prorations Possible enum valuesalways_
invoice Always invoice immediately for prorations.
create_
prorations Will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under certain conditions.
none
Disable creating prorations in this request.
More parameters
- proration_
datetimestamp
Returns
The subscription object.
{ "id": "sub_1MoGGtLkdIwHu7ixk5CfdiqC", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": { "enabled": false, "liability": null }, "billing_cycle_anchor": 1679447726, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": { "comment": null, "feedback": null, "reason": null }, "collection_method": "charge_automatically", "created": 1679447723, "currency": "usd", "current_period_end": 1682126126, "current_period_start": 1679447726, "customer": "cus_NZP5i1diUz55jp", "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "ended_at": null, "invoice_settings": { "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_NZP5BhUIuWzXDG", "object": "subscription_item", "billing_thresholds": null, "created": 1679447724, "metadata": {}, "plan": { "id": "price_1MoGGsLkdIwHu7ixA9yHsq2N", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1099, "amount_decimal": "1099", "billing_scheme": "per_unit", "created": 1679447722, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_NZP5rEATBlScM9", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1MoGGsLkdIwHu7ixA9yHsq2N", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1679447722, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_NZP5rEATBlScM9", "recurring": { "aggregate_usage": null, "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": 1099, "unit_amount_decimal": "1099" }, "quantity": 1, "subscription": "sub_1MoGGtLkdIwHu7ixk5CfdiqC", "tax_rates": [] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1MoGGtLkdIwHu7ixk5CfdiqC" }, "latest_invoice": "in_1MoGGwLkdIwHu7ixHSrelo8X", "livemode": false, "metadata": {}, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "off" }, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": { "id": "price_1MoGGsLkdIwHu7ixA9yHsq2N", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1099, "amount_decimal": "1099", "billing_scheme": "per_unit", "created": 1679447722, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_NZP5rEATBlScM9", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "quantity": 1, "schedule": null, "start_date": 1679447723, "status": "active", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": { "end_behavior": { "missing_payment_method": "create_invoice" } }, "trial_start": null}
Search for subscriptions you’ve previously created using Stripe’s Search Query Language. Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up to an hour behind during outages. Search functionality is not available to merchants in India.
Parameters
- querystringRequired
The search query string. See search query language and the list of supported query fields for subscriptions.
- limitinteger
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
- pagestring
A cursor for pagination across multiple pages of results. Don’t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
Returns
A dictionary with a data
property that contains an array of up to limit
subscriptions. If no objects match the query, the resulting array will be empty. See the related guide on expanding properties in lists.
{ "object": "search_result", "url": "/v1/subscriptions/search", "has_more": false, "data": [ { "id": "sub_1MoG3CLkdIwHu7ixd86qvAfe", "object": "subscription", "application": null, "application_fee_percent": null, "automatic_tax": { "enabled": false, "liability": null }, "billing_cycle_anchor": 1679446874, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": null, "cancellation_details": { "comment": null, "feedback": null, "reason": null }, "collection_method": "charge_automatically", "created": 1679446874, "currency": "usd", "current_period_end": 1682125274, "current_period_start": 1679446874, "customer": "cus_NZOq6LNU39H6ZI", "days_until_due": null, "default_payment_method": null, "default_source": null, "default_tax_rates": [], "description": null, "discount": null, "ended_at": null, "invoice_settings": { "issuer": { "type": "self" } }, "items": { "object": "list", "data": [ { "id": "si_NZOqmziODmZt2v", "object": "subscription_item", "billing_thresholds": null, "created": 1679446875, "metadata": {}, "plan": { "id": "price_1MoG3BLkdIwHu7ixrHMcmj3f", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1099, "amount_decimal": "1099", "billing_scheme": "per_unit", "created": 1679446873, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_NZOqsBJfaRYI1M", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_1MoG3BLkdIwHu7ixrHMcmj3f", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1679446873, "currency": "usd", "custom_unit_amount": null, "livemode": false, "lookup_key": null, "metadata": {}, "nickname": null, "product": "prod_NZOqsBJfaRYI1M", "recurring": { "aggregate_usage": null, "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": 1099, "unit_amount_decimal": "1099" }, "quantity": 1, "subscription": "sub_1MoG3CLkdIwHu7ixd86qvAfe", "tax_rates": [] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1MoG3CLkdIwHu7ixd86qvAfe" }, "latest_invoice": "in_1MoG3CLkdIwHu7ixuBm2QIyW", "livemode": false, "metadata": { "order_id": "6735" }, "next_pending_invoice_item_invoice": null, "on_behalf_of": null, "pause_collection": null, "payment_settings": { "payment_method_options": null, "payment_method_types": null, "save_default_payment_method": "off" }, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": { "id": "price_1MoG3BLkdIwHu7ixrHMcmj3f", "object": "plan", "active": true, "aggregate_usage": null, "amount": 1099, "amount_decimal": "1099", "billing_scheme": "per_unit", "created": 1679446873, "currency": "usd", "interval": "month", "interval_count": 1, "livemode": false, "metadata": {}, "nickname": null, "product": "prod_NZOqsBJfaRYI1M", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "quantity": 1, "schedule": null, "start_date": 1679446874, "status": "active", "test_clock": null, "transfer_data": null, "trial_end": null, "trial_settings": { "end_behavior": { "missing_payment_method": "create_invoice" } }, "trial_start": null } ]}