#nasty_upcoming-coupon
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/1304500410244923412
๐ 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.
- nasty_subscription-promotioncode, 19 minutes ago, 29 messages
- lil_subscription-coupon, 23 hours ago, 14 messages
- lil-nasty_api, 1 day ago, 12 messages
Seems to me like the discounts functionality needs some attention. Results/behavior is not logically coherent in some instances.
Happy to help but can you take a few minutes to clearly explain the exact issue all in one clear message? Please don't send many short sentences (a lot of people do). Just organize a clear summary with exact information, exact JSON response in a gist or similar and what you are confused about
nasty_upcoming-coupon
Sure, I'll collect the details and reply shortly
create subscription req that results in latest_invoice having subtotal before discount applied https://dashboard.stripe.com/test/logs/req_NsfcvKH87uRUcl
upcoming invoice request that results in invoice.subtotal being subtotal after discount applied https://dashboard.stripe.com/test/logs/req_y5z9QN15f8C093
You can view the latest_invoice result in the create sub request. It results in a subtotal that is prior to discount application.
When I retrieve an upcoming invoice with the same discount the invoice subtotal is after the discount is applied I'll attach a screenshot.
This is inconsistent. Is it expected behavior or a bug?
Sorry this is helpful but far from enough. That second request is a GET request and doesn't store any response I can see. I will need a clearer question with the exact raw JSON for both, in text, not as a picture, with a clear explanation of what is different between the two exactly so I can look at each one and compare
The subtotal on the create-subscription is before discount is applied. The subtotal on retrieve-upcoming-invoice is after the discount is applied.
Thanks, I'm looking to try and debug (note that second thing is a weird dump that's not valid JSON)
Okay you are making different API requests here
When you call the Upcoming Invoice API you are passing the PromotionCode inside items, but when you create the Subscription you are passing it top-level. The logic works differently in that case
Pass https://docs.stripe.com/api/subscriptions/create#create_subscription-items-discounts instead if you want to match what you are doing on the Retrieve Upcoming Invoice
Ok, it's still logically incoherent to return an invoice that's been discounted with the subtotal before discounts and then in another instance when retrieving an invoice to return the invoice with the subtotal after the discounts are applied.
I've implemented a check that will make the math work, but this doesn't make sense to return in 2 different formats for a discounted invoice.
Regardless, I've resolved this in my code, but I still think there should be some inspection done on discount behavior.
I don't require further assistance on this.