Test mode subscription data retention

Stripe's test mode subscription data retention policy automatically cancels test mode subscriptions that were created 90 days ago and deletes them 30 days after cancellation. Users can mark a test mode subscription as exempt from deletion, if they want it to persist for a longer period, by clicking on Actions > Mark as exempt. Subscriptions in live mode are not subject to this policy and follow Stripe's overall data retention policy.


Stripe's data retention policy dictates the retention of all Stripe objects across live and test mode. In general, objects are retained for the duration of a Stripe account lifespan, unless otherwise specified or requested. However, there are some Stripe objects, Events for example, that produce a large amount of data without providing significant long-term value for Stripe users. Test mode subscriptions are also one such object, and this document outlines how subscriptions are retained in test mode.

Here are some things you'll be able to do after reading this guide:

Note: Subscriptions in live mode are not subject to this data retention policy and will be retained per Stripe's overall data retention policy.

Test mode subscription data retention policy

For any test mode subscription that was created at least 90 days ago, Stripe will automatically cancel the subscription.

For any cancelled test mode subscription, Stripe will automatically delete the subscription and its descendent objects 30 days after cancellation.

See the FAQs below for more information.

Mark a test mode subscription as exempt from deletion

If a test mode subscription is cancelled or deleted, it will be labelled as such in the Stripe Dashboard. To mark a subscription as exempt from automatic deletion, click Actions > Mark as exempt from test mode auto-deletion.

FAQs

When did this policy come into effect?

The policy comes into effect for Stripe Accounts under the following criteria:

Policy enabled on 16 November 2022 for Stripe Accounts created on or after 16 November 2022.

Policy enabled on 1 February 2023 for Stripe Accounts created before 16 November 2022.

When will a subscription be cancelled or deleted?

Unless marked as exempt, test mode subscriptions created at least 90 days ago will be cancelled automatically. 30 days after this, these subscriptions will be deleted. You can see the exact dates for pending "Test mode auto-cancellation" when viewing a test subscription within your Dashboard.

Screenshot 2023-05-24 at 2.48.00 PM.png

What happens when a test mode subscription is marked as exempt from auto deletion?

The subscription is no longer marked to be cancelled or deleted. Until a Dashboard user removes the exemption, Stripe will not automatically cancel or delete the test mode subscription.

Can I undo marking a test mode subscription as exempt from auto deletion?

Yes, once a test mode subscription has been marked as exempt from deletion, a Dashboard user can select "Remove auto deletion exemption" from the subscription. The test mode subscription will immediately be subject to automatic cancellation or deletion, according to the data retention policy.

Why should a test mode subscription be marked as exempt?

We recommend marking a test mode subscription as exempt from the data retention policy when you want time to pass naturally (i.e. according to the laws of physics). For example, if you're building an internal demonstration of an application to be used over a long period of time and want testers to be able to experience how billing feels to a user, then the test mode subscription should be marked as exempt. Here are some questions that you might be asking with this kind of testing scenario:

When should a test mode subscription not be marked as exempt?

For most testing scenarios, test clocks should be used to create a subscription and simulate the passing of time to understand how the created subscription will behave. These subscriptions should no longer be needed after simulating the passing of time, and they should not be marked as exempt from the test mode subscription data retention policy.

How will subscriptions created using test clocks be affected by this new policy?

Test clocks and their customers are deleted automatically 30 days after creation, while any associated subscription is cancelled when the test clock is deleted. In addition, this policy will delete the subscription 30 days after cancellation. Subscriptions for a customer with an associated test clock cannot be marked as exempt.

Can a test mode subscription be recovered once it has been deleted by the data retention policy?

No, deleted test mode subscriptions cannot be recovered or exempted. We recommend creating a new subscription in test mode to meet your testing needs.

Which Stripe objects will be deleted when a subscription is deleted?

The following related objects will be deleted when a subscription marked for deletion is removed:

After a test mode subscription has been deleted, what objects will remain and how will they appear?

If the subscription produced any payments, the corresponding PaymentIntent, Charge and BalanceTransaction objects will still be present in the API.

The `invoice` field on the related PaymentIntent and Charge objects will have a null value when the associated subscription is deleted by the test mode data policy.

Can the API be used to retrieve a list of test mode subscriptions to be deleted?

No, test mode subscriptions to be deleted will only be marked as such in the Dashboard. Subscriptions to be deleted will still be retrievable individually in the API until they're deleted, and they will not be marked in any way to suggest they're about to be deleted.

How many test mode subscriptions can be marked as exempt from deletion?

A Stripe account can have no more than 50 test mode subscriptions marked as exempt from auto deletion at any one time.

Will a webhook be sent when a non-exempt subscription is auto cancelled?

Yes, a "customer.subscription.deleted" event will be emitted.

Will a webhook be sent when a non-exempt subscription is auto deleted?

No, webhooks will not be sent when subscriptions and subscription schedules are deleted automatically in test mode.