#johnsummerlin_code

1 messages ¡ Page 1 of 1 (latest)

proper edgeBOT
#

👋 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/1344888254402396200

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

thorn minnow
#

I think the situation could be different and Test / Live mode. Could you provide 2 request id (req_xxx), from each mode?

#

Normally you can't modify the startdate of a current phase in effect. If phase 0 is in effect, it can't change start_date to now for example

proper edgeBOT
hallow girder
#

Whenever I try removing the start_date prop, it says that one of the phases doesn't have a start date and that it needs that to know what to anchor the billing period to

#

Even though the new phase being added has a start date

nocturne ice
#

like what orakaro mentioned, can you share the example request ids? that'll allow us to be able to look into the specific reason why you're encountering the error

hallow girder
#

unfortunately, the sandbox one was using a test clock and I finished the simulation

#

here's the production one that didn't work - req_17yRqf3XkYquGT

#

I can recreate the test request again if needed

nocturne ice
#

So like what the error message mentions, you can't update the start date of the current phase for an existing subscription schedule. If you want to update the billing cycle anchor for an existing subscription schedule, you should do something like the below instead

phases : [
    {
      items: [
        {
          price: schedule.phases[0].items[0].price,
          quantity: schedule.phases[0].items[0].quantity
        }
      ],
      start_date: schedule.phases[0].start_date,
      end_date: 1748736001, //Jun 01 2025 00:00:01
    },
    {
      
      items: [
        {
          price: schedule.phases[0].items[0].price,
          quantity: schedule.phases[0].items[0].quantity,
        }
      ],
      billing_cycle_anchor : "phase_start",
    },
  ]
hallow girder
#

I tried setting the start date prop in the existing phase to it's current value, but it also stated that I can't modify the start date of the current phase. I am not sure what my post body would look like to not change the start date of the existing schedule phase.

nocturne ice
#

you didn't set the same start date as what was already defined in the existing subscription schedule

hallow girder
#

that request yes, but in other requests I passed in the current value and it errored then as well

nocturne ice
#

can you share the request id where you passed in the current value? I'll take a look

hallow girder
#

I can definitely try it again

#

I don't know if I'll be able to find that request again, but I can try on another subscription that I need update the billing cycle anchor for.

nocturne ice
#

sure, that works

hallow girder
#

req_krgJ9gNKJh2G4T

#

You can not modify the start date of the current phase.

#

how I built my payload of phases

#

phase1 = {
"items": items,
"start_date": subscription.start_date,
"end_date": 1740805200
}
phase2 = {
"items": items,
"billing_cycle_anchor": "phase_start"
}

#

1740805200 = March 1 at 5a

nocturne ice
#

"start_date": subscription.start_date, - this is wrong

hallow girder
#

what should it be then?

nocturne ice
hallow girder
#

code to create schedule for existing subscription and set the new schedule

#

create the schedule

create_schedule_response = stripe.SubscriptionSchedule.create(
from_subscription=subscription_id
)

modify the schedule

modify_schedule_response = stripe.SubscriptionSchedule.modify(
create_schedule_response.id,
phases=phases
)

#

when I call stripe.SubscriptionSchedule.create() should it return the phases in the response

#

and then I could use start_date: schedule.phases[0].start_date

nocturne ice
hallow girder
#

ahh - good to know

#

still working to use the logs to my advantage when troubleshooting errors

#

thx for your help