Search Unity

[Solved] Purchasing; not everything is correctly loaded

Discussion in 'Unity IAP' started by Mycroft, Mar 17, 2016.

Thread Status:
Not open for further replies.
  1. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    I'm using Unity.Purchasing for consumables and it's been working fine. I've started to work on Subscriptions as suggested here ValidatingReceipts.


    Unfortunately, I don't seem to have access to the IAP Receipt Validation Obfuscator. No Window > Unity IAP option appears under the Window drop down.


    Also, when I try the Validation code
    Code (CSharp):
    1. public PurchaseProcessingResult ProcessPurchase (PurchaseEventArgs e)
    2. {
    3.     // Unity IAP's validation logic is only included on these platforms.
    4. #if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
    5.     // Prepare the validator with the secrets we prepared in the Editor
    6.     // obfuscation window.
    7.     var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
    8.         AppleTangle.Data(), Application.bundleIdentifier);
    9.  
    10.     try {
    11.         // On Google Play, result will have a single product Id.
    12.         // On Apple stores receipts contain multiple products.
    13.         var result = validator.Validate(e.purchasedProduct.receipt);
    14.         Debug.Log("Receipt is valid. Contents:");
    15.         foreach (IPurchaseReceipt productReceipt in result) {
    16.             Debug.Log(productReceipt.productID);
    17.             Debug.Log(productReceipt.purchaseDate);
    18.             Debug.Log(productReceipt.transactionID);
    19.         }
    20.         // Unlock the appropriate content here.
    21.     } catch (IAPSecurityException) {
    22.         Debug.Log("Invalid receipt, not unlocking content");
    23.     }
    24. #endif
    25.  
    26.     return PurchaseProcessingResult.Complete;
    27. }
    I end up getting an error

    I'm already using UnityEngine and UnityEngine.Purchasing, but it still seems as if I'm missing something.
     
  2. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @Mycroft,

    What version of the Unity Editor are you using? Can you try updating to the most recent version of IAP? You can do this by going to the services window, selecting IAP, and then clicking the import button.
     
  3. Mycroft

    Mycroft

    Joined:
    Aug 29, 2012
    Posts:
    160
    I'll give that a shot soon; thanks erika
     
    erika_d likes this.
  4. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    hi @erika_d the Class is just not there,

    I have everything else about IAP set up and in use.

    When I add
    Code (CSharp):
    1. var validator = new CrossPlatformValidator
    The type or namespace name `CrossPlatformValidator' could not be found. Are you missing a using directive or an assembly reference?


    what the heck is the library name !??
     
  5. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    295
    Make sure you've got the latest version. The validator is in UnityEngine.Purchasing.Security if I recall correctly.
     
    Dmitry-Fofanov, erika_d and mpinol like this.
  6. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    476
    Ahh ! It is .....

    UnityEngine.Purchasing.Security

    THANK YOU, mh114!!!!!!!!
     
    idurvesh, Andreich80lvl and nicholasr like this.
Thread Status:
Not open for further replies.