According to presentation from WWDC2019 (https://developer.apple.com/videos/play/wwdc2019/302/) and documentation https://developer.apple.com/documentation/appstoreservernotifications/notification_type CANCEL notification could be sent in 2 cases: customer cancels subscription through customer support or customer upgrades subscription to higher tier.
Presentation from WWDC states that to detect which product was cancelled we should use product_id field in latest_receipt_info (page 119 in attached slides), however from our tests it looks like that at least for upgrade case this method does not work, because latest_receipt_info contains data about higher tier subscription (to which upgrade was done) and not previous subscription which is in fact cancelled. So in our implementation (done according the hints from presentation) we faced the issue that we were cancelling subscription which upgrade was aiming, not the one upgrade starts from.
Moreover, now in documentation there is warning that latest_receipt_info is scheduled for deprecation. Related field in newly added unified_receipt object contains list of all last user's subscriptions, so we need to choose somehow correct subscription from that list basing on some other field, the question is which one.
Could anybody provide some recommendation/hints how to detect which subscription was cancelled which will work for both cases?