Configuring for Google Play Store
Introduction
This guide describes the process of establishing the digital records and relationships necessary for a Unity game to interact with an In-App Purchase Store. The Unity IAP purchasing API is targeted.
In-App Purchase (IAP) is the process of transacting money for digital goods. A platform's Store allows the purchase of Products, representing digital goods. These Products have an Identifier, typically of string datatype. Products have Types to represent their durability: subscription, consumable (capable of being rebought), and non-consumable (capable of being bought once) are the most common.
Google Play Store
Getting Started
Write a game implementing Unity IAP. See Unity IAP Initialization and Integrating Unity IAP with your game.
Keep the game's product identifiers on-hand for Google Play Developer Console use later.
Build a signed non-Development Build Android APK from your game.
TIP: Make sure you safely store your keystore file. The original keystore is always required to update a published Google Play application.
TIP: Reuse the Bundle Version Code from your last uploaded APK during local testing to permit side-loading without first being required to upload the changed APK to the Developer Console. See the settings for the Android platform Player.
Register the Application
From the Google Account that will publish the game, register the Android application with the Google Play Developer Console.
NOTE: This guide uses the Google Play Alpha/Beta Testing approach for testing in-app purchase integration.
NOTE: A restriction against using the publisher's Google Account for testing exists, because Google payments does not let you buy items from yourself. Therefore you will need to create a non-publisher Google Account for testing.
Choose Add new application.
Give the application a Title. For configuring application billing, choose "Upload APK" now. The Store Listing will be prepared and populated in a later step.
Navigate to ALPHA TESTING and choose Upload your first APK to Alpha. Select your APK and upload it.
Resolve any issues listed in the Why can't I publish? popup first, then click Publish app to publish your Alpha application.
TIP: There may be a delay of up to 24 hours while the published Alpha application is made available for download from the Google Play Store. Similarly, there may be a 24-hour delay to published changes to an application's In-App Purchases (see below).
WARNING: Make sure the published application is the Alpha version. If the Production version is published, the general public will have access to the untested application.
Add In-App Purchases
In the Developer Console, add one or more in-app purchases for the game.
Navigate to In-app Products and choose Add new product.
Define the Product ID and choose Continue.
You can specify a consumable or non-consumable Product Type in Managed product. Subscription is also supported by Unity IAP.
NOTE: The "Product ID" here is the same identifier used in the game source code, added to the Unity IAP ConfigurationBuilder instance via AddProduct()
or AddProducts()
.
Populate the IAP's Title, Description, and Default price. Then enable it by changing the Inactive button to Active.
Result:
Test IAP
Follow these instructions to assign "test users" to be granted special license testing permissions, allowing them to purchase any IAP for free for this application, and register them as Alpha Testers.
NOTE: Here we used Closed Alpha Testing. Other tester groupings are available.
Add Google Account email addresses for testers who will be granted a license to purchase any IAP for free via the Developer Console's Settings > Account details > LICENSE TESTING section.
NOTE: There may be a delay of 15 minutes for the license testing setting to become effective.
Establish a list of Alpha Tester Google Account email addresses, from your list of license testing users.
Add each Google Account email address and name the list.
When available (after a multi-hour delay starting from publishing the APK) share the Opt-in URL with the Alpha Testers and have them install the application from the store.
NOTE: To test updates retaining permission to purchase IAP's for free, one may side-load applications, updating the existing store-downloaded APK install.
To test the IAP, make a purchase on a device logged in with an Alpha Tester Google Account. A modified purchase dialog box appears to confirm the fact this product is under test and is free.
WARNING: If this dialog box does not appear, then the Alpha Tester Google Account will be charged real money for the product.