mak
mak

Reputation: 1

Stripe Api Error when trying update a subscription schedule

I am trying to perform a subscription change via the Stripe API. To do this, I create a subscription schedule with the current plan (monthly billing) and the future plan (annual billing).

Sometimes it works, sometimes not. When it doesn't, I get the following error:

invalid_request_error You cannot update a subscription schedule that is currently in the released status. It must be in not_started, active status to be updated.

It is absolutely unclear to me when stripe sets the status to "released", and there is no explanation in the documentation.

My questions:

In the example code, the monthly subscription ends on 01.12.2023 and the annual subscription should also start there. I would also like a change to only take place at the end of a subscription period, i.e. at the end of the monthly or annual subscription.

{
  "end_behavior": "release",
  "phases": {
    "0": {
      "end_date": "1701418325",
      "start_date": "1698826325",
      "items": {
        "0": {
          "price": "price_XXXXXXXX1"
        }
      }
    },
    "1": {
      "start_date": "1701418325",
      "items": {
        "0": {
          "price": "price_XXXXXXXX2"
        }
      }
    }
  }
}

Does the status released possibly have something to do with the fact that no change can take place when billing runs are being prepared?

Many thanks in advance!

Upvotes: 0

Views: 1317

Answers (1)

koopajah
koopajah

Reputation: 25602

A SubscriptionSchedule is "released" when it ended but left the underlying Subscription to continue as is. There are a few examples of this in the docs, including the Release SubscriptionSchedule API.

The error you mention seems to be due to you thinking the SubscriptionSchedule is still ongoing when it already ended. At that point what you need to do if you want to change it is basically to create a new SubscriptionSchedule for your existing Subscription and then you can update that new SubscriptionSchedule.

Upvotes: 1

Related Questions