#HNk - Previous MRR
1 messages ยท Page 1 of 1 (latest)
Hi! Do you need an event code as an example?
Basically I'm getting MRR changes and I need to calculate previous MRR vs current MRR
Okay, and what data in your subscription object are you using to perform these calculations?
So I'm getting events json info and extracting other informations I need through API, this way I can get Subscription data
From my subscription, in this case to calculate current MRR I'm using Items Quantity, Amount for some items and tiered amount for other items
But when I get an event I can find only quantity at "previous_attributes"
I wonder what would be the most wise way to calculate it so
Okay so yes if you have an event that I could look at the same object that would be helpful. I have a hunch but want to verify.
Sure, here it is
Okay so in this case you are examing the subscription items to calculate MRR, correct?
Okay, so this may require some testing but one thing that occurs to me is using the Invoice List API request. You can filter it by Subscription ID and get all the invoices associated with that subscription. They will have Invoice Items that correspond to the Subsription Items in the event object you shared.
https://stripe.com/docs/api/invoices/list#list_invoices-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That's a nice way to do so
But even so I might ask you, do you know if is there a way I can get customer's MRR changes through subscription changes, instead invoices or payments???
I do not think we expose that level of detail on the previous_attributes
In this case, should I use SI Item Code to get item Amount?
Or maybe Price or Plan?
Hello! Sorry I missed the update here
Yes for this purpose you would want to expandt the price of the subscription item(s) to see the recurring interval and amount for your review
But if an item was changed in subscription and I need to get its previous amount, since we do not have it at Event, can I get it another way?
Specially if it's a new customer that doesn't have invoices yet
Can you share an example event where you've replaced the price?