Search Unity

Codeless IAP - PurchasingUnavailable (Purchasing was not initialized correctly)

Discussion in 'Unity IAP' started by Sir-Magic, Jul 8, 2019.

  1. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    Hi,

    I've had this issue since last year and it is really beginning to bother me as I cannot find out what has gone wrong. I have already searched multiple times on Google and around this forum but I can not find any clear solutions to this issue. I have created an IAP Button to remove adverts from the game. It does not seem to work at all and always gives me the error of: "Purchase failed because Purchasing was not initialized correctly" followed by a message of: "IAPButton.OnPurchaseFailed(Product , PurchaseFailureReason PurchasingUnavailable)". I know this has probably been asked before but I have tried the sample projects from the past and they are too outdated to work. What causes this issue and how can I fix it?

    Attached is a screenshot of the component for my button, in case it is needed.
     

    Attached Files:

  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
  3. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    Ah yes, it seems I completely forgot to put in the method there in that screencap! Although I still get this error with the method there. I will check these update samples though, thanks
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
  5. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    Right, I haven't actually put this application on any device as of yet so I cannot provide logs as the errors I receive are in the unity editor. Do I need to add the in-app purchases to the app store/play store in order for the fake store to work?
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
    Please load the IAPDemo scene included in the IAP asset package to confirm that the fake store is working. The fake store does not perform actual purchases, you need to install on a device for IAP to actually work.
     
  7. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    Yeah, it turns out that the updated samples were the ones I was using last time. On all the buttons/listener I get an error telling me to assign a valid script and when I updated IAP, I got more errors to do with the IAPButtonEditor, so it's not really possible for me to see if the fake store works or not when I'm getting errors on a project that shouldn't have any.
     

    Attached Files:

  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
    Please watch the video for the instructions https://forum.unity.com/threads/sample-iap-project.529555/
     
  9. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    I've done it already, the problem that I have is that upon updating the sample projects, they don't work anymore and throw several errors and produce the errors shown above. Is this just me or are the samples not supposed to be updated?
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
    Yes, the video shows how to update the samples.I do it daily for customers. I would advise you to use Unity 2018, there are issues with IAP on 2019 that are mentioned elsewhere on this forum, including a sticky post, if that applies. I have it working however, using the suggested workarounds. But if you don't need 2019, use 2018 or 2017.
     
  11. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    Hi, I've downgraded the project and I've finally got the sample project working. However, I still get the same issue with my project despite it using the same version of unity. Are there any other reasons that this error could occur?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
    Please provide the device logs
     
  13. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    48
    I think I'm going to just have to forget about this project. I can't get the device logs because I still haven't got this working with the fakestore.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,116
    The fake store, as the name suggest, doesn't perform actual transactions. You need to test on a device. To see the fake/demo store in action, load up the IAP Demo scene included in the IAP package.