Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

So many problems with IAP 3.1.0

Discussion in 'Unity IAP' started by lz7cjc, May 6, 2021.

  1. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    Hi
    I had V2 working fine but was alerted by App Store the other day that IAP was no longer working. So I am now trying to get V3 working. I decided to start with a clean project but not getting very far. I have followed a few tutorials but am utterly stuck

    I have installed IAP3 but under services->IAP I need to enter a key under options. I went to the Console but can't find "Services and API" even when I use the search tool. Where can I find this?

    I also get errors like this:
    Library\PackageCache\com.unity.purchasing@3.1.0\Runtime\AppleCore\INativeAppleStore.cs(5,42): error CS0122: 'UnityPurchasingCallback' is inaccessible due to its protection level
    Library\PackageCache\com.unity.purchasing@3.1.0\Runtime\SecurityStub\CrossPlatformValidator.cs(43,16): error CS0433: The type 'IPurchaseReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    Library\PackageCache\com.unity.purchasing@3.1.0\Runtime\SecurityStub\GooglePlayReceipt.cs(32,35): error CS0433: The type 'IPurchaseReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    Library\PackageCache\com.unity.purchasing@3.1.0\Runtime\SecurityStub\AppleValidator.cs(33,10): error CS0433: The type 'AppleReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    Library\PackageCache\com.unity.purchasing@3.1.0\Runtime\SecurityStub\AppleValidator.cs(53,10): error CS0433: The type 'AppleReceipt' exists in both 'Security, Version=1.0.7698.24420, Culture=neutral, PublicKeyToken=null' and 'UnityEngine.Purchasing.SecurityCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

    Because of these errors I can't compile the app so I can't upload to Google Play so I can't set up the project...

    Please, how do i fix this?
    thanks

    EDIT: I am using v2019 for my live project and can't upgrade to 2020 due to functionality I use being deprecated in later versions. I have tried this on both V2019 and 2020 with the same result
     
  2. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    for anyone else stumbling upon this, i appear to have fixed it... absolutely no idea how but what I did was delete anything that has anything to do with IAP.... first in the file structure then removed it from services-IAP

    Then I reinstalled from the package manager first and after that I went to IAP under services and updated there...
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, it's been a bit confusing for users. The release notes mention that when upgrading IAP, you first need to manually delete /Assets/Plugins/UnityPurchasing. Unfortunately the Service window continues to say Import. If you do, then the folder returns. We are moving to PackageManager from the Asset version, and having some growing pains. Once you upgrade, ensure that this folder does not exist, and don't click Import from the Services window.
     
    boutazzoutrachid likes this.
  4. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    250
    Just to be clear, I want to ask a question.
    So going forward, the only thing we need to do is install "In App Purchasing" package from Package Manager, that is after just enabling IAP from Services window, and there is no need click import in Services window, ever, am I right? Please let me know.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Correct. And you need to delete /Assets/Plugins/UnityPurchasing if it is present.
     
    dhruv4102 and Sailendu like this.
  6. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    250
    Thanks for answering, it is really awesome that you guys made the IAP install process simpler. Kudos to the Unity team.
     
  7. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    i thought i should follow your process and now IAP isn't working!
    I deleted Assets/Plugins/UnityPurchasing
    Checked packages for "In App Purchasing" which offers me version 2.0.6
    You say not to import from services tab

    My IAP no longer works - where did i go wrong?
    thanks
     
  8. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    250
    After deleting the "Assets/Plugins/UnityPurchasing" folder, you need to install "In App Purchasing" package 3.1.0 from Package manager, you can find 3.1.0 by clicking the arrow on the left side, then select 3.1.0 and Update, I am using it this way and it is working well so far.
     
  9. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    thank you - found it... but now I have upgraded I get this error:
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Purchasing.UIFakeStore.InstantiateDialog () (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/FakeStore/UIFakeStore.cs:175)
    UnityEngine.Purchasing.UIFakeStore.StartUI (System.String queryText, System.String okayButtonText, System.String cancelButtonText, System.Collections.Generic.List`1[T] options, System.Action`2[T1,T2] callback) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/FakeStore/UIFakeStore.cs:153)
    UnityEngine.Purchasing.UIFakeStore.StartUI[T] (System.Object model, UnityEngine.Purchasing.FakeStore+DialogType dialogType, System.Action`2[T1,T2] callback) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/FakeStore/UIFakeStore.cs:128)
    UnityEngine.Purchasing.FakeStore.FakePurchase (UnityEngine.Purchasing.ProductDefinition product, System.String developerPayload) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/FakeStore/FakeStore.cs:163)
    UnityEngine.Purchasing.FakeStore.Purchase (System.String productJSON, System.String developerPayload) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/FakeStore/FakeStore.cs:132)
    UnityEngine.Purchasing.JSONStore.Purchase (UnityEngine.Purchasing.ProductDefinition product, System.String developerPayload) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/BaseStore/JSONStore.cs:348)
    UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (UnityEngine.Purchasing.Product product, System.String developerPayload) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Purchasing/PurchasingManager.cs:60)
    UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (System.String purchasableId, System.String developerPayload) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Purchasing/PurchasingManager.cs:68)
    UnityEngine.Purchasing.PurchasingManager.InitiatePurchase (System.String productId) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Purchasing/PurchasingManager.cs:43)
    UnityEngine.Purchasing.CodelessIAPStoreListener.InitiatePurchase (System.String productID) (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Codeless/CodelessIAPStoreListener.cs:212)
    UnityEngine.Purchasing.IAPButton.PurchaseProduct () (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Codeless/IAPButton.cs:151)
    UnityEngine.Events.InvokableCall.Invoke () (at <3dc54541a2574ac7826a004a212a4332>:0)
    UnityEngine.Events.UnityEvent.Invoke () (at <3dc54541a2574ac7826a004a212a4332>:0)
    UnityEngine.UI.Button.Press () (at C:/Program Files/Unity/Hub/Editor/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
    UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/Unity/Hub/Editor/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
    UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/Unity/Hub/Editor/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
    UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/Unity/Hub/Editor/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)

    any ideas?
    thanks
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, known issue. That code is using the fake store prefab which you wouldn't use in a release game, only in the Editor. Until we address the issue, you can use the Sample IAP Project v2 here https://forum.unity.com/threads/sample-iap-project.529555/#post-6950270
     
  11. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry I don't follow the question. As the name implies, it represents a fake store that would be used in the Editor only during testing. There is no IAP store from within the Editor, only on devices (Google/Android and Apple/iOS, for example). It's available for the Sample project available from the Package Manager window for Unity IAP. You would need to copy the prefab from there. Otherwise, just start with the mentioned Sample IAP Project v2
     
  13. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    just a suggestion; perhaps these upgrades could be released, working correctly.

    Is there any reason why I need to upgrade to the latest version if I just want to offer 4 simple consumable products? Sounds like I am better off on V2 until you have this sorted
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You need to upgrade because Google requires an update for their updated Billing library. And it is working correctly, the 3.x releases are the most stable releases we've had. The prefab issue is minor, it would not be used in a released game.
     
  15. lz7cjc

    lz7cjc

    Joined:
    Sep 10, 2019
    Posts:
    520
    ok thanks
    this is the second time that I have experienced Play mode being rendered useless (the first being the upgrade to XR package)
    Am I missing something? Is there a better way to test development work since building an apk or ipa every time I want to see how something has been implemented/impacted doesn't feel like a particularly optimised route
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, I don't think you're missing anything. You always should test a new version before you release it.
     
  17. Vishu2708

    Vishu2708

    Joined:
    May 12, 2021
    Posts:
    3
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Purchasing.UIFakeStore.InstantiateDialog () (at Library/PackageCache/com.unity.purchasing@3.1.0/Runtime/Stores/FakeStore/UIFakeStore.cs:175)


    There is no UnityPurchasing plugin in assets.......i can find one UnityPurchasing Plugin in Packages...but its not getting deleted....how to resolve this issue?
     
  18. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    if yo don't need IAP in your project, you remove the "In App Purchasing" library in Package Manager. If you still have issues, make a full project backup and then delete your /Library folder. It will get rebuilt the next time you load the project.
     
  19. dhruv4102

    dhruv4102

    Joined:
    Nov 8, 2021
    Posts:
    2
    Thanks Bro It's 100% Working for me......
     
    JeffDUnity3D likes this.