#HNk - Previous MRR

1 messages ยท Page 1 of 1 (latest)

rose arrow
#

Hi ๐Ÿ‘‹

#

Can you provide a concrete example of what you are trying to accomplish?

halcyon vector
#

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

rose arrow
#

Okay, and what data in your subscription object are you using to perform these calculations?

halcyon vector
#

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

rose arrow
#

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.

halcyon vector
#

Sure, here it is

rose arrow
#

Okay so in this case you are examing the subscription items to calculate MRR, correct?

halcyon vector
#

Yep

#

Correct, that's the way I found

rose arrow
#

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

halcyon vector
#

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???

rose arrow
#

I do not think we expose that level of detail on the previous_attributes

halcyon vector
#

In this case, should I use SI Item Code to get item Amount?

#

Or maybe Price or Plan?

nova igloo
#

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

halcyon vector
#

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

nova igloo
#

Can you share an example event where you've replaced the price?

halcyon vector
#

I don't have one immediately since I didn't save its id, so I'd have to look one by one to find it again

#

So just getting back to that weird question I've done, is it possible to capture MRR changes through Subscription changes or Events, or something like that?

nova igloo
#

Isn't that the same question? You'd need to calculate this based on the prices used before an after

#

There is no such amount calculated automatically