#mathieu_api

1 messages ยท Page 1 of 1 (latest)

strange kettleBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1341698718373515264

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

uneven verge
#

๐Ÿ‘‹ happy to help

slow owl
#

How can I find the start phase date using API ?

uneven verge
#

it's in the Subscription Schedule

#

current_phase.start_date

#

you can also find it in phases[0].start_date

#

it might also be useful to use iterations instead of phase.start_date & phase.end_date

#

in your case since you want the change to happen after the current cycle, you can set the iterations to 1

slow owl
#

So instead of
{ "phases": { "0": { "end_date": "1741520606", "items": { "0": { "price": "price_1MzGV6Deg55eSBYjqmQNgV22" } }, "start_date": "1736423006" }, "1": { "items": { "0": { "price": "price_1MzGUODeg55eSBYjXMr8KF7O" } }, "start_date": "1741520606" } } }

#

I can use
{ "phases": { "0": { "items": { "0": { "price": "price_1MzGV6Deg55eSBYjqmQNgV22" } }, "iteration": 1 }, "1": { "items": { "0": { "price": "price_1MzGUODeg55eSBYjXMr8KF7O" } }, "iteration": 1 } } }
?

uneven verge
#

yes correct

#

and that would release the schedule after the iteration of the second phase, keeping the subscription active with the new price

slow owl
#

I have the error :

{"status":400,"message":"The subscription schedule update is missing at least one phase with a start_date to anchor end dates to.","request_id":"req_JfTe3xXkHTuIKm","request_log_url":"https://dashboard.stripe.com/logs/req_JfTe3xXkHTuIKm?t=1739956991","type":"invalid_request_error"}

uneven verge
#

oh yes, you just need the first phase to have the same start_date as the current 1st phase of the schedule

#
{
  "phases": {
    "0": {
      "start_date": sub_sched.phases[0].start_date
      "items": {
        "0": {
          "price": "price_1MzGV6Deg55eSBYjqmQNgV22"
        }
      },
      "iteration": 1
    },
    "1": {
      "items": {
        "0": {
          "price": "price_1MzGUODeg55eSBYjXMr8KF7O"
        }
      },
      "iteration": 1
    }
  }
}
slow owl
#

Iteration is usefull on first phase ?

uneven verge
#

yes so you don't have to calculate the end_date

slow owl
#

And on second phase, I dont want subscription end until the suer unsubscribe. Iteration: 1 is ok ?

uneven verge
#

yes because then the schedule will release the subscription

#

as you can see in the end_behavior of the subscription_schedule

slow owl
#

Perfect, it's working well.

#

Thanks you