You have a mobile app (Android/iOS) that requires the user to sign-in.
The mobile app offers in-app purchases.
A user makes an in-app purchase while
* signed in as X on the device (Google account/iTunes account)
* signed in as Y on the mobile app.
The user then
* uninstalls the app
* reinstalls it
* signs in as Z on the mobile app
* restores purchases.
What do the app stores (Apple/Google) expect us to do?
Do we have to restore the purchases to the Z app user even if the purchases were made by app user Y just because the native user is X?
We read the policies but can't tell for sure.
Can you help?
From reading through the docs relating to in app purchases on iOS the purchase is always tied to the device account, or Apple ID in the case of iOS.
Restoring purchases prompts for the user’s App Store credentials
Source
That's just the way it is and we have to work with it.
One possible solution would be to mark users of your app who have bought an in app purchase as "members" or "subscribers" in your own back end.
I am simply assuming that you have your own back end because as far as I know you need to have one to verify the in app purchase, and you also mentioned logins.
Then when a user goes to reinstall the app after they have deleted it, they then sign into the app, your app checks with the back end to see if the current user is the one who purchased the in app purchase, if they are, then restore the purchase, if not then don't. Then going forward you just show and hide the paid content based on whether or not the signed in user is the one who made the purchase,
If you have your own account based system, you aren't required to restore purchases from the device receipt if they can be restored by logging in to their (your) account. Apple vaguely mentions this in their docs as do service providers.
From Apple (their example is iOS/macOS but might as well be iOS/Android):
You could let users who have a subscription in an iOS app access the
content from a macOS app (or vice versa), but implementing that
functionality is your responsibility. You would need a system to
identify users and keep track of the content they are subscribed to,
similar to what you would implement for an app that uses non-renewable
subscriptions.
From RevenueCat:
Using an externally managed App User ID also provides a mechanism by
which to restore purchases in a few scenarios:
...
- When the user logs in on multiple devices - you can honor a subscription that was purchased on one device across any other
platform.
You'll notice large, cross-platform, subscription apps like Netflix don't have a restore purchases button anywhere. As you've pointed out, restoring purchases could allow a single purchase receipt to be shared across multiple users that log-in on the same device.
Disclaimer: I work at RevenueCat