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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Problem using unity IAP on iOS - Initialize falied: no avaiable products

Discussion in 'Editor & General Support' started by GiovanniHDZ, Mar 8, 2022.

  1. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    Hello, I implement IAP in my project (4.3.2, and they work fine in unity editor and in android.
    I've been following the iOS deployment guide and got stuck on one part...

    - I have registered the product ids in app store connect, they are the same as in android...
    - The products are in "ready for submit"

    I try to test from TestFlight but I have initialization error:
    OnInitializeFailed InitializationFailureReason:NoProductsAvailable

    Do I have to send the products for review? (send app for review with the products?)

    I am currently using IAP 4.1.3
    It marks me that the products are not available, but, I use the same id that I registered.
    I leave here an example of what I added in apple portal...

    name reference - Product type - product id - status
    arena_dark Consumable arena_dark - Ready for submit

    In unity I call to buy arena_dark which is the prduct id
    Throw error: BuyProductID FAIL: not initialized

    understandable but, when initializing and configuring products...
    do this...
    Unavailable product arena_dark-arena_dark

    Is it normal that the name is duplicated and has a hyphen in the middle?
    Is it calling arena_dark? or arena_dark-arena_dark?
     
  2. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    I send the products for review...

    Apple says...

    Guideline 2.1 - Performance - App Completeness

    We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 15.3.1 on Wi-Fi.
    Specifically, we were unable to purchase any in-app purchase products. The purchase button is not responsive.

    The safest thing is that it is not being initialized because the products are missing... What do I have to do? :(
    Anyone knows?
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Are you testing in TestFlight? You'll need to test IAP via TestFlight. Do you have any missing metatags on your Apple dashboard? Also, make sure you've filled out your Business and Tax info on your Apple dashboard (even if you are testing as an individual). You can safely ignore the duplicate product name (which is arena_dark)
     
  4. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    Yes, I am trying to do the tests from testflight, the products are not added, and therefore it is not initialized correctly.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it, that would be expected if the products are not added. You'll want to answer the other questions too.
     
  6. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    Hello, I have already been able to test it correctly!

    I want to make a real purchase so I can validate the receipt on the server and see if it works.
    I don't find much documentation, currently i validate google play purchases, on apple it was just adjusting about 3 lines of code, but I want to test that it validates correctly.

    I have the app in testflight, when I want to make the purchase with an account (No sandbox) I get an error
    Is it because the IAP product is still pending review in the apple portal?
     
    Last edited: Mar 15, 2022
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry I would not know what error you are seeing. Are you able to make a purchase in Sandbox? You will receive receipts in Sandbox that you can test with. Do you have IAP products still in review? If so, then yes, you likely won't be able to purchase them. And can you answer my other questions? Please let me know if they are not clear. If you haven't confirmed the question topics, you will not be able to purchase.
     
  8. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    I was able to test on testflight, but I can't make an actual purchase.
    I would like to be able to make one, I have sent the app for review along with the IAP purchases.
    The problem was in the financial information


    I understand that to make a real purchase I need IAP Validated products, right?
    How long does apple take to do that?
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    What do you mean by validated products? They should be in "Ready to Submit" during your TestFlight testing. Make you follow the instructions here: https://docs.unity3d.com/Manual/UnityIAPAppleConfiguration.html . This is what my dashboard looks like at https://appstoreconnect.apple.com/apps

    ReadyToSubmit.png
     
    Last edited: Mar 17, 2022
  10. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    Thank you very much for answering

    I want to validate purchases with a server (nakama) for which I need a real receipt, that is, a real purchase.

    Today apple approved my app, and with that the products.

    I'm trying to buy the products (real purchase) with a non-sandbox account, and it doesn't work.

    The initialization process works, it starts the purchase process, it asks me for the account and I enter account (no sandbox) and the payment tab does not appear, it gives me the following error...
    onPurchaseFailedEvent(productId:virtual_emote_general message:APPLE_An unknown error occurred)


    Do I need the build to be in some specific way? Or maybe configure the app with some specific way in xcode?
    When compiling, in unity in build settings I use the following configuration, in the player settings I have not moved much.
    Any idea what it could be?
     

    Attached Files:

    Last edited: Mar 19, 2022
  11. GiovanniHDZ

    GiovanniHDZ

    Joined:
    Jan 31, 2019
    Posts:
    56
    Could it be the format of the products?
    In testflight it works perfectly for me, but somewhere I have read that there is a format for products
    com.companyname.nameofthegame.productId

    I have the ids in a very different way, will this be the problem?
     

    Attached Files:

  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I doubt TestFlight will allow an actual purchase. Your product names are correct thankfully because you have 87 products. Generally you would get one working to ensure it's working correctly, then add others. When working correctly, it should not prompt you for your account, ensure you are signed into your iOS device with the purchasing AppleID. Since you can reproduce, place Debug.Log statements throughout your purchasing code to output the runtime values of your variables and provide the XCode logs. Your debug statements will show in the logs. You might want to compare your code to the Sample IAP Project v3 here https://forum.unity.com/threads/sample-iap-project.529555/#post-7922275 This might help capturing the logs https://forum.unity.com/threads/how-to-capturing-device-logs-on-ios.529920/
     
    GiovanniHDZ likes this.
  13. VincentLIAerosim

    VincentLIAerosim

    Joined:
    Jan 21, 2022
    Posts:
    5
    So I can't test IAP directly via Xcode build? There are no documents mentioning this requirement.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    After you successfully publish your app and install it from Apple, then you can side load directly from XCode. Have you published your game yet? Is there a reason you don't want to use TestFlight? The process is described here:

    https://docs.unity3d.com/Manual/UnityIAPAppleConfiguration.html
     
  15. VincentLIAerosim

    VincentLIAerosim

    Joined:
    Jan 21, 2022
    Posts:
    5
    Thanks. I get stuck for a while until reading your words. Hope it works with TestFlight. My game is on App Store, but I usually build from Xcode to test new functions.
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Does it work without TestFlight for you? If you've already published, I suspect it should work.
     
  17. VincentLIAerosim

    VincentLIAerosim

    Joined:
    Jan 21, 2022
    Posts:
    5
    No. I've published without IAP products.
    Besides the IAP function on the TestFlight app also not working. Do I need to set up the Paid Apps Agreement?
     
  18. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry I would not know, is this a paid app? But you do need to fill out your Business and Tax information. Since you can reproduce, you can get the XCode logs https://forum.unity.com/threads/how-to-capturing-device-logs-on-ios.529920/ Please
     
  19. VincentLIAerosim

    VincentLIAerosim

    Joined:
    Jan 21, 2022
    Posts:
    5
  20. VincentLIAerosim

    VincentLIAerosim

    Joined:
    Jan 21, 2022
    Posts:
    5
  21. nntgam

    nntgam

    Joined:
    Mar 9, 2019
    Posts:
    9
    Guys, I have problem. I have test on my device the purchase can init and I can purchase successfully,
    but reviewer can't get price item and can't make the purchase.
    What should I do?