#amontagu_unexpected
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/1365340741882351637
📝 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.
- amontagu_api, 4 hours ago, 25 messages
Hello there
Hi
Taking a look
Okay I'm not sure I quite understand what is unexpected here. Can you clarify? The most recent update to that Subscription Schedule took place in https://dashboard.stripe.com/test/logs/req_7n9chrCdrUitPi and we can see in the POST body that there is a coupon in every phase except the current one.
The dashboard say that the coupon is deleted
and when using simulation the coupon is not correctly applied
Can you show me the Invoice where it was not correctly applied?
Supprimer un bon de réduction = Coupon deleted in english in my screenshot
I need to create a new simulation
That Subscription only has one Invoice which is from the initial Checkout Session with no coupon applied
Sure, feel free to create a fresh Subscription in test mode and share that with me
simulation running
Will send you ASAP the invoice and screen shot
in_1RHntHAkOifTwFLtg00JGEsR
it's weird because it was not applied for june invoice but apply for the july one
Looking
I continued the simulation and the others month doesn't have the coupon neither
Why are you using a bunch of separate phases here? Why not just use a single repeating phase?
What are you trying to do exactly?
Like you are just passing in the same items and coupon to all of the phases so it doesn't really make sense to me what you are trying to accomplish.
Because in my previous thread opened in this server than what someone from stripe told me to do
Why though
at the origin I had a permanent coupon not an only once and I specified the end_date dynamically
What are you actually trying to accomplish?
Each time a new user use the sponsor code of an other
We offer 50% of the subscription to the sponsor
but 50% of a month each time the code is used
so if it's used 3 time the same day the discount need to be available for the next three months
so each time the code is used I need either to increase the time of a phase or create a new phase.
I tried to extend the phase at the begining with a permanent coupon but end_date of the phase was not taken into account and it was applyed forever
I ask in this discord and support told me I had to create an only once coupon and create a new phase each time
The simplest way to do this would be to just apply a repeating coupon without using a Subscription Schedule at all.
This feature is deprecated
Ugh yeah I suppose it will be deprecated in future API versions, did forget about that...
Hmmm okay
I do agree that the behavior for the Sub you provided seems unexpected so I'm still looking at that.
Alright from looking at our internal logs it looks like the test clock is removing/adding the coupon on each cycle but it shouldn't be doing that. Unfortunately, this appears to be a test clock bug as far as I can tell.
Alright but I am afraid it will do the same without the test clock
Because as shown in my first screenshot the Dashboard display a message that say the discount is deleted before running the test clock
so I think normal timeline will do exactly the same
That is expected there though because you have a once coupon applied through August but then your Schedule ends
So then the coupon is "deleted" in a sense -- it isn't applied for September because the Schedule releases
It seems that the test clock is skipping the duplicate action of removing the previous discount and re-adding the same discount. I would bet that if you tested using two different coupons (both doing 50%) off and switched back and forth between them you would see the expected behavior.
I'll ask our Eng team to confirm that this is isolated to test-mode w/ test clocks.
But as far as I can tell, that's the case.
The other thing you could do here if you want is just use two phases with a coupon with duration: forever and then have the second phase set the Subscription back to not using a coupon
So like Phase 0 would be April - August with a coupon (you would use iteration: 5 or whatever length you want) and then phase 1 would be the same items but without the coupon
I see, the last support eng told be that I was be able to reuse the same coupon but maybe not as it is only a "once" (that what I understood reading the option)
I think the once aspect is messing with the test clock
That's my hypothesis
But hard for me to say unfortunately...
Yes I was starting doit that at begining to go over the end_date no being respected using a forever coupon but it seemed wrong
Did you set a final phase without the forever coupon?
If not, the coupon would continue to apply as it would still be there when the schedule finishes
I was but it seemed wrong (meaning I thought I was not using it correctly)
If you have an example of going that route then I'd be happy to look at it
I'll still file a ticket internally to get this other behavior looked at.
In your opinion, Should I try like this in production and see if once coupon correctly respected or should I have a phase after the phase with the forever coupon ?
I personally think the 2 phases using a forever coupon will be cleaner. It also should allow you to test in test mode right now to ensure it behaves as you want
I do not have an example right now but I can have it in the following hour I thing as I had the code
okay will do then
Thank you
Sure thing. Feel free to circle back if you don't see the behavior you expect going that route and someone will be around and happy to help.
Ah one second
@loud flare you still there?
yes
Okay I just noticed that for the example you shared the Test Clock looks like it initially had its frozen_time for June 21st: https://dashboard.stripe.com/test/logs/req_hWlo73zrt8wGbE
I'm wondering if that messed with things here since the Test Clock wasn't frozen for the same time as the actual Subscription creation
And thus it messed with the phases as its timing was after a couple phases already passed
Hum I see
But it still doesn't explain why the dashboard say the coupon is deleted before runing the Test Clock
I still think that relates to the initial once coupon
It might be worth doing one more test where you ensure the Test Clock is set to the correct frozen time
Before you spend time refactoring your code
So I'd create a Customer, create Test Clock, create Sub, create Sub Schedule, advance time