When a user first subscribes, they do it through our app. Sometimes they cancel, let the subscription expire, then later decide to resubscribe. If they resubscribe through our app, we just fulfill it like it is a new purchase. However, if they resubscribe outside of our app, the only way for us to know about it (and grant access to content) is to subscribe the App Store Server Notifications.
What are the specific App Store Server Notification messages we will receive in this situation and what are the values in the message that we need to look for? How can we tell, just from looking at the App Store Server Notification if the user resubscribe through our app or outside of our app?
What are the specific App Store Server Notification messages we will receive in this situation and what are the values in the message that we need to look for? How can we tell, just from looking at the App Store Server Notification if the user resubscribe through our app or outside of our app?
If the user reactivates a subscription, you'll receive a notification with the same original_transaction_id, that you should have store in your database related to the user that make the initial purchase using the app.
It the last subscrition happened long time ago, and the user reactivates his subscription from outside the app, I think it is posible that you receive a INITIAL_BUY notification, with a different initial_transaction_id, that you don't have in the database, so you don't know the user that made the purchase. You should tell the user to launch the app, where it should obtain the receipt, the original transaction_id and the user ID, and send it to he server. That way you can add the user ID to the database record that matches the original_transaction_id.
You can see videos from wwdc2020, wwdc2019 y wwdc2018 related to server to server notifications:
https://developer.apple.com/videos/play/wwdc2020/10661/?time=654
See Resources to find more information
It the last subscrition happened long time ago, and the user reactivates his subscription from outside the app, I think it is posible that you receive a INITIAL_BUY notification, with a different initial_transaction_id, that you don't have in the database, so you don't know the user that made the purchase. You should tell the user to launch the app, where it should obtain the receipt, the original transaction_id and the user ID, and send it to he server. That way you can add the user ID to the database record that matches the original_transaction_id.
You can see videos from wwdc2020, wwdc2019 y wwdc2018 related to server to server notifications:
https://developer.apple.com/videos/play/wwdc2020/10661/?time=654
See Resources to find more information