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:
Understand test mode subscription data retention
Receive notifications of test mode subscriptions to be deleted
Exempt a test mode subscription from deletion
Understand the limits of test mode subscription exemptions
Note: Subscriptions in live mode are not subject to this data retention policy, and will be retained per Stripe’s overall data retention policy.
For any test mode subscription that was created at least 90 days ago, Stripe will automatically cancel the subscription.
For any canceled test mode subscription, Stripe will automatically delete the subscription and its descendent objects 30 days after canceling.
See FAQs below for more information.
If a test mode subscription will be canceled or deleted, it will be labeled 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.
When did this policy come into effect?
The policy goes into effect for Stripe Accounts under the following criteria:
Policy enabled on November 16, 2022 for Stripe Accounts created on or after November 16, 2022.
Policy enabled on February 1, 2023 for Stripe Accounts created before November 16, 2022.
When will a subscription be canceled or deleted?
Unless marked as exempt, test mode subscriptions created at least 90 days ago will automatically be cancelled. 30 days after, these subscriptions will be deleted. You can see exact dates for pending "Test mode auto-cancellation” when viewing a test subscription within your Dashboard.
What happens when a test mode subscription is marked as exempt from auto deletion?
The subscription is no longer marked as to be canceled 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 do 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 you might be asking under 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 impacted by this new policy?
Test clocks and their customers are automatically deleted 30 days after creation, while any associated subscription is canceled when the test clock is deleted. This policy will additionally 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 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 is 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 denoted 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 canceled?
Yes, a '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 automatically deleted in test mode.