Stackoverflow is flooded with questions related to in-app purchase validation on-device or through servers. A receipt of purchase confirmation is always preferred because it lets the users know what was purchased, when purchased, for which app/service, and by whom? It’s almost been 10 years since Apple introduced in-app purchases, which made it possible for developers to sell digital products from their apps itself.
During the initial days of the feature introduction, this was enabled only for paid apps. But soon, Apple made it available for free apps as well. And today, every single Apple user can purchase digital products and services using their Apple IDs. However, these in-app purchases have to be validated. It is advisable to use your own server for validating the purchases. The reason being, any app recognizes its own server and puts it before any other. This further gives you complete control over the transaction.
But as this feature has to handle the transfer of real-money, security and resource provision are the main things that you need to ensure first; Security of the personal credentials and confirmation of the transfer of a digital resource.
Server-to-server purchase validation is one way to go, but the other way is on-device validation. You can use both the methods to unleash in-app features and content without server connection.
This article will guide you through both the options, and you can select any one of the two depending on your app structure and features.
The validation process highlight:
The device receives a transaction request. Further, for server validation, it sends to the server, and for on-device validation, it carries out the process of validating receipt. Both the methods start updating the state and allow you to unlock the content, and there you go, the transaction is finished.