Oculus Go Development

On 6/23/20 Oculus announced plans to sunset Oculus Go. Information about dates and alternatives can be found in the Oculus Go introduction.

Oculus Quest Development

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible. For additional information and context, please see Submitting Your App to the Oculus Quest Store.

In-App Purchase Integration

Note: You are viewing the Native version of this topic. To view this topic for Unity development, see In-App Purchase Integration (Unity). To view this topic for Unreal development, see In-App Purchase Integration (Unreal).

In-app purchases (IAP) allow users to purchase items without leaving your app.

There are two types of items that you can offer in your game, consumable and durable.

  • Durable - Durable items are single-use items that persist with the user. Meaning, once the item has been purchased, it cannot be purchased again. For example, you may offer the initial game download for free with only a demo level, then offer additional levels as in-app purchases.
  • Consumable - Consumable items can be purchased multiple times. For example, consumable IAP may be ‘character lives’ or ‘coins’ that are used during the course of gameplay. Consumable purchases must be ingested by your app before they can be made available for purchase again.

Note: All IAP operations require the user to be connected to the Internet.

Define the Items For Purchase

Before you begin integrating the IAP methods in your experience, you need to define the items that you will be offering for purchase. The in-app purchase list can be updated or modified at any time.

Define IAP with the Add-on Dashboard

Use the Add-on page of the developer dashboard to easily define items for purchase. This dashboard enables you to set a name, the SKU that you use to reference the add-on in your code, a description, price, assets and other information that describe the add-on. See Add-ons for more information.

Bulk Definition of IAP Items

You can define your IAP in bulk, create a tab-separated (.tsv) file with the following format. An IAP item template with this format available for download from the IAP section of the Developer Dashboard.

SKUNAMEDescriptionCurrencyAmountItem Type
unlock_level_2Level 2 UnlockPurchase this item to unlock the 2nd level in the game.USD9.99durable
100_coins100 Coins100 coins to spend as in-game currency.USD2.99consumable

The values for the items in the table above are:

  • SKU - The unique string that you use to reference the IAP item in your app. The SKU is case-sensitive, the name you define in the Dashboard must exactly match the SKU you reference in your code.
  • Name - The short descriptive name that the user will see.
  • Description - The full description of the item the user will see. Be as descriptive as necessary to avoid any confusion.
  • Currency - Currency is the unit of currency that the item will be charged in. Only USD is supported at this time. The IAP item will be converted to the local user’s preferred currency at the time of purchase.
  • Amount - The amount to charge for the IAP item. Available prices are listed below.
  • Item Type - The type of item for sale. Options are consumable and durable. Please see the description above for the difference between the two.

Once you’ve created the IAP file, you can upload your IAP items by selecting Upload TSV and following the on-screen prompts. After you upload your items, you will be able to view them on the Add-Ons page.

Note: You must enter your payment information for your account before you can download the template or upload a file.

Available IAP Prices

The following are the supported IAP item price tiers:

$0.01, $0.10, $0.99, $1.49, $1.99, $2.00, $2.37, $2.49, $2.67, $2.75, $2.99, $3.34, $3.99, $4.99, $5.35, $5.99, $6.69, $6.99, $7.49, $7.99, $8.99, $9.69, $9.99, $10.49, $10.99, $11.99, $12.99, $14.99, $16.74, $16.99, $18.74, $19.99, $20.99, $22.49, $22.99, $24.99, $26.99, $27.99, $29.99, $33.49, $34.99, $36.99, $39.99, $44.99, $45.99, $48.99, $49.99, $54.99, $59.99, $69.99, $79.99 $89.99, $99.99, $159.99, $199.99

App Manifest Requirements

For IAP associated with downloadable content, mark your app as requiring an Internet connection.

  • On the app dashboard, on the App Specifications page, From Is an Internet Connection Required drop-down, select the Internet connection required for downloadable contents option.
  • Make sure the Android manifest file has the READ_EXTERNAL_STORAGE permission because asset files are typically stored on external storage. The following example shows the manifest entry.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Integrate IAP

Once you’ve defined the items that you would like to offer as purchases, you can start building them as purchasable items into your app.

The following SDK methods can be called from your client app. Detail about each function can be found in the Platform SDK Reference Content.

Get a List of Assets Associated with an App

At app startup, you can call the following method to get a list of all the assets associated with the app.

ovr_AssetFile_GetList

This method returns a list of available asset details. Each item in the array has the following properties:

  • assetFileName - the file name,
  • assetFileID - Asset identifier
  • IapStatus, which is one of the following values: free, entitled, or not-entitled
  • downloadStatus, which is one of the following values:
    • installed meaning that user has installed the file
    • available meaning that user can download the file
    • in-progress meaning the file is being downloaded or is installing for that user.

Initiate downloads

If there is a file that is available to download, meaning its status is free or entitled, and download_status = available, you can initiate the download by calling:

  • ovr_AssetFile_DownloadById

To make this call, pass the ID of the item as returned by the initial GetList call. When you make this call, you will receive an immediate DownloadResult response with the path to the asset as a confirmation that the request was successful. You should also listen for DownloadUpdate notifications which return info about transferred bytes, and a complete flag that notifies you when the download is complete.

Retrieve all of the user’s purchased items

To retrieve a list of IAP purchases that the user has made, use the following method. The returned list includes all durable type purchases and any consumable type purchases that have not been consumed.

ovr_IAP_GetViewerPurchases()

Retrieve a cached list of durable items a user has purchased

To retrieve a list of durable IAP items that the user has purchased use the following method. The returned list contains non-consumable purchases and is populated from the device cache. You should always use GetViewerPurchases first and then this method if the other call fails.

ovr_IAP_GetViewerPurchasesDurableCache()

Retrieve a list of available items and prices by SKU

To retrieve a list of IAP items that are available to the user to purchase, by SKU, use the following method:

ovr_IAP_GetProductsBySKU()

Launch the checkout flow for a SKU

To launch the checkout flow for a user to complete the purchase of a specified user, use the following method:

ovr_IAP_LaunchCheckoutFlow()

Consume a purchased item

To consume a purchased item on behalf of a user, which then marks the item as used, in-app, use the following method:

ovr_IAP_ConsumePurchase()

S2S REST Requests

Our S2S REST APIs are available as a secure channel to interact with the Oculus Platform. For example, you may wish to track and consume coins purchased through in-app purchases on your trusted server. This prevents any client-side tampering to grant unpurchased gems. Using the S2S APIs are not required, but may be used if you wish.

See the Server-to-Server API Basics page for information about interacting with our APIs.

Parameter Descriptions

ParameterDescriptionTypeExample
skuThe sku for the item, defined when created on the Developer Center.string"50_gems"
fieldsThe IAP fields to display.comma separated list of strings"item{skus},id"

Verify Item Ownership

Verify that a user owns an item.

Example Request

$ curl -d "access_token=$USER_ACCESSTOKEN" -d "sku=$SKU"
        https://graph.oculus.com/$APPID/verify_entitlement

Example Response

{"success":true}

Consume an IAP Item

Consume an IAP item that a user has purchased.

Example Request

$ curl -d "access_token=$USER_ACCESSTOKEN" -d "sku=$SKU"
        https://graph.oculus.com/$APPID/consume_entitlement

Example Response

{"success":true}

Retrieve Items Owned

Retrieve a list of items that the user owns.

Example Request

$ curl -G -d "access_token=$USER_ACCESSTOKEN" -d "sku=$SKU" -d 'fields'='item{skus},id'
        https://graph.oculus.com/$APPID/viewer_purchases

Example Response

{
  "data": [
    {
      "id": "963119010431337",
      "item": {
        "sku": "EXAMPLE1"
      }
    }
  ]
}

Test IAP

You can test your IAP integration by creating test users for your organization. These test users have permission to purchase IAP items in your app, including Alpha, Beta, and Release Candidate apps, without using real money. These users will work with all applications in your organization and can be deleted at any time.

Create a test user using the tool in our Developer Dashboard. Information about creating and working with test users can be found in the Test Users section.

Once the test user has been created, log in to that account using the generated email and password you created and add a payment method for the user. Since this user will be testing the IAP checkout flow, add the following credit card numbers to test different IAP flows.

  • Always succeeds - 4111 1177 1155 2927
  • Fails at sale - 4111 1193 1540 5122

These cards only work with test users and can only be used within your organization. When using the test credit cards you must use a valid address, an expiration date that has not already passed, and 111 for the Security Code.

Note: Do not use a real credit card with test users, it will be charged as a regular transaction. Please use the test credit card numbers provided.

Once the test user has been created and payment methods have been added, login to the Oculus Store as the test user and download the app that you would like to test. This entitles the user to the app and allows them to complete the IAP purchase process. Information about downloading test and development builds can be found in the Testing and Releasing Builds section.

Distributing IAP Items with Oculus Keys

You can optionally distribute IAP items with Oculus Keys if your app has been approved for release or key generation. To create a key for your IAP item:

  • Log in to The Developer Dashboard and find your app
  • Navigate to the Manage Builds > Oculus Keys page. If the app has been reviewed by Oculus and approved for release or key generation, the Oculus Keys page appears and you have the option to select Create New Oculus Keys.
  • Create a key using the on-page instructions, specifying the SKU for the IAP item you wish to distribute with a key.
  • Click Create when you are finished to display the key.
  • Copy and save the key in a safe place as you cannot retrieve it after you exit this page.