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 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.
Windows App Development offers both local and remote Windows Store client-server IAP testing.
This page covers local testing with the emulator and a simulated billing system, then Windows Store testing which limits app publication visibility to those with the app’s link.
NOTE: This guide targets Windows 10 Universal SDK. Other Windows targets are available.
*NOTE: IL2CPP Windows builds using Unity IAP are not supported. Until support for Unity IAP with Windows IL2CPP is completed, using IL2CPP on Windows with Unity IAP will generate a compilation error.
Keep the game’s product identifiers on-hand for use in Microsoft’s Windows Dev Center Dashboard to perform remote Windows Store testing later.
Microsoft offers a simulated billing system, permitting local testing of IAP. This removes the need to configure anything on the Windows Dev Center or communicate with the the Windows Store via the app for initial integration testing.
Configuring local testing is far simpler than for remote Store testing, although it requires temporary code changes to the app which need to be removed before app publication.
To test IAP locally:
Enable the simulated billing system in code where Unity IAP is initialized with its ConfigurationBuilder instance.
WARNING: Remove these code changes after testing, before publishing to the Store; otherwise the app will not transact any real money via IAP!
Build the application in Unity for Windows Store > Universal 10.
Open the application in Visual Studio and run the Local Machine target for x86.
Remove the simulated billing system from code.
Once basic IAP functionality has been tested locally, you can more confidently begin working with the Windows Store. This test confirms that the app has all necessary IAPs registered correctly to permit purchasing.
For testing IAP and publication use the Windows Dev Center and configure the app with a limited visibility. This limits the app’s visibility to those who have its direct link.
NOTE: Testing on the Store also requires Certification, which may serve as an obstacle to testing. It is therefore important to complete testing locally before proceeding to testing with Windows Store.
In the Dev Center create a new app.
Reserve the app name.
To test IAP with the Windows Store, the Windows Dev Center needs the published app. Click Pricing and availability and limit the app’s Store visibility so that it is only available to users who have the app’s direct link.
In “Distribution and visibility” see a list of the Store’s available publication behaviors. Select Hide this app and prevent acquisition.
Collect the direct link. This will be used to install the app on a Windows 10 device for testing.
Submit the app for Certification.
Submissions may take many hours to complete, and blocking issues may be raised by Microsoft Certification, which you will need to address before the submission passes successfully.
Add each IAP, setting the price to be “free” so that no money will be transacted during testing. After the test is completed, reconfigure the IAP with the desired price and republish it. See IAP Submissions.
In the new app’s “App overview” page, click Create a new IAP .
Enter the product ID.
Configure the type, price, and language.
NOTE: For Pricing and availability choose free for testing purposes to avoid incurring unnecessary financial charges. When you’re finished with testing, update and re-submit each IAP with the desired price in preparation for release to the public.
Select Properties to set the type.
Select Pricing and availability to set the price choosing Free as explained above.
Select Manage languages and declare the supported languages.
Select the declared language when returned to the IAP overview.
Populate the Title, Description and Icon.
Submit the IAP for Certification.
As with apps, IAP submissions may take many hours to complete, and blocking issues may be raised by Microsoft Certification which you will need to address before the submission passes successfully.
These steps follow a branch of the beta test process made possible with Windows Store. This involves limiting the visibility of the app itself, negating discovery by the public through the “Search Store” function. See Windows Dev Centre resources on beta testing and targeted distribution for more information.
Confirm both the app and IAPs have completed Certification.
Install the app on a Windows 10 device via the direct link, generated above.
After passing test, update the IAP with the desired public pricing, update the app visibility settings to share with the general public, and submit both kinds of changes for final Certification.