Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

In App Purchase : Unavailable product?

Discussion in 'Getting Started' started by Sparticus, Aug 9, 2022.

  1. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Hey all,

    I implemented In App Purchases using Unity's IAP Library. Everything has been going great and for the last month or so everything appeared to be working during my testing (only been testing with Android so far).

    I have tested it both within Unity's IDE and on my personal mobile device and all seemed good....

    Well, until yesterday. When I load my game on my mobile device, I get this error :

    Unavailable product gems3


    If I log into my google developer console and look at my IAP products, I do have a "gems3" product. I also have not made any changes here in months.

    I have added Debug Logs everywhere in my code and I can't even find out where that error is coming from. I'm guessing it a unfinished purchase and Unity IAP is restoring the purchase when the game loads.... but I can't seem to track down the code that spits out the error.

    I even tried uninstalling the game from my device and reinstalling. The error returns as soon as the game loads and crashes the game.

    Any ideas?

    Thanks!!
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The error would not crash your game, something else is causing that. What changed yesterday? So you were able to make test purchases previously? Please provide your device logs, that error would occur during IAP initialization. Have you published to Google Play, and you are testing IAP under Closed testing, and you have created a second user account for testing, and added this account as a tester? https://docs.unity3d.com/Packages/com.unity.purchasing@4.4/manual/UnityIAPGoogleConfiguration.html and https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/
     
  3. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Thanks for the quick response.

    I don't think I made any changes to the game recently that should have caused this issue. I was able to make test purchases before on my mobile device (I'd get the google email letting my know the purchase was successful, etc)

    I do have the game publish process started (ie. I've added the game to google developer console, filled in some info and added IAP's). The game is not live in the app store yet.

    Currently I do not have testers, I am just using Unity to publish directly to my mobile device (by attaching a USB cable)

    I'll try getting the logs now and post the results here. Thanks!
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sounds good. Please share a screenshot of your gems3 product on your Google dashboard, and also show where you are adding the product in your code.
     
  5. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Here is a screenshot of my products :

    upload_2022-8-9_14-17-22.png

    And part of the code to add the product :

    upload_2022-8-9_14-19-1.png

    upload_2022-8-9_14-19-31.png


    However, at this point when I load my game this code doesn't even run (game freezes before it's run). I've added debug logs and they do not show up. I'm guessing some code runs as part of googles IAP that checks for pending purchases and that fails.

    Still trying to get the logs which I will post shortly
     
  6. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Ok, I was able to get the logs which I have attached to the post.

    I assume you only need to look at the very end of the log file. I do see the messages "Unavailable product gem2 -gem2" and "Unavailable product gems3 -gems3". I do not have a "gem2" (with no "s") so I am not sure how that got there... however, I do have a gems3 so that shouldn't be throwing an error.

    I also see this error : Unity Ads was not able to get current network type due to missing permission.
     

    Attached Files:

    • log.txt
      File size:
      288 KB
      Views:
      198
  7. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Ok, after loading the game again I think I see more error info on why it may be crashing :

    Code (CSharp):
    1. 08-09 14:46:29.559 17757 17822 E Unity   : Using memoryadresses from more than 16GB of memory
    2. 08-09 14:46:29.559 17757 17822 E Unity   : (Filename:  Line: 120)
    3. 08-09 14:46:29.559 17757 17822 E Unity   :
    4. 08-09 14:46:29.699 17757 17822 E CRASH   :       #00 pc 0000000000651030  /data/app/~~NcOaqgyNIfjYh1_-EUkR1Q==/com.beatthegeek.btgtd-ei3ePndMwgVwEWiqfPGVHQ==/lib/arm64/libunity.so (BuildId: adeb43dc67d62c395765e322ddf952b281c82238)
    5. 08-09 14:46:29.699 17757 17822 E CRASH   :       #01 pc 0000000000650bd0  /data/app/~~NcOaqgyNIfjYh1_-EUkR1Q==/com.beatthegeek.btgtd-ei3ePndMwgVwEWiqfPGVHQ==/lib/arm64/libunity.so (BuildId: adeb43dc67d62c395765e322ddf952b281c82238)
    6. 08-09 14:46:29.699 17757 17822 E CRASH   :       #02 pc 0000000000650b20  /data/app/~~NcOaqgyNIfjYh1_-EUkR1Q==/com.beatthegeek.btgtd-ei3ePndMwgVwEWiqfPGVHQ==/lib/arm64/libunity.so (BuildId: adeb43dc67d62c395765e322ddf952b281c82238)
    7. 08-09 14:46:29.699 17757 17822 E CRASH   :       #03 pc 00000000001c93ec  /data/app/~~NcOaqgyNIfjYh1_-EUkR1Q==/com.beatthegeek.btgtd-ei3ePndMwgVwEWiqfPGVHQ==/lib/arm64/libunity.so (BuildId: adeb43dc67d62c395765e322ddf952b281c82238)
    8. 08-09 14:46:29.699 17757 17822 E CRASH   :       #04 pc 00000000008b8a34  /data/app/~~NcOaqgyNIfjYh1_-EUkR1Q==/com.beatthegeek.btgtd-ei3ePndMwgVwEWiqfPGVHQ==/lib/arm64/libunity.so (BuildId: adeb43dc67d62c395765e322ddf952b281c82238)
    9. 08-09 14:46:30.592  2135  2316 D WindowManager: requestTransientBars: swipeTarget=Window{1ad3133 u0 StatusBar}, controlTarget=Window{a879f8a u0 com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity}, canShowTransient=true, restorePositionTypes=0x0, from=com.android.server.wm.DisplayPolicy.access$100:226 com.android.server.wm.DisplayPolicy$1.onSwipeFromTop:569
    10. 08-09 14:46:36.569  2135  2316 D WindowManager: rotationForOrientation, orientationSource=ActivityRecord{36bcfb8 u0 com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity t3711}
    11. 08-09 14:46:37.661  2135  2316 D WindowManager: rotationForOrientation, orientationSource=ActivityRecord{36bcfb8 u0 com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity t3711}
    12. 08-09 14:46:39.552  2135  2732 D InputDispatcher: a879f8a com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity (server) is not responding. Waited 10003ms for MotionEvent
    13. 08-09 14:46:39.571  2135  2732 W InputDispatcher: Window a879f8a com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity (server) is unresponsive: a879f8a com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity (server) is not responding. Waited 10003ms for MotionEvent
    14. 08-09 14:46:39.571  2135  2732 W InputDispatcher: Canceling events for a879f8a com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity (server) because it is unresponsive
    15. 08-09 14:46:39.572  2135  2732 I WindowManager: ANR in com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity. Reason:a879f8a com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity (server) is not responding. Waited 10003ms for MotionEvent
    16. 08-09 14:46:39.866  2135  2316 D WindowManager: rotationForOrientation, orientationSource=ActivityRecord{36bcfb8 u0 com.beatthegeek.btgtd/com.unity3d.player.UnityPlayerActivity t3711}
    Am I somehow using too much memory? This never seemed to be an issue before...
     
  8. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it, please keep me posted. As always, make a full project backup before upgrading. We also need to find out where gem2 is coming from. Make sure you are testing what you think you are testing. Make a change that you will be sure to recognize when you run the game.
     
  10. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Ya, no clue where gem2 is coming from. I haven't changed anything to do with that code in quite some time. Is there a trick to remove the purchase of gem2 from that users account? I see no purchases in the google dev console (which I guess makes sense as it was a test purchase)... but it keeps trying to give it to me whenever my phone loads the game. (reinstalling doesn't remove it)
     
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did you purchase gem2 at one point? It must be in your game. Please follow my previous suggestion of ensuring you are testing the right version of your game.
     
  12. Sparticus

    Sparticus

    Joined:
    Mar 15, 2014
    Posts:
    149
    Ok, I think things are working now. I ended up upgrading to a slightly newer version of Unity (2019.4.40f1). When i did that I had a ton of errors in the console to fix. Most of them were complaining about duplicate libraries. Turns out I had enabled too many types of IAP... I installed the Unity IAP package.... as well as the "In-App Purchasing" Service..... (found within Unity in the Services menu). Apparently that one is for those that do not want to write any code to implement IAP. So I had both installed at the same time. My guess is the "gem2" was from when I was setting up the codeless version. I removed the codeless version and everything worked. The crashing stopped and the gem2 error went away.

    Anyways, I really appreciate the help solving this!

    Take care!
     
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes that would explain it! You still had that product listed in your IAP catalog, I had asked if you were using Codeless. And once you update IAP from Package Manager, you then delete everything under /Assets/Plugins/UnityPurchasing (the older Asset Store version)
     
    Sparticus likes this.
  14. Nebil_

    Nebil_

    Joined:
    Oct 21, 2023
    Posts:
    2
    Hello all,
    I am also stuck at this exact same place. I am getting this error in Unity 2022.3.3f1 with In-App Purchasing 4.10.0. I am setting up IAP with google play store for the first time. I am using internal testing and uploaded the build. I am using code sample found in IAP. I am using developer account with an organization. I tried to use IAP catalog but, I removed it. I don't know if it is relevant, but I also have google play sign in and facebook sign in. I am at my wit's end right now. I have Screen Shot 2023-10-23 at 12.26.42 PM.png
     

    Attached Files:

  15. attishno1

    attishno1

    Joined:
    Dec 6, 2016
    Posts:
    24
    I am having this issue as well. For me, they are subscription products. For some reason, my 'removeadspermonth' id is appearing as 'removeadspermonth-removeadspermonth' when the game is trying to initialize the products.