#nasty_upcoming-coupon

1 messages ยท Page 1 of 1 (latest)

rain schoonerBOT
#

๐Ÿ‘‹ 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.

restive orbit
#

Seems to me like the discounts functionality needs some attention. Results/behavior is not logically coherent in some instances.

ruby hamlet
#

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

restive orbit
#

Sure, I'll collect the details and reply shortly

restive orbit
#

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?

ruby hamlet
#

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

restive orbit
ruby hamlet
#

Thanks, I'm looking to try and debug (note that second thing is a weird dump that's not valid JSON)

restive orbit
#

There's the valid json for the retrieve upcoming, sent stringified before, my bad

ruby hamlet
#

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

restive orbit
#

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.

ruby hamlet
#

I mean it does make perfect sense and matches the right way to do accounting here. I get that you disagree but that doesn't mean it is incoherent!

#

But glad we were able to figure out the discrepancy!