Forum Discussion
katemode
1 year agoHonored Guest
Trouble with In App Purchases IAP
I can't get IAP working.
In the developer dashboard:
- I have created an app
- done the data privacy checkup
- activated IAP on the platform services page
- created and published a SKU for testing
In unity
- Imported the Meta XR all-in-one SDK, and verified that platform services is a part of that
- Set my app ID for both "oculus rift" and "Meta Quest/2/Pro"
In my script I have the following
void Awake ()
{
try
{
Core.AsyncInitialize();
#if UNITY_ANDROID && !UNITY_EDITOR
IAP.GetViewerPurchases().OnComplete(ViewerPurchasesCallback);
#elif UNITY_EDITOR
Debug.LogWarning("Running in Unity Editor. Oculus platform initialization is skipped.");
#endif
}
catch(UnityException e)
{
Debug.LogError("Platform failed to initialize due to exception.");
Debug.LogException(e);
// Immediately quit the application.
UnityEngine.Application.Quit();
}
}
void ViewerPurchasesCallback(Message<PurchaseList> msg) {
Debug.Log("Callback");
if (msg.IsError) {
Debug.LogError("Error retrieving purchases: " + msg.GetError().Message);
Debug.LogError("Error retrieving purchases: " + msg.GetError().Code);
} else {
foreach (Purchase purchase in msg.Data) {
Debug.Log("User has purchased: " + purchase.Sku);
}
}
}
I get the error message
"Error retrieving purchases: package not in library"
"Error retrieving purchases: 2"
I can not find any documentation with that error message or any information about error codes
3 Replies
- Wang_ShiExplorer
Any updates? Is your app live in App Store?
- katemodeHonored Guest
Hmm.
I did get it working, and my code is still almost identical to this.
I *think* this issue was that I needed to actually set my app on the developer platform and set up platform services. https://developer.oculus.com/
I think I even had to do a push out to an alpha channel before it started working, though after that a regular build from unity worked.
Good Luck
- Wang_ShiExplorer
Thanks, it works. I push my app to an alpha channel and it works.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 year ago
- 4 months ago
- 4 years agoAnonymous