Returns: A GDOculusPlatformPromise that will contain a Dictionary - the data key will contain information about each purchase (both consumable and durable). The promise will error if the request couldn't be fulfilled.
GDOculusPlatform.iap_get_viewer_purchases()\
.then(func(user_purchases:Dictionary):forpurchaseinuser_purchases.data:print("Purchased at: ",purchase.grant_time))\
.error(func(user_purchases_err):print("Unable to retrieve user purchases: ",user_purchases_err))
Requests durable purchases of the logged-in user from the device cache. It is recommended to use iap_get_viewer_purchases first and only check the cache if that fails.
Returns: A GDOculusPlatformPromise that will contain a Dictionary - the data key will contain information about durable purchases from the device cache. The promise will error if the request couldn't be fulfilled.
GDOculusPlatform.iap_get_viewer_purchases_durable_cache()\
.then(func(user_durable_purchases:Dictionary):fordurable_purchaseinuser_durable_purchases.data:print("Purchased at: ",durable_purchase.grant_time))\
.error(func(user_durable_purchases_err):print("Unable to retrieve user purchases from cache: ",user_durable_purchases_err))
Requests product information of a list of SKUs. The sku_listArray must only contain Strings.
Returns: A GDOculusPlatformPromise that will contain a Dicitonary - the data key will contain information about each product requested. The promise will error if the request couldn't be fulfilled.
{"data":[{"sku":"gems_pack_10","name":"10 Gems","description":"This pack of shiny gems sure is worth!","formatted_price":"$9.99"},{"sku":"gems_pack_50","name":"50 Gems","description":"This pack of shiny gems sure is even more worth!","formatted_price":"$39.99"}],"next_page_url":""}
varsku_list:Array=["gems_pack_10","gems_pack_50"]GDOculusPlatform.iap_get_products_by_sku(sku_list)\
.then(func(prods:Dictionary):ifnotprods.next_page_url.is_empty():# Get next pagepassforproductinprods.data:print("Product info: ",product))\
.error(func(products_err):print("Unable to retrieve products from SKUs: ",products_err))
Returns: A GDOculusPlatformPromise that will contain true as an argument if the request was successful. The promise will error if the product couldn't be consumed.
Launches a checkout flow for the product with the given SKU. The user will be able to complete the purchase or cancel it.
Returns: A GDOculusPlatformPromise that will contain a Dictionary with the product information if fulfilled. The promise will error if the user canceled the purchase or if the checkout flow couldn't be launched.
{"category":"user_canceled","code":0,"message":"The purchase has been canceled."}
Note
Sometimes, after the user makes a purchase, the iap_status key from the assetfile_get_list will still show up as not-entitled for some time. You will be able to download assets associated with the product, but the iap_status may take some time to update.
GDOculusPlatform.iap_launch_checkout_flow("my_product_sku")\
.then(func(product:Dictionary):ifproduct.purchase_str_id!="":print("User completed the purchase!")else:print("False alarm, the user didn't purchase the item."))\
.error(func(checkout_flow_err):iftypeof(checkout_flow_err)==TYPE_DICTIONARY\
andcheckout_flow_err.has("category")\
andcheckout_flow_err.category=="user_canceled":print("The user canceled the purchase!")else:print("Unable to launch checkout flow: ",checkout_flow_err))