#vien
1 messages · Page 1 of 1 (latest)
Usually the upcoming invoice should give you what you need - can you share the request ID and the output from your upcoming invoice request?
so my subscription has two items, and i try to retrieve upcoming invoice for each item, but i give me upcoming invoice for both when i using this Stripe::Invoice.upcoming(subscription:"sub_1NaHsqH5ocKrGenqMphhcajD", subscription_items:[id:"si_ON1w5smq9SaeXd", quantity:13])
i would like to get the total amount before discount like in the screenshot: 1277$
and when i tried to get subscription_item upcoming invoice without passing subscription, i got error: Stripe::Invoice.upcoming(subscription_items:[id:"si_ON1w5smq9SaeXd", quantity:13])
Stripe::InvalidRequestError: You cannot update a subscription item without a subscription.
Instead of using the upcomign invoice for that all you'd have to do is retrieve the price and multiply it by the quantity yourself
but my price has tier, so i have to loop through each tier and multiply with correct quantity
wonder if Stripe can help me to do that quickly.
but if no solution from stripe, i have to do by myself then
Ah right I forgot that you had mentioned the tiers
You could try doing the upcoming invoice request and passing in the following:
- the subscription items and quantity you want
subscription_proration_behavior: none- and
coupon: ""
I havne't tried it, ubt that shoudl get you closer to the calculations you want