Add a real money purchase to your game
The following instructions describe how to define the parameters of a real money purchase in your game’s economy.
From the Unity Cloud Dashboard, open Economy and select Configuration.
Select Add resource.
Set Choose a type to Real money purchase.
Give the transaction a resource name, and an ID for use in API calls. For example, if your real money purchase is for a shield, the item name could be Buy Shield. The ID is auto-generated from the item name, but you can change it to anything that suits you and your game.
The next screen contains these sections to fill.
- In the What does this purchase buy? section, set the Resource field to a currency or inventory item the player acquires as a result of this transaction, as well as the amount of the item the player receives.
- In the Which devices is this available on? section, set the Which devices is this available on? field to the ID of the purchase in the reference store. If you do not allow the item to be purchased in one of the available stores, then leave the corresponding box empty. Some stores might require additional configuration. See Configure the Google Play Store with IAP.
You can add any optional custom JSON data you want allocated to this real money purchase by entering it into the Custom Data box. See Custom data.
The new real money purchase now appears on the Configuration page of Economy.
Integrate in-app purchases using the IAP plug-in
The following process creates a real money purchase using the In-App Purchasing plug-in from Unity:
- Configure the products on both the Apple App Store and the Google Play Store.
- Define the same products as resources in the Economy configuration.
- Define real money purchases within Economy that describe the available in-app purchases and associated rewards.
- Retrieve the available real money purchases from Economy at runtime and display them to the player.
- Perform an IAP using Unity IAP.
- Verify, redeem and securely apply the purchase rewards with Economy.
Configure the Google Play Store with IAP
Google Store configuration requires you to set an additional key at project level. Developers will see an information banner in the Real Money Purchase configuration dialog that informs them to fill the required field, with a link to the page containing the section.
To set up Google Play Store for use with IAP:
- Retrieve the Google Play License Key in addition to the Product ID for the item.
- In the Unity Cloud Dashboard, select Projects and open your project.
- In the Google License Key setting, select the Edit pencil icon and add the Google key.
- Save the configuration change.