Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[Solved] Error - GooglePlayValidator

Discussion in 'Unity IAP' started by Arganoid, Aug 17, 2016.

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

    Arganoid

    Joined:
    Oct 12, 2013
    Posts:
    16
    I'm currently implementing receipt validation - my code matches the example code here:

    http://docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html

    I have previously made two test purchases, these were made before Google's recent changes as described here:
    http://forum.unity3d.com/threads/bizarre-iap-behaviour-on-android.412981/#post-2693470

    On startup I get the following error:

    Code (CSharp):
    1. ArgumentException: Failed to load data.
    2. LipingShare.LCLib.Asn1Processor.Asn1Parser.LoadData (System.IO.Stream stream)
    3. UnityEngine.Purchasing.Security.RSAKey..ctor (System.Byte[] data)
    4. UnityEngine.Purchasing.Security.GooglePlayValidator..ctor (System.Byte[] rsaKey)
    5. UnityEngine.Purchasing.Security.CrossPlatformValidator..ctor (System.Byte[] googlePublicKey, System.Byte[] appleRootCert, System.String googleBundleId, System.String appleBundleId)
    6. UnityEngine.Purchasing.Security.CrossPlatformValidator..ctor (System.Byte[] googlePublicKey, System.Byte[] appleRootCert, System.String appBundleId)
    7. IAPManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e)
    8. UnityEngine.Purchasing.StoreListenerProxy.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e)
    9. UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product)
    10. UnityEngine.Purchasing.PurchasingManager.OnProductsRetrieved (System.Collections.Generic.List`1 products)
    11. UnityEngine.Purchasing.NativeJSONStore.OnProductsRetrieved (System.String json)
    12. UnityEngine.Purchasing.ScriptingUnityCallback+<OnProductsRetrieved>c__AnonStorey1.<>m__0 ()
    13. UnityEngine.Purchasing.Extension.UnityUtil.Update ()

    If I try to purchase the content I get this:

    Code (CSharp):
    1. ArgumentException: Failed to load data.
    2. LipingShare.LCLib.Asn1Processor.Asn1Parser.LoadData (System.IO.Stream stream)
    3. UnityEngine.Purchasing.Security.RSAKey..ctor (System.Byte[] data)
    4. UnityEngine.Purchasing.Security.GooglePlayValidator..ctor (System.Byte[] rsaKey)
    5. UnityEngine.Purchasing.Security.CrossPlatformValidator..ctor (System.Byte[] googlePublicKey, System.Byte[] appleRootCert, System.String googleBundleId, System.String appleBundleId)
    6. UnityEngine.Purchasing.Security.CrossPlatformValidator..ctor (System.Byte[] googlePublicKey, System.Byte[] appleRootCert, System.String appBundleId)
    7. IAPManager.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e)
    8. UnityEngine.Purchasing.StoreListenerProxy.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e)
    9. UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product)
    10. UnityEngine.Purchasing.PurchasingManager.OnPurchaseSucceeded (System.String id, System.String receipt, System.String transactionId)
    11. UnityEngine.Purchasing.NativeJSONStore.OnPurchaseSucceeded (System.String id, System.String receipt, System.String transactionID)
    12. UnityEngine.Purchasing.ScriptingUnityCallback+<OnPurchaseSucceeded>c__AnonStorey2.<>m__0 ()
    13. UnityEngine.Purchasing.Extension.UnityUtil.Update ()
     
  2. Arganoid

    Arganoid

    Joined:
    Oct 12, 2013
    Posts:
    16
    I've now deleted the old test purchases. On purchasing an item, the second error shown in my original post occurs.
     
  3. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,392
    Hi @Arganoid,

    That error looks like it's coming from the RSA key that is being sent to the function. Have you pasted the Google Public Key into the IAP Receipt Validation Obfuscator yet? If so, can you recopy it and try again.
     
    nicholasr and erika_d like this.
  4. Arganoid

    Arganoid

    Joined:
    Oct 12, 2013
    Posts:
    16
    Fixed, it looks like my error was thinking that I had to paste the key used in the Android Publishing Settings.
     
    nicholasr and erika_d like this.
Thread Status:
Not open for further replies.
unityunity