[Solved] Weird Add Product Error

After updating to the newest IAP we are starting to see an issue with initializing IAP.

When we build for Gameroom it fails at StandardPurchasingModule.Instance() with the following print out:

UnityIAP FB: Facebook already Initialized, checking…
UnityIAP FB: Init OK
UnityIAP FB: AppId [ID]
UnityIAP FB: already logged in
UnityIAP FB: token UserId [ID]
UnityIAP FB: token ExpirationTime 8/28/2017 4:31:05 PM
Unable to Initalize IAP Object reference not set to an instance of an object
at UnityEngine.Purchasing.FacebookStoreBindings.RetrieveProducts (System.String json) [0x00000] in :0
at UnityEngine.Purchasing.FacebookStoreBindings.InitComplete () [0x00000] in :0
at UnityEngine.Purchasing.FacebookStoreBindings.Init () [0x00000] in :0
at UnityEngine.Purchasing.FacebookStoreImpl.SetNativeStore (INativeFacebookStore facebook) [0x00000] in :0
at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateFacebook () [0x00000] in :0
at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateStore () [0x00000] in :0
at UnityEngine.Purchasing.StandardPurchasingModule.Configure () [0x00000] in :0
at UnityEngine.Purchasing.Extension.AbstractPurchasingModule.Configure (IPurchasingBinder binder) [0x00009] in C:\buildslave\unity\build\Extensions\UnityPurchasing\Runtime\Purchasing\Extension\AbstractPurchasingModule.cs:17
at UnityEngine.Purchasing.PurchasingFactory…ctor (IPurchasingModule first, UnityEngine.Purchasing.Extension.IPurchasingModule[ ] remainingModules) [0x0001f] in C:\buildslave\unity\build\Extensions\UnityPurchasing\Runtime\Purchasing\PurchasingFactory.cs:18
at UnityEngine.Purchasing.ConfigurationBuilder.Instance (IPurchasingModule first, UnityEngine.Purchasing.Extension.IPurchasingModule[ ] rest) [0x00003] in C:\buildslave\unity\build\Extensions\UnityPurchasing\Runtime\Purchasing\ConfigurationBuilder.cs:89

We thought we would give just a regular standalone build a try and it got past StandardPurchasingModule.Instance() and was able to print out one of the Products ID set:

Adding Product : default1
|MacAppStore → default1
|MoolahAppStore → default1
|SamsungApps → default1
|WinRT → default1
|TizenStore → default1
|AppleAppStore → default1
|GooglePlay → default1
|AmazonApps → default1
|FacebookStore → default1

But then it fails when trying to add the Ids to the builder:

Argument cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2[System.String,System.String].ContainsKey (System.String key) [0x00099] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:474
at UnityEngine.Purchasing.IDs.SpecificIDForStore (System.String store, System.String defaultValue) [0x00008] in C:\buildslave\unity\build\Extensions\UnityPurchasing\Runtime\Purchasing\ConfigurationBuilder.cs:41
at UnityEngine.Purchasing.ConfigurationBuilder.AddProduct (System.String id, ProductType type, UnityEngine.Purchasing.IDs storeIDs) [0x00016] in C:\buildslave\unity\build\Extensions\UnityPurchasing\Runtime\Purchasing\ConfigurationBuilder.cs:103

Any Ideas what could be the issue?

Update with testing on an empty project:

Facebook 7.10.0
Unity IAP 1.11.4

If Facebook Initializes first the above error will show, yet if UnityIAP initalizes facebook i recieve the following output:

UnityIAP FB: AuthCallback()
UnityIAP FB: token UserId [ID]
UnityIAP FB: token ExpirationTime [Still Valid]
UnityIAP FB: productRequest = /[AppId]/products
UnityIAP FB: ProductListCallback() RawResult had an empty “data[ ]”
Billing failed to initialize!

So when I started to Initialize facebook first I tried calling the following:

FB.API(“/[AppId]/products”, HttpMethod.GET, (t) => Debug.Log(t.RawResult));

This returned all the purchases I set up in the facebook console, not an empty data[ ].

Is Unity IAP not calling FB.API?

@Helath ,

We have identified an initialization issue with the Facebook part of our plugin. We have a fix and it should be ready by the next version of the IAP plugin. (You should get an update notification in the Editor when this version is available.)

I apologize for any inconvenience this has caused.

I am also having this problem. Can you tell me when this problem will be resolved?
There is not much time left for the game being developed.

@adex0909

The plugin is being tested by QA. It should be released shortly, barring any significant issues.

Version 1.12.0 is now available and it should have the fix for Facebook that I mentioned.
https://forum.unity3d.com/threads/u…-1-12-0-is-now-available.415517/#post-3160929

If you still have issues with that version, please let us know.