#Jeremy-subscriptions

1 messages ยท Page 1 of 1 (latest)

true plank
spice gust
#

you do have to use invoices and look at each line item to calculate revenue I would say

#

each line item points to the information about what is prorated/charged

hearty valley
#

I did but that didn't work

spice gust
#

It should, it's just a lot of work and dozens of edge-cases

hearty valley
#

this is wrong, they only paid $130.09 for this subscription

#

I don't want to use Rev recognition, it's for the client, not me

#

They need to understand their cost

spice gust
#

Yeah I'm sorry I don't really understand. This is definitely what they paid

hearty valley
#

the reason why they paid less is because they change the subscription. E.g. They purchase a sub for 147 (for the month), a few days later, they reduce the quantity (generating credits), then a few weeks later they increase the quantity (this use some of that credit, hence no invoice generated), at renewal they pay 225 and reduce amount...

#

You need to understand that clients have multiple subscriptions

spice gust
#

I know but if they had credits the invoice amount would be lower

hearty valley
#

it won't, because credit will be used for another subscription

#

they have plenty of subscriptions, all with different billing cycles and quantities

#

1 client, multiple subscriptions

spice gust
#

I'm sorry, you seem really deep in something and convined something doesn't work but there's no real actionable info. You shared a screenshot of 5 invoices amounts and that's it

hearty valley
#

nothing is wrong

#

I need to calculate how much each subscription cost the client

#

The client has multiple subscriptions (1 per product) and he needs to know how much each product cost him in services.

#

I don't know how to calculate this, looking at invoice line won't help as negative amount is not created in invoices unfortunately

#

otherwise this would have been easy, look at each line item

#

but credits back to the stripe client is not tracked as invoice line

#

I'm looking for help as to the best work around/approach

spice gust
#

Can you take a concrete examples? You keep saying "doesn't work" and I don't get why

hearty valley
#

how do I calculate how much subscription A generated? (the invoice line will only show $100, but it only generated $75)

#

hehe was doing it ๐Ÿ™‚

spice gust
#

So why would the invoice line only show $100? The +$25 would directly be reflected on an invoice and reference that subscription

#

why aren't you finding this?

hearty valley
#

there is no invoice created with the $25 credits, but you say that when B is created and used the credit the $25 mentioned that it came from A? That's not what I see but I can double check

spice gust
#

yeah you must be misunderstanding something, the credit is absolutely reflected as a credit invoice line item and visible on one of the invoices

hearty valley
#

That's what I expected to happen indeed but did not see that, let me double check, could be that we don't capture everything we should somehow.

#

the weird thing is that I checked all the invoices in the screenshot I pasted, they are all full amount, no credit is mentioned

#

and I can see the events that they changed subscriptions

spice gust
#

do you have an example event?

hearty valley
#

sure, you want an event of what? change subscription quantity?

spice gust
#

yeah event id evt_123

hearty valley
#

sure

#

here is the list of event, let me get you the event id for the prorated

#

this is the pro rated event evt_1JbPhQAkNDVprSsPKs8A6xZW

#

invoice is null

#

it could be the code on our end not generating invoices for negative invoices? but yeah no invoice line ๐Ÿ˜ฆ

spice gust
#

so clearly that event shows an invoice item was created

hearty valley
#

ah true

#

but I don't see the credit (probably because it's used but another sub?)

#

seems to lead to a Upcoming invoice

spice gust
#

yeah sorry that's a pretty active subscription so not easy to debug and I'm not sure how much you understand about proration and subscription changes and when invoices are cut

hearty valley
#

agree, but that was very helpful, querying the invoice item by code, I can see the invoice and I can see it has a negative value. This is very helpful already!

spice gust
#

that request is your own code explicitly creating an invoice after the subscription is cut

hearty valley
#

my customers have tons of sub and they keep changing subscription plan and quantity, hence why they need that info ๐Ÿ˜„

#

I think our code keep asking creation of invoice for any change

#

Ah! it could be that we don't capture invoices that don't generate charges!

#

hence why I would not see the invoices that are negative

#

I'll keep digging, thanks!

spice gust
#

my advice is to take one customer and list all invoices and dump all line items one by one

#

it should help you debug, that customer is a great example

hearty valley
#

that's what I did, but I used our database for the record of invoices, and I beleive we only capture invoice with a charge, this would explain my problem

spice gust
#

ah yeah that makes sense

hearty valley
#

thanks again! I'm happy I may be able to do it with just invoices (which makes sense)

spice gust
#

also you should look at proration_behavior

#

you could pass always_invoice to immediately charge/invoice and have it tied to the subscription

hearty valley
#

instead of explicitly ask for an invoice creation? cool!

spice gust
#

yes it seems to match a lot more with what you want

hearty valley
#

ok here is my problem:

Looking at that refund event, the invoice created is : in_1JbPhQAkNDVprSsP4RIM6eyr

Listing all the invoices for sub_Jb2G3XacVBSgza however only gives me:
in_1Jg4LLAkNDVprSsPb8abSOvX
in_1JVC2pAkNDVprSsPv9Kn9bG7
in_1JJxHhAkNDVprSsPyIsIKJdI
in_1J8iUrAkNDVprSsP6bqe7VN5
in_1IxqCKAkNDVprSsPtMy8hHrr

Could have been caused by not using the flag you mentioned? I don't get why in_1JbPhQAkNDVprSsP4RIM6eyr will not show when querying sub_Jb2G3XacVBSgza

Because when looking at the invoice, this sub is mentioned.

What am I missing ?

spice gust
#

that's because your code explicitly creates a one off invoice not tied to the subscription

hearty valley
#

ARRRRG

spice gust
#

there's an extra subscription parameter if you want to only pull that subscription's pending invoice items and that invoice would have the sub_123 associated

#

but really moving to proration_behavior is a lot cleaner/better

hearty valley
#

yeah for sure, we'll move to that.

#

thanks for the tip

#

Is there a way to get all the invoices referencing this sub you can think of given the current implementation :/ ?

spice gust
#

list every invoice per customer and then look at each line item

#

the line item of that invoice would point to the sub

hearty valley
#

Yeah make sense. I think I got a pretty good understanding of what to do next (short and long term). Thanks a ton for all the help.

#

Oh, I found that the invoice was created explicitly in our code to immediately charge the customer when they increase the amount of their subscription instead of waiting for the next billing cycle.
(subscription was not mentioned in the invoice creation indeed).

#

proration_behavior probably won't address this case

spice gust
#

it would likely solve all your needs

#

I'd recommend actively testing it

hearty valley
#

Nice, will do of course. It's 3am here, I should go to bed ๐Ÿ™‚

spice gust
#

๐Ÿ‘‹ have a great night adn come back if you have follow up questions!