How to calculate the prorated refund?

Hi, as I read in the Apple v2 notification, when I get a DID_CHANGE_RENEWAL_PREF notification with the UPGRADE subtype, the change to the upgraded product will be immediate and the user get a prorated refund.

my question is: If the cost of the first subscription is 100$ and the subscription period is a month and I upgrade to another product after 1 week. How do I calculate the prorated refund? Do I get a CANCEL notification indicating any refund?

Thanks!

With notifications V2 we work to only send one notification per event. Therefore since UPGRADE implies a pro-rated refund, this is all encompassed in the one notification, and a separate REFUND should not be sent. You can use the isUpgraded field on transactions to see if that transactions was upgraded from and therefore partially refunded.

How to calculate the prorated refund?
 
 
Q