Reputation: 3729
I have my own user management modules for my system (login and signup). I have an iOS app where user can purchase premium access to the content of app via IAP. I also have the app in other platforms; web and android. From other platforms also they can purchase such access. I don't want my user to purchase the same access when he/she already purchased in other platform. i.e. if he/she purchased the access in iOS, he should be allowed to use the premium access when he/she switches to android. For that I need to associate the purchased IAP to my own user management module. How can I do so?
Upvotes: 1
Views: 889
Reputation: 5169
You need a cross-platform ID for each user and attach transactions (regardless of the source) to that user ID. For each receipt type (Apple, Google, etc.) you'll need to make sure you refresh them appropriately to keep the subscription status accurate.
Since users will only be able to cancel from the device that they signed up on (i.e. can't cancel Apple subscription from Android) you should note the signup source, and direct them there to manage their subscription.
Also, if you include a "restore purchases" button users may be able to share subscriptions since restoring looks at whatever receipt is on the device, not which of your logged in users purchased it. Instead, use your server as the source of truth for restores.
Alternatively, if you don't want to build and manage this yourself you can look at a managed solution, such as RevenueCat, which handles all of this out-of-the-box. (Disclaimer: I work there)
Upvotes: 3
Reputation: 107141
You need to define a configuration settings for your app. This will contains the purchased module details and validity etc. When you open the app (Or check periodically) fetch this settings from the server and configure your modules based on this settings.
When a purchase is made by the user, you need to update the configuration settings for that particular user. In this way you can handle the purchase in all the platforms without any additional logic.
Upvotes: 0