Skip to main content

Simple IAP System


Simple IAP System is our ready-to-use billing solution for the Unity game engine. It comes with the Receipt Validator pre-integrated, which can be enabled on demand. You can find more information about the asset as well as purchase options on our website.

Project Setup

Configure Simple IAP System by following its documentation. The Receipt Validator extension can be added on top, without requiring any specific settings during Plugin Setup. The Receipt Validator backend is contacted via the ReceiptValidatorServer component. As an optimization, the ReceiptValidatorServer validates the receipt locally before sending it to the remote backend.

  • Configure Unity IAP's local validation under Services > In-App Purchasing > Receipt Validation Obfuscator
    The Google Play Public Key can be found in your Google Play Developer Console under Your App > Monetisation setup
    Click the Obfuscate button to generate your Google Play and Apple Tangle files
  • On the supported target platforms (Android/iOS), add the RECEIPT_VALIDATION define to Project Settings > Player > Scripting Define Symbols


  • Add the ReceiptValidatorServer component to the IAPManager prefab



You can then access the ReceiptValidatorServer component programmatically using IAPManager.GetInstance().GetComponent<ReceiptValidatorServer>().

General DataEnter your App ID from the Receipt Validator dashboard.
You do not want to enter the User ID in the inspector as that would mean all users have the same ID. Instead, update it at runtime with a unique device identifier, or existing ID after user login in your custom authentication system. For this to work, disable automatic initialization on the IAPManager script and call IAPManager.GetInstance().Initialize() after user login and updating the User ID.
InventoryIf, how and when to request user inventory. As noted in the Inspector, leave it on Disabled on the Free plan, without user authentication or when storing user purchases on your own server.
Inventory Request Type:
Disabled : Do not request user inventory.
Manual : Inventory has to be requested manually (advanced).
Once : User inventory can only be requested once per app launch.
Delay : User inventory can only be requested once in a certain timespan, by default every 30 minutes.

Project Structure

The ReceiptValidatorServer component consists of the following public methods and events:

inventoryCallbackFired when Inventory is available.
purchaseCallback (string, JSONNode)Fired after request to server completes, for both failed and successful purchases.
RequestInventoryRequest user inventory from server. Called automatically after Unity IAP initalization.
GetInventory (Dictionary<string, PurchaseResponse>)Returns Dictionary with ProductID <-> PurchaseResponse items of the server's user inventory. Could be empty if RequestInventory has not been called yet.
ValidateValidates a product purchase locally then remotely. There is no need to call this manually, it is called automatically on an IAPManager purchase callback.
CanValidate (bool)ReceiptValidator interface override that determines supported platforms. There is no need to call this manually.
RequestRestoreRe-Validates each owned product. There is no need to call this manually. If you wish to initiate a restore, call IAPManager.RestoreTransactions() instead.
IsLocalValidationSupported (bool)Returns whether local validation is supported on this platform.
IsServerValidationSupported (bool)Returns whether remote validation is supported on this platform.


As done in the basic Unity sample and in compliance with the REST API on the GetUser call, RequestInventory calls are limited to one request every 30 minutes by default. At best, user inventory should be accessed from memory throughout the session after it has been received, using GetInventory. Note that this is designed for getting the raw inventory data for custom processing. Simple IAP System updates its DBManager database of products automatically, so if you would like to check whether a product is purchased or not, you can also call DBManager.IsPurchased(string productID).

You could consider enabling Memory Only on the DBManager if your app does not provide virtual currency or virtual products. In an enabled state, nothing is stored locally and owned products are only retrieved from the Receipt Validator inventory and stored in memory, effectively requiring internet access on app launch for the RequestInventory call. This would ensure users are not able to tamper with game files on their device. If you offer any virtual currency or virtual products, Memory Only should be disabled as otherwise local progress is lost.


Unity IAP has its own periodic retry mechanism when unable to initialize on the first try, for example on bad or no network connectivity. Since ReceiptValidatorServer's RequestInventory method is hooked on Unity IAP, it is fired off automatically once initialization completes successfully. This means that you do not have to build your own retry method continuously calling RequestInventory.