#gallopinggoose_unexpected

1 messages ¡ Page 1 of 1 (latest)

runic sunBOT
#

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

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

steel ridge
#

The behaviour is best displayed by looking at in_1S0WLs2k4WuoSsumCPlKJerd -> in_1SJ0eb2k4WuoSsumawNA76rx -> in_1SKSZ52k4WuoSsumbIOB9k3e
in order

limber spade
#

Can I ask for a clearer example with numbers if possible?

#

It is not easy to try and grasp your intent from 3 separate complex objects.
If you could say Nov 1 customer pays $X for quantity 3, Nov 2 customer goes to quantity 4 I expect them to pay $Y but they [aid $Z for example

steel ridge
#

Yes, sure. (calculations arbitrary)
A subscription starts with a quantity of 95 on June 1 with a coupon of 50%. On June 15, they increased their quantity to 96, and their invoice for the upcoming month looks like this:
-Remaining time on 96 × Essential after 15 June 2025, 96, $6,701.09
-Unused time on 95 × Essential (with 50.0% off) after 15 June 2025, 95, -$3,315.64
This is expected to prorate the original coupon and charge remaining time without the coupon (assuming because coupon wasnt included in the update and it doesnt carry over)

limber spade
#

yeah basically the way quantity updates work is that we bring the quantity down to 0 and calculate the "credit owed" and then we bring back the quantity to the new value
So if the Coupon/Discount is not active anymore you don't get that discounted amount on the new quantity

steel ridge
#

On July 15, they increase the quantity again to 97. Their invoice for the upcoming month looks like this:
-Remaining time on 97 × Essential (with 50.0% off) after 15 July 2025, 97, $2,816.20
-Unused time on 96 × Essential after 15 July 2025, 96,-$5,574.34

This is unexpected because where is the 50% coupon coming from if it was removed in the previous update?

limber spade
#

Okay, which of your Invoices has that behaviour?

steel ridge
#

The update body for each instance wouldve looked like:
{
"proration_behavior": "always_invoice",
"quantity": "96"
}

{
"proration_behavior": "always_invoice",
"quantity": "97"
}
with no coupons indicated

steel ridge
#

The other two invoices I included had expected behaviour to chronologically show: expected -> unexpected -> expected

limber spade
#

(looking)

steel ridge
#

Thanks, appreciate you

limber spade
#

Okay I can't pinpoint why it's doing this. It looks like a real bug to me
I've seen this before over the years where the Subscription incorrectly has a "last coupon used" cached that is outdated though I thought we had fixed it. I do recommend writing in so someone can investigate further

steel ridge
#

Haha its actually the behaviour that I needed and was trying to figure out how to recreate it. If I want to preserve the coupon throughout updates, I need to pass it in all the subsequent updates correct?

limber spade
#

yes

#

but it would apply to both the credit and the unused time

steel ridge
#

Will passing the coupon this way refresh its duration? For example if the 50% coupon had a duration of 1 month and was intended to only only be used for the monthly subscription June 1-30, will having it in the update on June 15 update its validity to June 15-July 15?

limber spade
#

hum it really depends what those words mean unfortunately

#

Our API has a Discount which is what is created after you use a Coupon to "record" the intent to discount something. So when you add that Coupon to a Subscription for example, what you get is a Discount object and it has an end date.
So if you passed a Coupon again it would refresh the Discount. But it also shouldn't be needed if your Subscription already has the Discount still ongoing.
But when I looked your Coupon had duration: 'once' no?

steel ridge
#

Right, I was thinking if the coupon had duration = 1 month for example

limber spade
#

in that case the Coupon would create a Discount that lasts a month

steel ridge
#

Yes thats what I thought, so we wouldnt be able to use coupons with set months duration in that case

#

"But it also shouldn't be needed if your Subscription already has the Discount still ongoing."
But in the case that I didnt pass the coupon, the discount would have been removed correct? So really the only option to mix coupons with prorations is having them duration: 'once' (or forever)

limber spade
#

hum I don't really follow I'm sorry

#

If you have a Discount on the Subscription it applies to your proration items (both)

steel ridge
#

I think Im understanding. In my case, the coupon only had a duration of 'once' so the Discount it created only applied to the amount of the subscription at start. In an update on June 15, I had not included the coupon in the update so no further discounts were applied to the new prorated charge because the Discount had expired.
If the coupon had a duration of 1 month, and was applied at the start of the subscription on June 1, it would create a Discount with end_date = June 30. In the update on June 15, even if I dont include the coupon in the update, the discount would appl y to the new prorated charge because the existing Discount goes until June 30 and doesnt get removed by the quantity updating.

limber spade
#

correct!

steel ridge
#

And if I had included the 1 month coupon on the June 15 update, it would create a (new?) Discount with end_date = July 15. Effectively giving the subscription the Discount from June 1-July 15

limber spade
#

I think so yes, I recommend testing that one

#

I do have to run unfortunately but we reopen on Monday and you can contact support for questions about this on https://support.stripe.com/contact otherwise!
Hope you have a good week end!

steel ridge
#

No worries, thanks for all your help. Have a good weekend! May you never have blue shells in your future