Recording that user’s identity and purchase info, for maintain same purchased item result even if user changed phone or re-install game.
So this means, game developer need to make that game’s specific database?
And need to record user identity and purchase data, items and track its changes?
How to know user’s identity? Force user to make account when game start?
If you want Clash of Clans, the game has to run on servers. On those servers you can also store the IAB history.
For identification, the Google Play Game Services is the best option. Assuming that you are targeting Google Play. You should also save cookie to device for players that don’t want to immediately log in via Google Play Game Service.
Google Play will handle all of the user purchase history. My apps that use IAP query the Google Play servers when they launch to find out what items the user has purchased already. It uses the users Google account, so if they change devices, the purchases will carry over.