#amontagu_unexpected

1 messages · Page 1 of 1 (latest)

solemn charmBOT
#

👋 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.

loud flare
bright nymph
#

Hello there

loud flare
#

Hi

bright nymph
#

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.

loud flare
#

The dashboard say that the coupon is deleted

#

and when using simulation the coupon is not correctly applied

bright nymph
#

Can you show me the Invoice where it was not correctly applied?

loud flare
#

Supprimer un bon de réduction = Coupon deleted in english in my screenshot

#

I need to create a new simulation

bright nymph
#

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

loud flare
#

simulation running
Will send you ASAP the invoice and screen shot

#

it's weird because it was not applied for june invoice but apply for the july one

bright nymph
#

Looking

loud flare
#

I continued the simulation and the others month doesn't have the coupon neither

bright nymph
#

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.

loud flare
#

Because in my previous thread opened in this server than what someone from stripe told me to do

bright nymph
#

Why though

loud flare
#

at the origin I had a permanent coupon not an only once and I specified the end_date dynamically

bright nymph
#

What are you actually trying to accomplish?

loud flare
#

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

bright nymph
#

The simplest way to do this would be to just apply a repeating coupon without using a Subscription Schedule at all.

loud flare
#

This feature is deprecated

bright nymph
#

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.

loud flare
#

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

bright nymph
#

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.

solemn charmBOT
bright nymph
#

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

loud flare
#

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)

bright nymph
#

I think the once aspect is messing with the test clock

#

That's my hypothesis

#

But hard for me to say unfortunately...

loud flare
#

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

bright nymph
#

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

loud flare
#

I was but it seemed wrong (meaning I thought I was not using it correctly)

bright nymph
#

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.

loud flare
#

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 ?

bright nymph
#

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

loud flare
#

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

bright nymph
#

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?

loud flare
#

yes

bright nymph
#

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

loud flare
#

Hum I see
But it still doesn't explain why the dashboard say the coupon is deleted before runing the Test Clock

bright nymph
#

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

loud flare
#

I mean, if the test clock need to be set before creating the sub it may create issue for futur dev
I prefer refactoring and having something that always work

#

the code is already ready
I am testing it now