#becca_schedule-downgrade
1 messages ยท Page 1 of 1 (latest)
๐ 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/1287873809080123423
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello, looking in to this. Can you send me the ID of the event that you are looking at as well (evt_1234)
yup, grabbing...
here's the event for the schedule being updated with the phases (it was created from FromSubscription): evt_1Q2IXfChAQsULn73Wc7IE0OQ
here's the customer.subscription.updated event: evt_1Q2IZMChAQsULn735iduabSD
the only 2 events on the subscription schedule are creation and that update. nothing further after the test clock advances
Can you try advancing the test clock again until after the current cycle would end? (March 27 or later)
I think the schedule may release after the cycle finishes, rather than as soon as it starts
working on it...but Feb 27 is when the downgrade happened, the customer does show a paid invoice for the lower price for 2/27/25
oh, huh. that looks better in the dashboard. checking my db records...
Ah, so what you are reporting is that "X change will happen on Feb 27" still? I was focusing more on the schedule releasing
you were right, advancing past 3/27 did trigger a subscription_schedule.released event, but it should have been 2/27 not 3/27
checking all the dates from when I set up the schedule phases, pretty sure I did and they were for jan -> feb, but just wanna confirm march wasn't in there heh
(suggestion maybe to pass on somewhere: the dashboard is great about letting you click to copy ids and/or navigating to objects by clicking on ids...would be awesome if it handled the timestamps so I don't have to use a webpage to convert them all lol)
this is what I'm seeing from the schedule setup:
current phase
start date 1/27/25
end date 2/27/25
phase 0
start date 1/27/25
end date 2/27/25
(the timestamp values are the exact same there between current phase and phase 0)
the timestamps on the phase match the initial invoice for the higher price exactly
๐ Stepping in for my teammate, give me a few mins to catch up
ty!
Okay, sorry for the delay
no worries!
I understand you have a schedule with two phases, each phase with a monthly price. The second phase starts Feb 27, 2025. The test clock was advanced to March 10 which means you're in the middle of the first cycle on the second phase
especially if you can help me get this resolved teehee ๐
I think this lines up with the fact that the schedule will be released at the end of that cycle, which will be March 27, 2025
hmm, looking. I thought there was just the 1 phase
evt_1Q2IXfChAQsULn73Wc7IE0OQ this is showing just 1 phase afaict
hmm, yeah, afaict I only specified 2/27 for the end. def a bit confused here
Okay, let me try to put together a timeline
So you created a Schedule from an existing Subscription: https://dashboard.stripe.com/test/logs/req_oBIp0m1LEk68Nb
Then the Schedule was updated: https://dashboard.stripe.com/test/logs/req_49cDpo5RHMiq27
hmm, so this does have a 2nd phase. this is bringing back some dusty memory that it wouldn't let me update the schedule with only a single phase
At that point in time, the time of the test clock was already within that first phase
aye, think that's right
but not advanced past it, I advanced it to 2/27 after the schedule was there
Hm, no
When the Schedule was created, the test clock was already 2025-03-10 21:09:33 UTC
The test clock was still 2025-03-10 21:09:33 UTC when the Schedule was updated
does something need to change here? now that I'm looking at it, the 2nd phase having the start date of 2/27 but no end date...I'm wanting the release event on 2/27 not 3/27
but iirc submitting just one phase isn't allowed?
Taking a step back, can you explain what you're trying to test exactly?
User is subscribed to Expensive plan say 1/1/25 - 2/1/25. On 1/13/25, user chooses to downgrade to Cheap plan, which should occur not immediately but at the end of the current billing cycle on 2/1/25.
I think I'm starting to wrap my head around it, the issue though is that I'm wanting the subscription_schedule.released to happen immediately on the phase change, not another month later.
(The user sees a banner on the site reminding them of the pending downgrade, allowing them to cancel it before it happens, and the schedule being released make that go away...so currently the user is being downgraded but still seeing the banner due to the disconnection of those events)
Ah, I think I see what you mean
ok, so making that 2nd phase 1 second long (can't be the same as the start date, must be at least 1s per the error I got when trying) functionally works even though it's hacky as hell and makes me feel dirty lol
becca_schedule-downgrade
In that case the Subscription would be released at the end of the current period
You can test all of this with TestClocks which I highly recommend using for cases like this: https://docs.stripe.com/billing/testing/test-clocks
right that's what I've been doing
Gotcha so did that answer your question? If not, what part is still blocking you?
yeah this is exactly what I want. is specifying 1s the best way to do that haha? It does appear to work, just feels super hacky I guess.
No, it's definitely not normal to make a fake phase for 1s
You either wait for the end of the current phase (best approach) or you release the SubscriptionSchedule via the API: https://docs.stripe.com/api/subscription_schedules/release
so I've got 2 phases on the schedule, phase 0 = current price, current end date, phase 1 = new lower price with hacky 1s later end date
Why why a hacky 1s later end date?
I'm sorry I read the backlog but I really don't get what you are trying to do and why you do a hacky 1s period But it's definitely not normal nor what you should do
1/1/25: User subscribes to Expensive Plan
1/13/25: User chooses to downgrade (effective end of current cycle) to Cheap Plan, so a subscription_schedule is created from the subscription and updated (this is where the 2 phase with hacky 2nd phase is entered into play)
2/1/25: User subscription should be downgraded and I'm wanting the schedule released here as well
Cool then do a normal second phase for February 1st -> March 1st and either release yourself with code when that transition happens or let it run its course until the end of the current phase (and special-case your UI to now show a warning)
ok I think I'm following. the customer.subscription.updated event has the schedule id in it, so I can use that to look up the pending change powering the site banner and release it from there, and then I won't need to listen for the subscription_schedule.released event at all. sound right?
yes
sure thing!
(can go ahead and close this thread, hopefully my confidence in this solution isn't misplaced! I can submit for a new thread if I encounter anything else)