#numericity

1 messages · Page 1 of 1 (latest)

final wigeonBOT
terse oak
#

Hi there 👋 what's your question?

wise jolt
#

Hey @terse oak

#

In my web-app, in the billing page, I display a list of prices to my users

#

These users may or may not have a coupon stored against them

#

Is there a way i can display a preview of the cost to the users without having to make multiple calls to upcoming invoice endpoint?

#

I tried adding all the prices as subscription_items to a single invoice, but when a coupon is applied, it only applies to the entire invoice

terse oak
#

Coupons by default with only apply to Invoices. They can't be applied to singular Invoice Items unfortunately. When you say you're making multiple calls to the Upcoming Invoice API, why do you need to make more than 1?

#

FWIW, I don't think there's a better way than using Upcoming Invoices, since this is exactly the type of thing it was designed for, but I also wonder what the use-case is for having to call it multiple times

wise jolt
#

I want to display a list of prices like this:

#

And if the user has a 50% off coupon for example, I'd like to display the correct price

#

Or should I just retrieve the discount object from Stripe, and manually apply the discount my end?

terse oak
#

Ahhh, I see. I think you would need to use the Upcoming Invoice API in order to do this, since the discount isn't actually applied until the Invoice gets finalized

#

So I don't know if there's a better way to do this than the one you've already described

wise jolt
#

Sorry, which way? The multiple calls to upcoming invoice, or fetching the discount and applying manually?

terse oak
#

The multiple calls to the Upcoming Invoice API. If you were to fetch the discount and apply manually, that could get messy and there might be edge-cases where the Invoice gets updated and the net amount you calculated is not the same as the net amount of the Invoice.

wise jolt
#

Yeah, that was my concern

#

I'd be surprised if this hasn't been requested before, but it'd be great if there was a process for previewing multiple prices in a single API call

terse oak
#

Yeah, I hear you. It would be nice to be able to get all of that in one payload.

wise jolt
#

Especially as my prices are multi-currency too. So there are a lot of prices to try to handle

terse oak
#

That's fair. I assume the UX depends on these being shown up front instead of simply showing the net amount after the customer clicks into one of the tiers?

wise jolt
#

Yeah, exactly. The user will see a list of these up front, then click through to put in card details etc

terse oak
#

Gotcha. Yeah, I can't really think of a workaround here. Upcoming Invoices seems to be the best avenue to get what you're looking for