Baroni last edited by Baroni
This guide explains how to create and configure in-app purchases for Oculus Rift & Go/Gear.
Table of Contents:
- Register developer account
- Create your app
- Testing IAP
1. Register developer account
Sign up for a Oculus developer account. You will have to login with your (regular or new) Oculus account.
Please note that for adding in-app purchases, an organizational and financial entity is required. When you are on the dashboard page, create your organization by clicking „Create New Organization“. Follow the presented instructions or the official documentation for more details:
2. Create your app
In this section we will create a new app with Oculus, connect it within Unity and add some in-app purchases.
2.1 Create app on Oculus Dashboard
With your oganization created, make sure you are back on the „Manage“ page i.e. the developer dashboard page. There is only one additional button on that page, which says „Create New App“.
The process for creating an app for Oculus Rift or Go/Gear is the same. After creating your app, you will be presented with your app ID and a few secret keys to uniquely identify your app. If you need the keys at some later point in time, you can always retrieve them by navigating to „Manage > Your Organization > Your App > Getting Started API“.
2.2 Configuring app in Unity
In order to make use of native Oculus features, you have to download the Unity Integration package by navigating to „Develop > Downloads > Unity“. The Unity Integration page will direct you to the Unity Asset Store.
For the integration of In-App Purchases, you will only need to import Oculus‘ Platform SDK. So if you would like to keep the project size at a minimum, disable all other folders on import.
Open the Oculus Settings via „Oculus > Platform > Edit Settings“, which generates a OculusPlatformSettings file in your project’s Resources folder automatically.
In the Inspector, enter the App ID from the Oculus dashboard displayed when creating your app into the corresponding text box, depending on your Oculus target device.
To let Simple IAP System know you would like to use billing for Oculus Rift, open it’s Plugin Setup tool (Window > Simple IAP System > Plugin Setup) and choose the Rift for Standalone platform. Hit Apply and close it.
Next, if you want to test your app with the example scenes provided by Simple IAP System, you have to add them to your Build Settings. Disable the non-VR related scenes as seen in the following screenshot, and make sure that the AllSelection scene is the first scene to load.
Switch to the Standalone (or Android) platform (File > Build Settings) and open the Player Settings.
If you are using Unity 2017/18, check that the Resolution Dialog is disabled, so that it does not show up when launching the app, after you put on your Rift.
In the "Other Settings" section, change the bundle identifier to what you like it to be, but keep the format of com.company.appname.
The bundle version and bundle version code defaults to 1.0 / 1 for new apps, which is fine for now. If you are testing with a new app, you do not have to change this for each build! Just keep the 1.0 / 1 until your app is done and about to go live globally.
In the „XR Settings“ section, enable VR support and in case it’s not listed there already, add Oculus to the VR SDKs.
Build the project.
2.3 Upload your test build
Create a ZIP file out of your Unity build files.
On the Oculus dashboard, select your app and navigate to „Manager Builds“. Note that Oculus streamlines the testing process – you do not have to enter any app details at this stage, at all! Just scroll down to the „Upload Build“ button.
Upload a new binary to the ALPHA channel and select the ZIP file you’ve created of your build. Enter the „Version“ number, which should match the version number in Unity, and enter the name of your .exe file as the „Launch File“.
2.4 Create in-app purchases
Open our IAP Settings editor in Unity and define your IAPs (Create Product > In App Purchase, Type = Currency or Default). For a definition of Non-Consumable or Consumable product types please refer to Oculus' documentation. Subscriptions are not supported.
On the Oculus dashboard, navigate to „Your App > Platform Services > In-App Purchases“ and download the product template. Add your products to the template as well and when you’re done, upload it on the same page. Double check that the product identifier (called SKU in Oculus‘ template) match with what you’ve entered in the IAP Settings.
At this point, you should now have the exact same product identifiers available on Oculus and in our IAP Settings editor. We’ve just added two products to Oculus for testing purposes.
3. Testing IAPs
3.1 Add test accounts
Navigate to „Manage > Your Org > Settings > Test Users“ and create one or more test users. The Oculus ID and email is generated automatically. You only have to remember or write down the password and PIN for your test users, as these cannot be restored later!
Navigate back to your app test build at „Manage > Your Org > Your app > Manage Builds“. Under the alpha channel, copy-paste the test user‘s email you’ve just created to assign it to that app.
3.2 Testing IAPs on your device
Launch the Oculus app and sign in with the test account credentials you’ve created earlier (sign out if you’re logged in with a different account). We have to enter some more details before launching our app, so select the Settings section and check that you’re really logged in with your test account.
At the first time trying to purchase a product with a test account, you could see a popup requiring payment information. Therefore add a 4111 test credit card number to your user, like below, as mentioned in the documentation.
In the General tab, allow apps from unknown sources – this includes executable apps from your pc and is necessary for starting Unity builds directly from your local hard drive.
We’re getting there, slowly! In the store, search for your app name. You should be able to see and install it from there. Alternatively, you could also find it in the Store by scrolling at very bottom, where the Preview Apps section is located.
Launch it! When the app has started on your device, you should directly start within the VerticalVR scene. Point your headset to a product’s buy button and hold the A button for initiating a purchase.
Purchasing a product in your app should then show a popup similar to this one:
Baroni last edited by Baroni
Tips & Tricks
You can also enter your test user credentials in the OculusPlatformSettings file for testing within Unity, in the editor.
When building your app, do not upload it to the Oculus dashboard every time, but simply overwrite your existing files locally under „Your Oculus App Folder > Software > Your App Name“.