API reference
API reference
Select your platform
No SDKs available
No versions available

Iap

Updated: Aug 26, 2025

Iap

class Iap
The IAP (In-App Purchases) API provides methods for managing in-app purchases, including retrieving purchase history, getting detailed product information by horizon.platform.iap.models.Purchase.sku, and consuming purchases as needed. For more information, see here.

Constructors

NameSummary
Iap
constructor()

Types

NameSummary
Companion
object Companion

Functions

NameSummary
consumePurchase
suspend fun consumePurchase(sku: String)
Allow the consumable IAP product to be purchased again. Conceptually, this indicates that the item was used or consumed. Important: Make sure to pass the correct SKU of the purchase that will be consumed. This value is case-sensitive and should match exactly with the product SKU set in the Developer Dashboard.
getProductsBySku
fun getProductsBySku(coroutineScope: CoroutineScope, skus: List<String>): PagedResults<Product>
Retrieve a list of IAP products that can be purchased. Note: You must provide a list of SKUs (Stock Keeping Units) to retrieve the corresponding product information. The SKUs are used to identify the products in the Oculus store, which can be retrieved by accessing the Developer Dashboard or by horizon.platform.iap.models.Purchase.sku.
getViewerPurchases
suspend fun getViewerPurchases(): List<Purchase>
Retrieve a list of Purchase that the Logged-In-User has made. This list will also contain consumable purchases that have not been consumed. Note: This method returns all purchases, including consumable and non-consumable ones. If you only want to retrieve durable purchases, use get_viewer_purchases_durable_cache instead.
getViewerPurchasesDurableCache
suspend fun getViewerPurchasesDurableCache(): List<Purchase>
Retrieve a list of Purchase that the Logged-In-User has made. This list will only contain durable purchase (non-consumable) and is populated from a device cache. Important: It is recommended to use horizon.platform.iap.Iap.getViewerPurchases first and only check the cache if that fails. This method is intended as a fallback mechanism and may not always return up-to-date results.
launchCheckoutFlow
suspend fun launchCheckoutFlow(sku: String): Purchase
Launch the checkout flow to purchase the existing product. Oculus Home tries handle and fix as many errors as possible. Home returns the appropriate error message and how to resolve it, if possible. Returns a purchase on success, and an error on user cancellation or other errors. In the case of a user cancelation, the horizon.platform.common.models.Error.message value will contain a JSON object with a "category" property containing a value of "user_canceled".

Companion

object Companion
Did you find this page helpful?
Thumbs up icon
Thumbs down icon