Skip to main content

Integrate Receipt Validator

This guide explains how to integrate our serverless Receipt Validator Service in Tower Defense Multiplayer. The Receipt Validator offers a FREE plan that can be used in development and production. This guide will make use of the FREE plan.

Problem description

Validating in app purchases locally, or even not validating receipts at all introduce a massive security risk to your app, making it easy for hackers to unlock IAPs for free. You would like to use the most secure in-app purchase validation service, server-side validation, without managing your own servers or maintaining any additional code. It is assumed that you have imported and enabled Unity IAP already (see Services documentation), as well as created an application ID on the Receipt Validator dashboard.

Download the asset

Follow the asset's instructions on how to download and configure it in Unity. You can play-test the demo scene to ensure it works correctly. Ignore the guide's Integration section though, as this will be handled below.

Preparing the project

Now it is time to prepare the project for the integration:

  • in the Intro scene of Tower Defense Multiplayer, drag & drop the 'ReceiptValidator' prefab from ReceiptValidator > Prefabs
  • enter the application ID you've created in the Receipt Validator dashboard into the prefab inspector
  • enable Unity IAP's usage of the Receipt Validator by adding the 'RECEIPT_VALIDATION' define to Edit > Project Settings > Player > Other Settings > Script Compilation and press 'Apply'

RV010

That's already it! Your in-app purchase receipts should now be validated by the Receipt Validator and you should be able to verify the most recent transactions in the dashboard.