#ChrisR-invoice-upcoming

1 messages · Page 1 of 1 (latest)

dull laurel
#

hello

#

ah I think I understand the scenario but could you detail this with a couple of dates to help concretely understand?

this part:

"If you make these licence amends, it will cost you $1.00 now"
"And then your subscription will be $30.00 p/m going forwards"

like what is happening at what time and when are you showing the Customer the upcoming Invoice amounts?

broken gazelle
#

like what is happening at what time and when are you showing the Customer the upcoming Invoice amounts?
So the user decides they want to add more licences to their subscription.

They go to a page with a couple of HTML inputs, one for "Teacher licences", and one for "Student Licences".

When they increase the number in either of these inputs, we call the Stripe::Invoice.upcoming API to see what this change will do to their subscription.

This is before they've confirmed and paid for these licence changes.

#

I hope that helps.

dull laurel
#

yes the upcoming Invoice endpoint supports that

broken gazelle
#

That's what we're using currently.

But this only tells me about changes to the current billing period invoice.

For example if the user has an active sub with 5 Teacher licences, and 10 Student licences, and then they want to add 1 more "Teacher Licence", the upcoming API will give me:

  • the unused time on the original 5 licences
  • the time remaining for the 6 licences,
  • provide a overall cost difference between the two.

But as this is only for the current billing period, it doesn't tell me what the recurring, per month, cost will be to the end user for the subsequent billing periods.

And it is this value I'd like to get hold of.

dull laurel
#

ah got it, yeah that isn't supported

broken gazelle
#

Do you know if there is a way of getting this information by another means?

I could calculate the cost myself, as it just some simple multiplication. But that wouldn't take into account any discounts/promo codes the user has on their sub. When you start adding those in, it starts to be a bit more complicated.

#

I was thinking I could use the Stripe::Invoice.upcoming to preview what a brand new sub would cost, but use the new licence quantities, which I assume would give me what I want.

So I'd end up with two API calls.
One Stripe::Invoice.upcoming call using the current active subscription details and the new quantities. This gives me the cost of the changes for the current billing period.

Then another Stripe::Invoice.upcoming call using the same subscription_items but for a brand new sub, which would return the overall monthly cost.

#

It won't take into account any promo codes active on the user's active subscription, but it's one step closer.

And I'll deal with the promos if becomes an issue.

#

It's the end of my day here now, so I need to go. I'll check this again first thing tomorrow, see if there are anymore messages.

Either way, thank you for your time; Greatly appreciated.

dull laurel
#

np glad to help

#

and yeah I'm not sure there is a way to do what you're suggesting unfortunately