Oculus
This guide explains how to create and configure in-app purchases for Meta Quest (App Lab) & Oculus Rift. We will create a new app with Oculus, connect it within Unity and add some in-app purchases for testing.
Register developer account
Sign up for an Oculus developer account. You will have to verify your account before being able to add an organization and Oculus apps. After logging in with a new account, please follow the instructions displayed.
Create your app
With your account verified and oganization created, navigate to the MY APPS page. There is only one additional button on that page, which says Create New App.
At this point, you have to decide whether you want to deploy on Meta Quest or Oculus Rift. Please follow the corresponding section below.
Retrieve your App ID
Enter your app name and select the your deployment and device target.
After your app has been created, open the API sidebar item. Your App ID is displayed on the right side. Keep this page open for the next step!
Import Oculus Platform SDK
In order to make use of native Oculus features like In-App Purchasing, you have to use the Meta XR Platform SDK from the Asset Store. Add the package to your Unity account, then import it in the Package Manager:
Once finished, open the Oculus Settings via Meta > Platform > Edit Settings, which generates a OculusPlatformSettings file in your project's Resources folder automatically. Enter the App ID from the Oculus dashboard that we retrieved in the last step, in the correct field (Quest and/or Rift, depending on your app target).
Import XR Plugin Management
In order to toggle Oculus features for a specific platform, we have to use the XR Plugin Management package. Open the Project Settings window and install it:
If you're developing for Meta Quest, open the Android tab and enable Oculus. If you are targeting Oculus Rift, open the Standalone tab and enable Oculus there. If you are targeting both devices, enable Oculus in both tabs.
Create in-app purchases
Open the Project Settings for UniPay and define your IAPs. For a definition of Non-Consumable or Consumable product types please refer to Oculus' documentation. Subscriptions are not supported yet.
On the Oculus dashboard, navigate to Your App > All Platform Services
and activate the Add-ons service.
Create an Add-on (an In App Product).
Enter the same product identifier and type you selected in UniPay previously. After clicking Save Draft, select the Pricing tab.
If you are creating new In App Purchases in Oculus for the first time, on the Pricing tab you will probably see that you are required to set up payment information. If so, follow the link and do it, otherwise you will only be able to create free products.
Configure Build
To let UniPay know you would like to use billing via Oculus, open its Project Settings and choose Oculus on the corresponding platform.
Quest
For Meta Quest, select it on the Android platform.
- Hit Apply to recompile the changes.
- On the Build Settings, change your current platform target to Android.
Create your APK file.
Rift
For Oculus Rift, select it on the Standalone platform.
- Hit Apply to recompile the changes.
- On the Build Settings, change your current platform target to Standalone.
Create your EXE build.
VR Sample Scene
If you do not have your own VR shop scene yet and want to test your app with the VR example scene provided by UniPay, please follow the VR sample scene guide for installation instructions and then come back to this guide.
Upload Test Build
On the Oculus developer dashboard, navigate to Your App > Distribution
. If there is an agreement notice that you first have to sign, follow the instructions displayed to do so.
There are multiple ways to upload your application to the Oculus dashboard, or deploy on the device directly. Please have a look at the official documentation for Meta Quest or Oculus Rift. The upload process is not covered in more detail in this documentation, since there is a lot of information available on the official documentation. To keep it simple, I went the Meta Quest Developer Hub way, which regardless of its naming, works for both Meta Quest and Oculus Rift.
Upload your build to the ALPHA channel. Processing the build by Oculus will take several minutes before it will become available and displayed.
Add Test Account
Back on the Oculus overview page, select Test Users in the sidebar and create one. You only have to remember or write down the password and PIN for your test users, as these cannot be restored later!
Then under your app, with a build now uploaded for ALPHA, go to Distribution > Release Channels > ALPHA
and in its users tab, add the test user email that was generated in the last step.
You can add your developer account email for testing too - however, please note that test credit cards (for not paying real money on a purchase, set up in the next step) do not work on personal accounts.
Testing IAPs on your device
For free in-app purchase payments, start the Oculus device and sign in with the test account credentials you've created earlier. As mentioned on the official documentation, this could require a factory reset due to your device already linked with a personal account. In the Profile app, ensure that you are 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 the 4111-
... test credit card number to your test user, as mentioned in the official documentation. After filling out the credit card details, it will also ask for the Meta Quest PIN that was displayed when creating your test user - by default, 1234
.
Purchasing a product in your app should then show a popup similar to this one:
When building your app, do not upload it to the Oculus dashboard every time, but simply deploy to the device directly.
Please note that in case of issues with this process, I am not able to guess or remotely debug the exact cause for you. Since a major part of this guide is not written for UniPay in particular, there is a high chance that your issue has been experienced by many, many other developers before and is covered somewhere already - debug your device, do a Google search for the error message and look out for popular Oculus developer threads!
If you need help with the app setup, testing process or solving issues with your app's connection to Oculus Store, I am providing extended support for this via PREMIUM support. Contact me on the Unity Forum or on Discord to discuss your requirements.