How to properly parse unified_receipt

Hello!

I wounder if there any trusted instructions on how to get valid receipt_info from unified_receipt in notifications body. We strugle with it because it is a list and may contain information about different purchases.
Things get more interesting when changes to subscription happen on last day of subscription period, you may find receipt_info about old product_id and about new product_id.

We've developed following approach:
  • Find pending_renewal_info with auto_renew_product_id that matches auto_renew_product_id on top level of notification object.

  • Look for first receipt_info that has the same product_id as pending_renewal_info object found on previous step.

Is it a proper way to find correct information about subscription from notification? We have this problem in a first place because notifications seems to inform us about one subscription only, i.e. notification_type caries some semantic and it should be applied to one subscription only.

Perhaps this sample code can help you:
github.com/paulw11/subscription-monitor

Some other links from WWDC2020 with explanations about server-to-server notifications

  • Architecting for subscriptions

https://
developer.apple.com/videos/play/wwdc2020/10671

  • Engineering Subscriptions

https://
developer.apple.com/videos/play/wwdc2018/705/
  • What’s new with in-app purchase

https://
developer.apple.com/videos/play/wwdc2020/10661

Note: It seems incredible for me that I can't include links to Apple websites... I've have had to break URLs in order to be able to send this message... You'll have to recreate the original URLs from its fragmentsç

Additional ones related to server-to-server notifications:
  • Introducing StoreKit Testing in Xcode

https://
developer.apple.com/videos/play/wwdc2020/10659
  • Subscription Offers Best Practices

https://
developer.apple.com/videos/play/wwdc2019/305/
  • In-App Purchases and Using Server-to-Server Notifications

https://
developer.apple.com/videos/play/wwdc2019/302/


How to properly parse unified_receipt
 
 
Q