# Adds more flexibility for how you manage subscription end-of-period cancellations ## What’s new We introduced new [cancel_at](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview#create_subscription-cancel_at) enum values for subscriptions configured with [flexible behavior](https://docs.stripe.com/billing/subscriptions/billing-mode.md) (which have [billing_mode](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-04-30.preview#create_subscription-billing_mode) set to `flexible`). This change simplifies canceling a subscription at the end of a billing period with [mixed intervals](https://docs.stripe.com/billing/subscriptions/mixed-interval.md). The new [cancel_at](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview#create_subscription-cancel_at) enum values are: - `min_period_end` - `max_period_end` Use these values to cancel the earliest and latest [items.data.current_period_end](https://docs.stripe.com/api/subscriptions/object.md?api-version=2025-05-28.preview#subscription_object-items-data-current_period_end) amongst all subscription items. These new enum values set the cancelation date based on the current subscription’s `items.data.current_period_end`. Unlike [cancel_at_period_end](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview#create_subscription-cancel_at_period_end), these values are resolved to timestamps immediately and aren’t affected by further changes to `items.data.current_period_end`. The [cancel_at_period_end](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview#create_subscription-cancel_at_period_end) parameter is now deprecated. The behavior of this parameter is unchanged, but in the context of mixed interval subscriptions, it defaults to canceling at the earliest period end. ## Impact The following API endpoints support these new values: - [Create a subscription](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview) - [Update a subscription](https://docs.stripe.com/api/subscriptions/update.md?api-version=2025-05-28.preview) - [Create an invoice preview](https://docs.stripe.com/api/invoices/create_preview.md?api-version=2025-05-28.preview) If your integration currently uses the deprecated [cancel_at_period_end](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview#create_subscription-cancel_at_period_end) parameter to cancel subscriptions, use the new [cancel_at](https://docs.stripe.com/api/subscriptions/create.md?api-version=2025-05-28.preview#create_subscription-cancel_at) parameter with the `min_period_end` enum value instead. The `cancel_at_period_end` field on a Subscription isn’t compatible with the new `cancel_at` helpers. ## Changes #### REST API #### Ruby #### Python #### PHP This change does not affect the PHP SDK. #### Java #### Node.js #### Go #### .NET ## Upgrade #### REST API 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. If you use an SDK, upgrade to the corresponding SDK version for this API version. - If you don’t use an SDK, update your [API requests](https://docs.stripe.com/api/versioning.md) to include `Stripe-Version: 2025-05-28.preview` 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### Ruby 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your Ruby SDK to [v15.3.0-beta.1](https://github.com/stripe/stripe-ruby/releases/tag/v15.3.0-beta.1) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### Python 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your Python SDK to [v12.3.0b1](https://github.com/stripe/stripe-python/releases/tag/v12.3.0b1) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### PHP 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your PHP SDK to [v17.4.0-beta.2](https://github.com/stripe/stripe-php/releases/tag/v17.4.0-beta.2) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### Java 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your Java SDK to [v29.3.0-beta.1](https://github.com/stripe/stripe-java/releases/tag/v29.3.0-beta.1) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### Node.js 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your Node SDK to [v18.3.0-beta.1](https://github.com/stripe/stripe-node/releases/tag/v18.3.0-beta.1) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### Go 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your Go SDK to [v82.3.0-beta.1](https://github.com/stripe/stripe-go/releases/tag/v82.3.0-beta.1) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). #### .NET 1. [View your current API version](https://docs.stripe.com/upgrades.md#view-your-api-version-and-the-latest-available-upgrade-in-workbench) in Workbench. 1. Upgrade your .NET SDK to [v48.3.0-beta.1](https://github.com/stripe/stripe-dotnet/releases/tag/v48.3.0-beta.1) 1. Upgrade the API version used for [webhook endpoints](https://docs.stripe.com/webhooks/versioning.md). 1. [Test your integration](https://docs.stripe.com/testing.md) against the new version. 1. If you use Connect, [test your Connect integration](https://docs.stripe.com/connect/testing.md). 1. In Workbench, [perform the upgrade](https://docs.stripe.com/upgrades.md#perform-the-upgrade). You can [roll back the version](https://docs.stripe.com/upgrades.md#roll-back-your-api-version) for 72 hours. Learn more about [Stripe API upgrades](https://docs.stripe.com/upgrades.md). ## Related changes - [Adds the ability to migrate subscriptions to flexible billing mode](https://docs.stripe.com/changelog/basil/2025-05-28/migrate-subscription.md)