Question by 
               BrodyDaChappy · Apr 01, 2017 at 08:04 PM · 
                androidnot workinggoogle playpurchase  
              
 
              Button Disappears even when saving?
Hi All,
I need a script that is checking whether my IAP items have been purchased or not, how do i handle this, looking at receipt validation and cant understand how to implement it into my scripts below.
 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 using CompleteProject;
  
 public class ShopController : MonoBehaviour {
  
  
     public Canvas shopCanvas;
     public GameObject iapPanel;
     public GameObject mainPanel;
     public GameObject ShopCanvas;
     public GameObject EndlessButton;
  
     void Awake()
     {
         ShopCanvas.SetActive (false);
         EndlessButton.SetActive (false);  // setting main menu button to false on first start..
     }
Below is part of the Purchaser script supplied by Unity ... this handles the purchase.
 public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
         {
  
             //a non-consumable product has been purchased by this user.
             if (String.Equals(args.purchasedProduct.definition.id, kProductIDNonConsumable, StringComparison.Ordinal))
             {
                 Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
                 // TODO: The non-consumable item has been successfully purchased, grant this item to the player.
                 if (DataObject.instance == null)
                 {
                     DataObject.instance = new DataObject();
                     DataObject.instance.Load();
                 }
  
                 DataObject.instance.adsRemoved = true;
                 EndlessButton.SetActive (true);    // Setting Endless button to true after purchase.
                 Debug.Log("Ads Removed");
                 DataObject.instance.Save();
  
             }
             // Or ... an unknown product has been purchased by this user. Fill in additional products here....
             else
             {
                 Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
             }
  
             // Return a flag indicating whether this product has completely been received, or if the application needs
             // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
             // saving purchased products to the cloud, and when that save is delayed.
             return PurchaseProcessingResult.Complete;
         }
  
  
         public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
         {
             // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing
             // this reason with the user to guide their troubleshooting actions.
             Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
  
             if (DataObject.instance == null)
             {
                 DataObject.instance = new DataObject();
                 DataObject.instance.Load();
             }
             DataObject.instance.adsRemoved = false;
             Debug.Log("Purchase Failed, Text is Remove Ads & Endless");
             DataObject.instance.Save();
         }
     }
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                