Develop

In-App Purchase package

Updated: Oct 21, 2026
The Platform SDK In-App Purchase Package enables app monetization through in-app purchases, including consumables, durable items, and subscriptions. The package retrieves product information and pricing, initiates the purchase flow for items, and queries user purchase history.
Applications can mark consumable items as used after consumption. Both durable (permanent) and consumable (one-time use) items are supported, along with subscription management. This package is essential for free-to-play and premium content monetization strategies.
This is a Platform SDK feature requiring Data Use Checkup
To use this feature, you must complete a Data Use Checkup (DUC). The DUC ensures that you comply with Developer Policies. It requires an administrator from your team to certify that your use of user data aligns with platform guidelines. During development, a DUC you submit is approved automatically and gives your app provisional access. Submitting the app for review or enabling higher release channel limits permanently ends automatic approval, but features you already have keep working while their review runs (see When to submit a DUC). Test users can call these features before DUC approval, except getting the logged-in user, which needs the User ID or User Profile grant.
For add-ons, request the In-app purchases and/or downloadable content feature in the Developer Dashboard⁠ under Requirements > Data Use Checkup. To sell subscriptions, also request the Subscriptions feature. Without the matching feature, buying an add-on or subscription from inside your app fails, even for test users.

Before you begin

How to install

  1. Add the following to your project’s ./gradle/libs.versions.toml file:
     [libraries]
     # Existing lines
     iap-kotlin = { module = "com.meta.horizon.platform.sdk:iap-kotlin", version.ref = "horizonPlatformSdk" }
    
     dependencies {
         // Existing lines
         implementation(libs.iap.kotlin)
     }
    
  2. In Android Studio, click File > Sync Project with Gradle Files to install the package.
  3. Click Build > Generate App Bundles or APKs > Generate APKs.
  4. In the “External Libraries” section of your project, confirm that these packages are listed.
     com.meta.horizon.platform.sdk:core-kotlin
     com.meta.horizon.platform.sdk:iap-kotlin
    
    Now you can initialize the Platform SDK and use In-App Purchase package functions in your app.

API reference

See the exact requests and responses in the Platform SDK In-App Purchase Package.

Test this on Meta Spatial Simulator

getViewerPurchases and the other purchase getters:
Test these APIs on Meta Spatial Simulator without a physical device. They read and write local sample data, work offline, and persist across calls. Reset the data with the common.reset_data command.
The launchCheckoutFlow call, which walks the purchase path end to end. It evaluates what you send: an unknown SKU fails, canceling the dialog fails, and a completed purchase is stored, so buying the same SKU again returns the purchase you already have:
These use a simulated dialog.
consumePurchase and getProductsBySku. getProductsBySku appears early in a catalog flow, so that is where a signed-out session fails first, while getViewerPurchases keeps working:
These call the Meta backend. Signed in they return real responses; signed out they return an authentication error rather than sample data.