cancel
Showing results for 
Search instead for 
Did you mean: 

IAP Question

ki7a
Protege
Hi!
I am trying for the first time, using the IAP system for GearVR using Unity.
I've managed to make a purchase for a Durable item. but when I get back to the game it crashes. 
My guess is that I can't purchase the same item again, but maybe the crash is because something is wrong with my check script.
I am using the script example from powerballs, with just a bool I've added for my internal check (interntalcheckok). maybe I am doing it all wrong.. Please help!

public void FetchPurchasedProducts()
{
     IAP.GetViewerPurchases().OnComplete(GetViewerPurchasesCallback);
}

void GetViewerPurchasesCallback(Message<PurchaseList> msg)
{
    if (msg.IsError)
    {
         PlatformManager.TerminateWithError(msg);
          return;
     }

    foreach (Purchase p in msg.GetPurchaseList())
    {
        Debug.LogFormat("Purchased: sku:{0} granttime:{1} id:{2}", p.Sku, p.GrantTime, p.ID);
       interntalcheckok = true;
     }
}

private void LaunchCheckoutFlowCallback(Message<Purchase> msg)
{
   if (msg.IsError)
   {
     PlatformManager.TerminateWithError(msg);
     return;
    }

   Purchase p = msg.GetPurchase();
   Debug.Log("purchased " + p.Sku);
   interntalcheckok = true;
}
0 REPLIES 0