Search Unity

Game Foundation not supporting Unity IAP 2.1.1 and above? and Cancel Purchase issue

Discussion in 'Game Foundation' started by Raghavendra, Nov 11, 2020.

  1. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
    Hi,

    I am getting a few type or namespace could not be found error if i update my Unity IAP plugin to 2.1.1 or above. Currently, only till 2.0.6 is working.

    Also, I am getting the following error if i cancel a purchase and I can't purchase anything else for that particular session.

    Code (CSharp):
    1. ArgumentNullException: Value cannot be null.
    2.     Parameter name: key
    3.       at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) [0x00000] in <00000000000000000000000000000000>:0
    4.       at System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) [0x00000] in <00000000000000000000000000000000>:0
    5.       at UnityEngine.Purchasing.ProductCollection.WithStoreSpecificID (System.String id) [0x00000] in <00000000000000000000000000000000>:0
    6.       at UnityEngine.Purchasing.PurchasingManager.OnPurchaseFailed (UnityEngine.Purchasing.Extension.PurchaseFailureDescription description) [0x00000] in <00000000000000000000000000000000>:0
    7.       at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0
    8.       at UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) [0x00000]
     
    Last edited: Nov 11, 2020
    infosekr likes this.
  2. yusufdemir2012

    yusufdemir2012

    Joined:
    Dec 21, 2013
    Posts:
    50
    I am getting same error.
    Unity version : 2017.4.39f1
    Unity IAP version : 2.2.0 (From Asset store)
    Logs:

    Code (CSharp):
    1. Managed Stack Trace:
    2.  
    3. System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) (at <00000000000000000000000000000000>:0)
    4. System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at <00000000000000000000000000000000>:0)
    5. System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) (at <00000000000000000000000000000000>:0)
    6. UnityEngine.Purchasing.ProductCollection.WithStoreSpecificID (System.String id) (at <00000000000000000000000000000000>:0)
    7. UnityEngine.Purchasing.PurchasingManager.OnPurchaseFailed (UnityEngine.Purchasing.Extension.PurchaseFailureDescription description) (at <00000000000000000000000000000000>:0)
    8. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <00000000000000000000000000000000>:0)
    9. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <00000000000000000000000000000000>:0)
    10. UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
    11. UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) (at <00000000000000000000000000000000>:0)
    12. Rethrow as TargetInvocationException: UnityEngine.Purchasing.GooglePurchaseUpdatedListener.onPurchasesUpdated(UnityEngine.AndroidJavaObject,UnityEngine.AndroidJavaObject)
    13. UnityEngine.AndroidJavaProxy.Invoke (System.String methodName, System.Object[] args) (at <00000000000000000000000000000000>:0)
    14. UnityEngine._AndroidJNIHelper.InvokeJavaProxyMethod (UnityEngine.AndroidJavaProxy proxy, System.IntPtr jmethodName, System.IntPtr jargs) (at <00000000000000000000000000000000>:0)
     
  3. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
  4. U_AdrienPDB

    U_AdrienPDB

    Unity Technologies

    Joined:
    Aug 14, 2019
    Posts:
    8
    Hi,

    We also discovered this issue shortly after the release and finally fixed it a few days ago. This fix will be out with the next patch.
    As you found out yourself, using 2.0.6 is the current workaround for this issue.

    Regarding the Cancel Purchase issue, it is indeed an error from the IAP SDK, they will keep you posted on their forums when they fix it.
     
    erika_d likes this.
  5. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
    Thanks. What's strange is that it worked properly when I created an empty project and imported GameFoundation and Unity IAP plugin. I did not get any namespace related errors.
     
    erika_d likes this.
  6. U_AdrienPDB

    U_AdrienPDB

    Unity Technologies

    Joined:
    Aug 14, 2019
    Posts:
    8
    Namespace related errors happen only when you tick the Purchasing Enabled option in Game Foundation's runtime settings. This is because this action adds a compile flag to the project so it can use IAP SDK code inside Game Foundation.
     
    erika_d likes this.
  7. Raghavendra

    Raghavendra

    Joined:
    Mar 14, 2014
    Posts:
    52
    Oh, yeah. That explains. Thanks.
     
    erika_d likes this.
  8. metiscoda

    metiscoda

    Joined:
    Nov 18, 2013
    Posts:
    41
    I'm dealing with this now as well - is there a patch available now?
     
  9. erika_d

    erika_d

    Joined:
    Jan 20, 2016
    Posts:
    413
    Hi @metiscoda et al,

    We just moments ago released Game Foundation 0.8.0 which is mostly a bugfix release (but had a few other things as well). Release notes and forum post are still forthcoming, but wanted to let you know that it includes fixes for some of the Game Foundation/IAP purchasing issues. There are still some bugs on the IAP side with IAP version 2.2.1 though, and they're working on fixes for those as well. But the issues with 2.1.1. should be resolved in this new Game Foundation release. :)
     
    metiscoda likes this.