Solved
Quest 2: IAP.GetProductsBySKU(Skus) is returning empty
Hi,
We have 2 apps - one Quest and one Rift and they are both setup with the same In-App purchase items with the same SKUs.
I am using the following code to get the IAP items using the skus:
public readonly string[] Skus = { "CPTIER1", "CPTIER2", "CPTIER3", "CPTIER4" };
public void GetIapItems(Action successCallback, Action<string> failureCallback)
{
string debugStr = "**** Oculus.GetIapItems: ";
foreach (var sku in Skus)
{
debugStr += "\n" + sku;
}
Debug.Log(debugStr);
IAP.GetProductsBySKU(Skus).OnComplete(msgProductList =>
{
if (msgProductList.IsError)
{
string errorMsg = msgProductList.GetError()?.Message ?? "Error getting products by sku";
Debug.LogError("OculusGetIapItems: " + errorMsg);
failureCallback?.Invoke(errorMsg);
return;
}
OculusItems = msgProductList.GetProductList();
debugStr = "**** msgProductList.GetProductList(): " + msgProductList.GetProductList().Count;
foreach (var oculusItem in OculusItems)
{
debugStr += "\n" + oculusItem.Sku + " -- " + oculusItem.Name + " -- " + oculusItem.FormattedPrice;
}
Debug.Log(debugStr);
successCallback?.Invoke();
});
}In Unity Editor, it uses the Rift app id and gets the items successfully. Tested it with a windows build as well and it gets the 4 items requested.
Issue:
In android build on Quest 2 however, there is no error and it just returns empty list when all 4 items are requested. The debug log prints this:
12-09 17:27:26.046 6163 6184 I Unity : **** Oculus.GetIapItems:
12-09 17:27:26.046 6163 6184 I Unity : CPTIER1
12-09 17:27:26.046 6163 6184 I Unity : CPTIER2
12-09 17:27:26.046 6163 6184 I Unity : CPTIER3
12-09 17:27:26.046 6163 6184 I Unity : CPTIER4
12-09 17:27:26.046 6163 6184 I Unity :
12-09 17:27:26.046 6163 6184 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-09 17:27:26.046 6163 6184 I Unity :
12-09 17:27:26.095 6163 6184 I Unity : **** msgProductList.GetProductList(): 0
12-09 17:27:26.095 6163 6184 I Unity :
12-09 17:27:26.095 6163 6184 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-09 17:27:26.046 6163 6184 I Unity : CPTIER1
12-09 17:27:26.046 6163 6184 I Unity : CPTIER2
12-09 17:27:26.046 6163 6184 I Unity : CPTIER3
12-09 17:27:26.046 6163 6184 I Unity : CPTIER4
12-09 17:27:26.046 6163 6184 I Unity :
12-09 17:27:26.046 6163 6184 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-09 17:27:26.046 6163 6184 I Unity :
12-09 17:27:26.095 6163 6184 I Unity : **** msgProductList.GetProductList(): 0
12-09 17:27:26.095 6163 6184 I Unity :
12-09 17:27:26.095 6163 6184 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
If I request only the first 2 SKUs, "CPTIER1", "CPTIER2" then it returns them correctly. Except for these 2 items, requesting 3 or all 4 items, it returns empty.
12-09 17:42:07.409 6862 6883 I Unity : **** Oculus.GetIapItems:
12-09 17:42:07.409 6862 6883 I Unity : CPTIER1
12-09 17:42:07.409 6862 6883 I Unity : CPTIER2
12-09 17:42:07.409 6862 6883 I Unity :
12-09 17:42:07.409 6862 6883 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-09 17:42:07.409 6862 6883 I Unity :
12-09 17:42:07.578 6862 6883 I Unity : **** msgProductList.GetProductList(): 2
12-09 17:42:07.578 6862 6883 I Unity : CPTIER1 -- Currency 1 -- C$1.19
12-09 17:42:07.578 6862 6883 I Unity : CPTIER2 -- Currency 2 -- C$5.79
12-09 17:42:07.578 6862 6883 I Unity :
12-09 17:42:07.578 6862 6883 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-09 17:42:07.409 6862 6883 I Unity : CPTIER1
12-09 17:42:07.409 6862 6883 I Unity : CPTIER2
12-09 17:42:07.409 6862 6883 I Unity :
12-09 17:42:07.409 6862 6883 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
12-09 17:42:07.409 6862 6883 I Unity :
12-09 17:42:07.578 6862 6883 I Unity : **** msgProductList.GetProductList(): 2
12-09 17:42:07.578 6862 6883 I Unity : CPTIER1 -- Currency 1 -- C$1.19
12-09 17:42:07.578 6862 6883 I Unity : CPTIER2 -- Currency 2 -- C$5.79
12-09 17:42:07.578 6862 6883 I Unity :
12-09 17:42:07.578 6862 6883 I Unity : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
Oculus Quest In-App items on the dashboard:
Unity Version : 2019.4.14f1
Oculus Integration Version : 20.1
Thank you.
