#mick23_proration-logic-for-upcoming-invoice

1 messages · Page 1 of 1 (latest)

sick spearBOT
#

👋 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/1346969219010658335

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

dire stirrup
#

Summary: Updated Subscription Line Item Quantity via API, removed via Stripe Dashboard, rinse and repeat while I got the code working. And when I check in the Stripe Dashboard, the Invoice Calculation looks way way way too high given everything was done within a 24hr period to get things working.

sub_1QxV8jE9qTMxDj1EixKxaTpq (Test)

#

Not sure if it's either something I've done wrong on the implementation? Something prorations I've missed? Or the draft invoice not quite showing the correct info yet?

#

Or some other setting I've not configured properly.....

#

Thoughts?

tropic kernel
#

Hi there. Could you unpack what you mean by "the Invoice calculation looks way too high"? What are you expecting, and what is actually happening?

#

by "invoice calculation" do you mean the amount on the Invoice from this Subscription?

dire stirrup
#

Expecting ~1.1 of a month of Price X

#

So I've been testing with 1x full time subscription

#

And I've been building out the Add User functionality in SaaS app (aka. +1 to Subscription Item Quantity)

#

So the +0.1 cost would be the backwards and forwards adding/deleting the prorated usage for the last 24 hrs or so

#

The invoice amount I'm seeing is more like 5x

tropic kernel
#

Digging into this

#

Also, what is your goal? What do you want to achieve?

dire stirrup
#

Thanks

#

Just basic SaaS functionality for Add/Remove User ultimately, when charged on a per-seat basis

#

I've only got the API integration bit working for the Add User bit so far, hence why I've been reducing the Subscription Item Quantity via the Stripe Dashboard for the moment.

tropic kernel
#

So the price per seat for price_1QEu2rE9qTMxDj1E8PdLLlbu is 500 GBP - after the final update to the Subscription, the quantity of the Subscription's item is two seats (1000 GBP) which is what we see on the upcoming Invoice

dire stirrup
#

That's what I would expect right now, 2x users

#

I'm assuming, but can't confirm, that this is probably just a caching issue as I can see on that same link "This is a preview of the invoice that will be billed on 28 Mar. It may change if the subscription is updated."

#

And based on what you've said, it seems you can see something different than I can

tropic kernel
#

Oh apologies, I think I grabbed the wrong Subscription id.

#

This makes more sense

#

Basically, when you update the Subscription, we create prorations for the update unless you tell us not to and the amount on the upcoming invoice for sub_1QxV8jE9qTMxDj1EixKxaTpq is the result of the prorations for all those updates

#

There is a doc that explains this in some detail, which I'll include, but for what you want to do here, there is a parameter called proration_behavior that will turn off prorations at a per-request level

dire stirrup
#

So as I understand it, Proration is by default turned on, i.e. partial monthly payments if Users are Added or Removed throughout the month. Seems like a sensible and fair pricing model.

#

So I'm not wanting to turn that off.

#

What I'm confused about is why I'm seeing a ~£2500 view of the Next Invoice, when i'd expect to see the ~£1000 amount.

tropic kernel
#

I would strongly recommend reading https://docs.stripe.com/billing/subscriptions/prorations#how-prorations-work

The upcoming Invoice shows charges for changes in the Subscription (periods of time when it was subscribed to x quantity of the price) as well as credits for unused time between the previous Invoice and now, as well as the quantity for the month ahead.

I guess my question is - for the add/remove seats functionality - do you intend to give your users access to make those changes whenever they want, and for that to generate prorations?

dire stirrup
#

Yeah I've had a read of those links

#

I'm not picking up what I'm missing

#

"I guess my question is - for the add/remove seats functionality - do you intend to give your users access to make those changes whenever they want, and for that to generate prorations?"

Yes

#

So an Elevated User in the SaaS App would give a User the ability to "Add New User" or "Remove Current User" - Which would essentially change the Subscription Item Quantity in Stripe, whenever they choose.

tropic kernel
#

The sum of all the prorations and credits for the period from the last update on the Subscription through the end of the period are 1,218.34 GBP

#

and then there's another 1000 GBP for March 28 > April 28

dire stirrup
#

Interesting, that sounds about right

#

So then the question is..... Why does it show for the Upcoming Invoice as "£2,662.01" ?

sick spearBOT
dire stirrup
#

How come I am seeing something different than you are?

wide holly
#

Hi hi! I’m going to be taking over for my colleague here - let me just read back.

dire stirrup
#

Probably easier to read in reverse for ease as I think we've almost come to a conclusion

wide holly
#

Yup, or have you summarize - should've done that. 😅

#

So it looks like palamedes pretty much had it - the total of the prorations for the period - i.e. the 'changes in number of seats' that were done today - are the reason the upcoming invoice shows the price it does.

That seems to be what you want to do, ya?

dire stirrup
#

🤣 Yes, so the summary is, why am I seeing the Next Invoice as the ~£2600 figure VS the figure you're seeing as the ~£1100 figure?

#

I'm going to take a stab on this that when I look tomorrow, everything will be magically aligned

wide holly
#

I don't see an 1100 figure - I just see the full amount like you do.

#

The reason why is that that amount is the total of the computed prorations during the current billing period, plus the next period's amount - which is how prorations normally work.

dire stirrup
#

Right ok. So if you think that amount if correct for the £2600 figure. Then I guess I need to understand how that calculation is made so I can accurately inform customers.

#

Have you got a handy link which explains this? As it's not clear from what I've read and implemented so far

wide holly
dire stirrup
#

For context, what is in my head.... in simple terms.... For a 30 day month, if I Add then Delete a Licence over a 1 day period, then I'd only be billed for 1/30th of a Price.

#

Yeah I've read that link, it still isn't making sense

wide holly
#

If you add up all the proration elements, you'll see it makes up the other 1.2k pre-tax.

dire stirrup
#

i.e. say;

1x Licence = Full Month
+1x Licence = Half Month

Billing = 1.5

#

"If you add up all the proration elements, you'll see it makes up the other 1.2k pre-tax."

Let me check that, I'm just looking at the final amount on the invoice which is the £2.6k figure

wide holly
#

Ignore the tax.

#

...So it's a 2.2k figure

#

Which is only 1.2k more than the 2x seats they're set up for going forward.

dire stirrup
#

Ah right, just done the maths - yeah ignore tax, it's essentially 1.2 + 1k

#

So the 28th March Invoice is essentially <28th March Increases/Decreases + >28th March Payment Up Front

wide holly
#

Yes, exactly that. The 28 March invoice will capture any changes made prior to the upcoming invoice date, PLUS the period from 28 March-28 April.

dire stirrup
#

Got ya, that makes 100% sense now!!!

#

Got to say, please add a to-do list item for internal team to knock up a diagram to explain this - that's super confusing 🤣

#

But completely makes sense now talking it through. Just docs don't make this explicitly clear.

wide holly
#

Awesome - and sorry about that! Prorations are a complicated animal.

dire stirrup
#

Yeah, I noticed that in the first sentence of those docs "The most complex aspect of changing existing subscriptions are prorations" 🤣

#

Right, that's all fine for now. Now that I know the formula for this, I know that what I've implemented is correct.

#

That's the main thing!

#

Thanks for your help, as always, really appreciate this Discord channel for getting clarity on this complexity.

wide holly
#

You're very welcome - and I'm glad you've got something out of it. 🙂

sick spearBOT
#

mick23_proration-logic-for-upcoming-invoice

dire stirrup
#

One final follow on. So the calculation for the <Invoice Date, must be calculated based on the Previous Billing Date (i.e. <1 month) + CurrentDate()

#

i.e. so even if the Quantity was Increased, then Decreased for User 2 on the Same Day, Assuming this was half way through the month, then that would result in a 50% charge? Rather than a 1/30th Charge?

wide holly
dire stirrup
#

Got ya, so essentially, yes, it would be the 50% rather than the 1/30h figure

#

Right, as long as I know how it works

wide holly
#

Each item is looked at individually - so when you changed from 1 to 2, they get a credit for the remaining time they already paid for at 1 seat (from March 5 when the change was made until March 28), and then they get a charge for the 2 seats (from March 5 when the change was made until March 28).

dire stirrup
#

Sorry, for the purpose of clarity, could you re-phrase that response in the context of "I'm the Supplier" as Debit/Credit terminology is very contextually dependent.

#

i.e Company & Customer

#

I "think" I understand what you mean, but not 100%

wide holly
#

Replace 'debit' with 'charge'.

dire stirrup
#

So "Charge" essentially = "Company Revenue"

wide holly
#

(edited my original)

#

Yes.

#

Credit is "contra revenue" (or just ... like not revenue lolz)

dire stirrup
#

So "Contra Revenue" in laymans terms = Refund from Company to Customer?

#

Googling this, that seems to be true.

#

I'm not as familiar with Latin phrases such as Contra given I wasn't born 2700 years ago 🤣 (Not your fault, seems to be a deep dive financial term I've not crossed passed with to date!)

wide holly
#

Sorry, I was previously an accountant before I was a software engineer. 😂

dire stirrup
#

I can tell! 🤣

wide holly
#

But yes, each change will have a positive and a negative.

dire stirrup
#

Is there a documented formula for this?

#

Conceptually I get it, the the nuances I'm struggling to piece together

#

What seems to be the case is that if I add and remove a user within a billing cycle, for only 1x day, that they would essentialyl be charged for 50% of the billing period (assuming half way through the month/billing cycle)

#

As long as I understand that is accurate, then I can communicate with customers accordingly.

#

i.e. imagine someone incorrectly adding/removing/re-adding users, it could result in a fairly sizeable charge for no added value for the customer.

#

Prorated calculations are easy with single seat, it's the multi-seat formula I'm not familiar with

#

I'm assuming this is where the custom prorated calculations via API calculations come into play to deal with this nuance to handle things perfectly vs glossing over the nuances in the First Month?

wide holly
#

You shouldn't have to do anything to compute things, we should have that.

dire stirrup
#

I think the discrepancy I'm trying to wrap my head around from an Individual User perspective, assuming I join 50% way through the billing cycle, I'm essentially charged 100% of the cost. If I've understood how things work.

#

i.e. imagine like a Family Gym Membership for easy understanding.

#

Bob + Mary = 2x Users

#

Then 50% way through January, they introduce Alice

wide holly
#

In this case, the customer went from 1 seat for 5 days, to 2 seats for ~23 days, so there should be more, but I would expect about 0.4k, not 1.2k

dire stirrup
#

If I've understood things correctly, they would end up with 3x price, not 2.5 price?

wide holly
#

When you changed it from 2 to 3 seats for Alice, the customer would get a 50% credit on the 2 seat plan they already paid for ( -1,000 / 2) and then be charged 50% of the new 3 seat plan (1,500 / 2).

So overall they should end up with -500, +750 => 250 more for that month, which maps because that's half a seat-month.

#

I'm still talking & thinking about this because I also feel like this is a bit weird.

dire stirrup
#

OR is it more modelled on the traditional accounting model of daily calculations of usage, like interest model calculations etc. (sorry to bring back deep financial calculation stuff...)

#

It's a complex topic, I appreciate

#

You can imagine a graph or chart or something in the Stripe Dashboard to help visualise this kind of stuff. i.e. Product/Price X;

User 1 ..........
User 2 ..
User 3 ... ..
User 4 .....

etc.

sick spearBOT
dire stirrup
#

Read Bottom to Top @bold heron

#

TLDR;

See last comment

#

Essentially, what's the formula for the calculations

wide holly
#

What do you mean when you say "what's the formula for the calculations"?

dire stirrup
#

For this context, it's per-seat, not Usage Based - but I do understand those kinds of calculations like on AWS Billing etc.

sick spearBOT
bold heron
#

Hi @dire stirrup I'm taking over this thread, give me a sec to go through the previous discussion.

dire stirrup
#

Ah, sorry @bold heron Can you just add back in @wide holly I think I have a financial question.....

#

I think it's basically about Accurals VS PrePayments in Accountancy Terminology

wide holly
#

(That's probably a question for your accounting team or accountant; I'm pretty sure we're in different countries 😂)

#

(:delurk:)

dire stirrup
#

Probably, but conceptually should worlk the same globally

#

Credit/Debit stuff essentially

#

I think I'm starting to understand

bold heron
#

Hi @dire stirrup I'm happy to continue helping you. Is you question about how the prorations are calculated for the upcoming invoice of sub_1QxV8jE9qTMxDj1EixKxaTpq ?

dire stirrup
#

In essence @bold heron I'm struggling to understand the formula behind the calculated invoice in Stripe so that I can effectively communicate this to my customers.

#

Speficically in a SaaS Per-Seat Licenced Environment

#

When the Customer has complete automy for Adding/Removing Users

#

So that when I get asked "Why has my Monthly Billing Increased to £X?" that I can provide a sensible response.

#

At present, I only understand this conceptually.

#

Not formulaically.

#

So I can't effectively have that conversation until I can understand this.

bold heron
#

Thanks for the context, let me take at look at this subscription and I'll get back to you.

dire stirrup
#

Thanks. I'll probably be logging off shortly so I may pick up conversations tomorrow ( I think these threads get closed automatically so I'll have to open another one and link to this one).

#

Pro-Rata makes complete sense on a Singular calculation i.e. 1/30th of Month etc.

#

But I'm struggling to understand the calculation when someone is Added To 50% of the way through the Month, i.e. it would seem they are charged for 50% they HAVEN'T used..... From what I understand. But perhaps that's just my lack of understanding of the formula. I'm struggling to find this info in the docs - hence this chat.

#

Anyhow, I'll pick up this conversation tomorrow and have a read through the response so I can hopefully understand fully and communicate this with customers.

bold heron
#

Thanks for the waiting. Looks like you made lots of changes to the subscription on 5 Mar