Getting started with monetization in Unity
Updated: May 1, 2026
Monetization features enable you to sell content or services that enhance your app’s user experience. Think about monetization early in your app development process to effectively plan engagement methods and revenue sources for your app.
This guide shows you how to get started with monetizing a Meta Quest app built with Unity. By following this guide, you’ll learn:
- How to enable in-app purchases (IAP) in the Developer Dashboard.
- How to set up an IAP in your Unity app.
Unity Editor 2022.3.15f1 or later (6.1 or later recommended)
Supported Meta Quest headsets:
- Quest 3S and 3S Xbox Edition
Before working on implementing an IAP, make sure your project is properly set up by completing the following sections:
How to implement an in-app purchase (IAP)
Step 1: Indicate that your app needs an internet connection
Step 2: Enable in-app purchases
Step 3: Create an add-on in the Developer Dashboard
Follow the steps in
Setting up add-ons to create a
Consumable IAP in the Developer Dashboard. Set the price of the add-on to free so you can test the purchase flow without incurring charges.
Once your add-on is published, you can start referencing it in your Unity project.
Step 4: Add a UnityXR Interaction Camera and Rig
Open your project in the Unity Editor.
In the Hierarchy tab, right-click on the default Main Camera and click Delete.
Right-click in the Hierarchy tab. Go to Interaction SDK > Add UnityXR Interaction Rig.
In the Unity XR Comprehensive Rig Wizard, click Fix All.
Click Create to add the UnityXRCameraRig to your scene.
Right-click in the Hierarchy tab. Go to GameObject > UI > Canvas. A Canvas is added to your project’s Hierarchy.
In the Hierarchy, select the Canvas. In the Inspector tab, set Render Mode to World Space.
Under Rect Transform, set the following values:
- Rect Transform > PosX: 0
- Rect Transform > PosY: 1.15
- Rect Transform > PosZ: 1.5
- Rect Transform > Width: 480
- Rect Transform > Height: 720
- Rect Transform > Scale: [0.0005, 0.0005, 0.0005]
Right-click the Canvas in the Hierarchy tab. Go to UI (Canvas) > Panel. A Panel is added to your project’s Hierarchy.
Right-click the Panel. Go to UI (Canvas) > Button - TextMeshPro. A Button is added to your project’s Hierarchy.
Click on Button in the Hierarchy tab. On the Inspector tab, under Rect Transform, set the following settings:
Under Button in the Hierarchy tab, click Text (TMP).
Under the Inspector tab for Text, under Text Input, enter Buy IAP.
The Canvas panel should now look something like this:
Step 6: Add Ray Interaction
In the Hierarchy tab, right-click on the Canvas. Go to Interaction SDK > Add Ray Interaction to Canvas.
In the Ray Canvas Wizard window, click Create.
Step 7: Create a new script
In the Project window, right-click on the Assets folder.
In the menu, navigate to Create > Scripting > Empty C# Script. This creates a new C# script called NewEmptyCSharpScript.cs in the Assets folder.
Rename the script IAPManager.cs.
Double-click the script in the Assets folder to open it in your code editor.
Replace the content with the following code snippet:
using UnityEngine;
using Oculus.Platform;
using Oculus.Platform.Models;
public class IAPManager : MonoBehaviour
{
private const string APP_ID = "YOUR_APP_ID";
private const string IAP_SKU = "YOUR_IAP_SKU";
void Start()
{
Core.Initialize(APP_ID);
// Recommended: on startup, also reconcile any unconsumed purchases:
// IAP.GetViewerPurchases().OnComplete(OnViewerPurchases);
}
public void OnClickButton()
{
BuyItem(IAP_SKU);
}
// Launch the checkout flow for a given SKU
public void BuyItem(string sku)
{
IAP.LaunchCheckoutFlow(sku).OnComplete(OnPurchaseComplete);
}
// callback for purchase
private void OnPurchaseComplete(Message<Purchase> msg)
{
if (msg.IsError)
{
Debug.LogError(msg.GetError().Message);
return;
}
Purchase purchase = msg.Data;
Debug.Log($"Purchased: {purchase.Sku}");
// 1) First, grant the item/currency to the game user
GrantConsumableToPlayer(purchase.Sku);
// 2) Then, consume the item/currency
IAP.ConsumePurchase(purchase.Sku).OnComplete(consumeMsg =>
{
if (consumeMsg.IsError)
{
Debug.LogError($"Consume failed for {purchase.Sku}: {consumeMsg.GetError().Message}");
return;
}
Debug.Log($"Consumed: {purchase.Sku}");
});
}
private void GrantConsumableToPlayer(string sku)
{
// Example: add currency / increment count locally (or via your backend).
Debug.Log($"Granting consumable to player for sku={sku}");
}
}
Replace the placeholder values in the code with your app’s credentials from the Developer Dashboard:
- Set
APP_ID to your App ID. For example, if your App ID is 12345:
private const string APP_ID = "12345";
- Set
IAP_SKU to the SKU of the add-on you created. For example, if your IAP’s SKU is 678910:
private const string IAP_SKU = "678910";
Drag and drop the script from the Project window onto the Canvas in the Hierarchy window.
The Inspector window now shows the script attached to the Canvas.
Click Button in the Hierarchy window to open the Inspector window.
In the Inspector window, under the On Click() section, click the Select Object button.
In the Select Object window, switch to the Scene tab and select Canvas. To filter the list, type Canvas in the search field.
In the Function dropdown, select IAPManager > OnClickButton().
In the top menu bar, go to File > Build Profiles.
In the Build Profiles window, under Platforms in the left nav menu, make sure Meta Quest is active.
If your scene is not already in the Scene List, click Open Scene List to add it to the build. Deselect and remove any other scenes from the selection window.
Click Build.
In the Build Android window that appears, select a location to save your APK. Remember the location of the APK.
Click Save.
Step 11: Deploy your APK from the release channel to your headset
Ensure your headset is connected to your computer and recognized by the Meta Quest Developer Hub. For setup instructions, see
Device Setup.
In the Meta Quest Developer Hub, navigate to your app’s distribution page. On the ALPHA Release Channel, click the menu button.
Click Install build on device and select your headset.
- Put on your headset.
- Press the Meta button on your right Quest controller.
Click the Library icon.
Find your app in the Library and click on it.
- When the app launches, click Buy IAP.
Since the add-on you created is a free consumable, the menu appears and then quickly disappears because the transaction automatically completes.
Step 13: Verify your purchase in device logs
- While your headset is connected to your computer, open the Meta Quest Developer Hub.
In the left nav menu, click Device Manager.
In the Device Manager window, click Device Logs for your connected headset.
In the Device Logs window, switch the dropdown to Debug.
In the search bar, enter Purchased.
- With the Device Logs window still open, launch the app on your headset.
- Click the Buy IAP button.
Look at the Device Logs window for a log line confirming that the purchase was successful.
You have now successfully implemented IAP in your Unity project.
Explore the resources below to continue learning about IAP, add-ons, and other monetization and platform features.