#3hx_error
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/1415699623804407838
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
If you need anything else - let me know ๐
Hi, can you share the exact error you're seeing? Can you share the request id when you attempted to make that GET call?
It's not an error in the API as such, the API works just fine (I get a 200 OK from the api response).
It's the Stripe.net c# package that has the problem.
My logs don't store the request ID's
Becuse the duration of this code is 99,999 months (was my workaround for indefinite being deprecated)
The stripe.net package I guess is adding the 99,999 to DateTime.Now which results in c# throwing an System.ArgumentOutOfRangeException
I guess the stripe.net package is doing this check to ensure that the coupon is still valid
It makes sense now that I come to think of it.
But it's still an unhandled exception in the stripe.net package because you should never be allowed to exceed the DateTime.Max object
I do not have a .net environment running but I'm trying this using Node to see if I get an error.
I'm trying to follow your reproducable steps but I'm unable to even select 'repeating and Duration in months = 99,999.' Are you able to use the API, https://docs.stripe.com/billing/subscriptions/coupons#coupon-duration ?
It looks like you can pass 'forever': https://docs.stripe.com/api/coupons/object?api-version=2025-04-30.preview#coupon_object-duration
Hey there stepping in for pgskc as they need to step away, but i infer that forever is not an option here due to the removal for amount_off coupons
I can report this bug internally, since valid params shouldn't cause event parsing errors, but in the meantime I would suggest using a smaller duration in months
.NET's datetime maxvalue is end of day December 31, 9999 so exceding that feels like overkill. But i love the optimism for customer retention
https://learn.microsoft.com/en-us/dotnet/api/system.datetime.maxvalue?view=net-9.0
๐
Even 1200 months, 100 years from now, would be well within the max range
I've fixed it by using a percentage discount forever instead of an amount off
๐
Was a weird one I thought i'd future proof by a few thousand years ๐คฃ
There are good reasons to use amount vs percent, so dont let this deter you from using amount if thats what you want
Thanks for reporting, its certainly an unexpected outcome. Probably that duration should be limited to more reasonable values.
For what I was needing, % off is all good mate thanks
Yeah for sure. It took me a few hours to find it, but some other people might not be so lucky
Yep, will see what we can do to address it. Not sure if there's a longer datetime type though ๐คท
Nah there isn't, this is a .Net thing. Their MaxValue cannot be exceeded
Unless the Stripe.net code base could be altered to handle the exception
If it's out of range in the upper end then it's still a valid code
I could write a fix for it if you guys need. Let me know ๐
Can you share an example checkout session id (cs_test_123) that this coupon was applied to? Helps to have a concrete example when reporting the issue internally.
Or one of the webhook event ids (evt_123) that failed deserialization
Oh wait, it was a retrieval of the session, not a webhook
so yea, just the session id then
cs_live_b1prE0a5QHafexxyEOnVgZEiChpwB9IfwBz8Kn49BDd4axAMzAcD4igSr0
I've since deleted the code that was used
But this is how it was set up, instead with SUYC as the customer-facing