In App purchasing Unity error

Whenever I go to the Services/In-App Purchasing tab in my project settings,I get the following error:

JSONParseException: Cannot parse json value starting with ‘<!doc’ at line 1, column 1
UnityEditorInternal.JSONParser.ParseValue () (at <6e08e61cfda04255b3972ba7f0515fae>:0)
UnityEditorInternal.JSONParser.Parse () (at <6e08e61cfda04255b3972ba7f0515fae>:0)
UnityEditor.Connect.PurchasingProjectSettings+EnabledState.OnGetGooglePlayKey (UnityEngine.AsyncOperation op) (at <0ac3c60aa2c24454b6cb1133def47330>:0)
UnityEngine.AsyncOperation:InvokeCompletionEvent()

I can enter a valid key, verify, save my project, then close the window and open it again, and it’s no longer there. This is happening on version 2021.3.20f1 Personal.

This may be related to Unity’s deprecation of the Legacy Analytics system.
Check out this thread on the Unity Forums:
https://forum.unity.com/threads/setting-your-google-play-public-key-in-editor-vs-dashboard.1334915/

I created a copy of my project and imported the copy into the latest Unity 2023 beta (2023.2.6f1). It seems to be working significantly better than it was before now. A number of things have actually started working better. I can now connect Unity properly to my IDE of preference (VS Code), My device simulator is now working properly.

I am still getting the following debug message:

Unity IAP: Unity In-App Purchasing requires Unity Gaming Services to have been initialized before use.

  • Find out how to initialize Unity Gaming Services by following the documentation https://docs.unity.com/ugs-overview/services-core-api.html#InitializationExample
    or download the 06 Initialize Gaming Services sample from Package Manager > In-App Purchasing > Samples.
  • If you are using the codeless API, you may want to enable the enable Unity Gaming Services automatic initialization by checking the Automatically initialize Unity Gaming Services checkbox at the bottom of the IAP Catalog window
    UnityEngine.Purchasing.BaseIAPButton:OnEnable () (at ./Library/PackageCache/com.unity.purchasing@4.10.0/Runtime/Codeless/BaseIAPButton.cs:61)

But at least for now, Anyway, the mechanics of my store are actually working in the Unity Editor.

I haven’t tested to see if upgrading to my version of 2022, or the latest version of 2022, or the latest version of 2021 would fix.

Something to note is that for my version, I get it set up with the IAP button, to use PurchaseFailureDescription instead of PurchaseFailureReason, and using UnityEngine.Purchasing.Extension;

The Debug Message is telling you exactly where to go to get Unity Gaming Services initialized.

Privacy & Terms