#hooky_api
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/1438243468463050973
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
I forgot to mention: I am aware an easy solution would be to apply a coupon to the whole customer, but the problem is our client does not want that. Their customers have multiple subscriptions, and these discounts must be subscription-specific, unfortunately.
Hi, we document this here: https://docs.stripe.com/billing/subscriptions/subscription-schedules#updating
You need to pass in all current and future phases when you update a subscription schedule. You also need to pass in any previously set parameters that you want to keep. Any parameters that were previously set are unset for the existing phase unless you pass those in the update request.
Are you passing in all the previous parameters like the discount when you update your schedules?
No. Ohh... can I pass the main subscription discount, and that simply keeps that same discount going? remembering its remaining duration?
You need to keep any params you want to keep. Can you try that using your test/ Sandbox API key please?
I was under the impression that would simply reapply the coupon and start the duration fresh, which is not what I want. But sure, I can give it a try!
The best thing here is to test this and share a concerete example/ steps as well
i.e. what I thought would happen is, if I have a coupon consisting of 50% off for 6 months, and 3 months pass.... then a phase starts... if I pass the discounts: [{coupon}] when creating the phase, I thought that would start couting 6 more months right then. (Which is what I do not want to happen).
But I could be wrong. I'll check and get back to you!
@tired jacinth my colleague is stepping out but I can help in this thread going forward. Are you still working on your test mode example? Can leave this thread open a bit longer if so
Yes, thank you
I am testing with this test customer and advancing a test clock to check the behavior... https://dashboard.stripe.com/acct_1IWfQ6A3np33huFN/test/subscriptions/sub_1SSkFFA3np33huFNw8lkiYk3
I created everything using the API, but I'm using the dashboard to advance the test clock (IDK if it can be done using the API?)
I'll find a conclusion in a moment (I can only advance 1 month at a time, it's a bit slow, I'm almost there).
Oh so it seems the coupon does "remember" the elapsed time across phases?
I may just close this thread and do some more testing to confirm. But after a quick initial test it seems to be the case. Not sure how it works though. This is not in the docs. ๐
In this example, I created a sub on May 12th 2026 (test clocks!) and Phase 1 started May 14th 2026, then Phase 2 started June 14th - til forever)... and I copied the discount to all phases.
And it seemed to have lasted ~6 months like the coupon specifies, and not 7 months like I feared.
(My fear was that each application of the 6 month coupon to a phase would start a fresh 6 month duration... but it seems it is not the case).
Unless you have details to provide about this specific interaction (the previous person just asked for an example, but provided no info), I'm happy to close the thread for now and I'll test some more.
Hello looking through that info. One quick note: you can advance test clocks via the API! https://docs.stripe.com/api/test_clocks/advance
To recap, my key question is around this: if I pass a discounts property when creating/updating one or more phases, if I pass the same coupon to many phases, does the discount "timer" reset on each phase, or does it work as if it's just one single discount running across phases?
i.e. if I start a subscription on Jan 1st, apply a 6 month discount, coupon "HELLO"... and then create a couple short phases... Feb 15th changes the plan (and I pass the discounts: { coupon: "HELLO"} option to keep the discount), and then maybe March 25th changes the plan back (and also passes that same discount)....
- SCENARIO A: Will the discount still work precisely for 6 months since the beginning of all this? i.e. until July 1st?
- OR... SCENARIO B: will the discount kind of*** reset its duration***... and will be applied until 6 months since the last phase started...? --- or for 6 months since the last phase ended? (SCENARIO C)
What I'd wish is for things to work like Scenario A. I can pass the same discount when creating many phases and the duration is one big time range that transverses phases. And one initial test seemed to show that's the case. But I'll test a bit more.
Yep, glad to hear this is working correctly! I am not finding further context on this at the moment so I think that testing is the way to go. I found a report about this not working this way and was trying to compare to your setup, but it looks like that report was fairly old so I am guessing this was fixed in the interim.