Search Unity

  1. 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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Unity Codeless IAP - Purchase failed because Purchasing was not initialized correctly (iOS only)

Discussion in 'Unity IAP' started by Jimbo_Slice, Jun 23, 2019.

  1. Jimbo_Slice

    Jimbo_Slice

    Joined:
    Oct 1, 2015
    Posts:
    41
    Hi everyone,

    I would appreciate a bit of help. I have been stuck on this for days and it is really frustrating me. I feel like I have exhausted all the tutorials, docs, YouTube videos etc. so maybe someone has some first-hand experience that can help me out?

    I have one simple IAP in my mobile game implemented using Codeless IAP (version 1.22.0 with Unity 2019.1.0f2) - to remove ads. It works fine in the Editor and flawlessly on Android (it has actually been approved for publication on Google Play but this App Store release is delaying the launch).

    Things that I have done so far:

    - In-App Purchase has been added on App Store Connect and its status is 'Ready for Submission'. Can someone clarify... the ID for my IAP is "remove_adverts" in the IAP Catalog, should this be the same on the App Store or should I add the bundle identifier as well? e.g. com.CompanyName.AppName.remove_adverts

    - EDIT: All my Banking & Tax settings are set up and approved on App Store Connect

    - Ensured that my Purchasing script is attached to an empty GameObject that is never disabled etc. so it should initialize

    - In Unity IAP Catalog have ensured Apple SKU and Apple Team ID are the same as App Store Connect. Have also ensured everything is synced to UDP. Automatically initialise UnityPurchasing is set to true

    - Ensured that In-App Purchasing Capability is enabled in Xcode

    - Enabled StoreKit.framework in Xcode

    - Archived and Uploaded to App Store Connect through Xcode

    - Invited my Apple developer account to test the app through Test Flight. Is it problematic that the test account is the same as the developer account?

    Then when I install the app through TestFlight and run it I press the IAP button and nothing happens.

    My Device Log displays the following...




    Purchase failed because Purchasing was not initialized correctly

    UnityEngine.Purchasing.CodelessIAPStoreListener:InitiatePurchase(String)

    UnityEngine.Events.UnityAction:Invoke()

    UnityEngine.Events.UnityEvent:Invoke()

    UnityEngine.EventSystems.EventFunction`1:Invoke(T1, BaseEventData)

    UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)

    UnityEngine.EventSystems.StandaloneInputModule:processTouchPress(PointerEventData, Boolean, Boolean)

    UnityEngine.EventSystems.StandaloneInputModule:processTouchEvents()

    UnityEngine.EventSystems.StandaloneInputModule:process()



    (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)




    Any help would be greatly appreciated!

    J
     
    Last edited: Jun 23, 2019
  2. Jimbo_Slice

    Jimbo_Slice

    Joined:
    Oct 1, 2015
    Posts:
    41
    Just tried downgrading to Unity Codeless IaP 1.20 and the problem remains the same
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,160
    Please compare your implementation to the sample IAP projects here. The first is scripted (my preference) and the second project is Codeless. The productIDs need to be the same, please show a screenshot of your IAP Catalog list, and the IAP as defined on Apple. https://forum.unity.com/threads/sample-iap-project.529555/ I might suggest to add Debug.Log statements in your code, they will show up when doing local iOS device testing . Make sure you have also hooked up the Purchase Failure event in your IAP button.
     
  4. Jimbo_Slice

    Jimbo_Slice

    Joined:
    Oct 1, 2015
    Posts:
    41
    So I am ashamed to say the issue was down to my human error :(

    Thanks for your reply Jeff
     
  5. kartoonist435

    kartoonist435

    Joined:
    Feb 14, 2015
    Posts:
    28
    What was your error? I'm having the same problem.
     
  6. Jimbo_Slice

    Jimbo_Slice

    Joined:
    Oct 1, 2015
    Posts:
    41
    Mine was a slight difference in the product key (string) between my Unity Project and what I had configured on App Store Connect.

    Hope you get it sorted!
     
  7. simon_unity488

    simon_unity488

    Joined:
    Oct 23, 2019
    Posts:
    8
    I was having the exact same error messages but it turned out I was stupid enough to try to test my app without internet connection on my test device.
    The logs in XCode weren't sufficient enough to find this out.

    Probably not a lot of you will be dumb enough to make the same mistake as I did but make sure you have internet!
     
unityunity