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

Unity in-app purchase not working on android device ?

Discussion in 'Editor & General Support' started by jawadkh27, Apr 10, 2018.

  1. jawadkh27

    jawadkh27

    Joined:
    Nov 27, 2017
    Posts:
    7
    Hi i just added UNITY IAP in my project. In play mode everything is working fine and purchase method called. But when i run the app on my android device i didn't see google purchase pop dialog. I haven't publish the app in beta testing yet but at least you can get the google purchase pop up with error.

    so when i call the purchase method on android phone , nothing happens . Please help me .
     
    Lisa22lee likes this.
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You need to publish to Google Alpha/Beta test, and use a tester account (not your developer account). You will first need to download the app from the store to begin testing, then subsequently you can side load the app. There is more information here https://docs.unity3d.com/Manual/UnityIAPGoogleConfiguration.html
     
  3. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    55
    Hi may I ask, because I use different plugin for IAP before. then I updated to 2018 unity then I use the IAP services.
    but when I tried in mobile it doesnt work. my first IAP plugin work. is it maybe I didnt upload the new one? with new IAP services. does that connect at all?

    thanks
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  5. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    55
  6. ashiokai

    ashiokai

    Joined:
    Aug 5, 2015
    Posts:
    6
    Hey I am troubles with my IAP buttons.

    I updated my Unity to the latest as well as the IAP catalogue. On IOS it works fine but on android it doesn't function well and the Purchase buttons have shifted.

    I tried on my own android device and only the last 2 buttons work but they have the information of the previous two.
    I have tried recreating my IAP buttons and deleting my googleplay services plugins as well.

    I have no errors in my Unity compiler or Android SDK.

    Do you know what the problem could be?
     

    Attached Files:

  7. ZokMoney

    ZokMoney

    Joined:
    May 5, 2019
    Posts:
    6
    I am having the same problem but my app has been fully published and released. I released it without the IAP due to I didn't want to miss my release date and then did an update a couple days later with the IAP active. It works perfect when testing in play mode but after publishing, the purchase button does nothing, like the button has no function at all. I've verified on friends devices and Google accounts to be sure it wasn't just an issue with being logged in under the same email as the developer.
     
  8. rasebdon

    rasebdon

    Joined:
    Sep 17, 2018
    Posts:
    1
    Also my IAP is set up correctly and everythingbut it isn't showing any dialogue window when i press on my buttons. Please tell me there is a fix coming or someone has a solution!
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  10. Szubaka

    Szubaka

    Joined:
    Nov 12, 2015
    Posts:
    2
    Hi i have the same issue.
    I'm using Unity 2019.2.11f
    I have tried accessing the IAP using codeless IAP and from script, the current project uses codeless IAP.
    Attached is my log file.
    A heads up, i use powershell to make the log file since i somehow can't redirect command prompt, and i have to kill the adb process via another window of powershell, just confused because the log file is small.

    Thanks
     

    Attached Files:

    • log.txt
      File size:
      3.1 KB
      Views:
      303
  11. universalarts

    universalarts

    Joined:
    Apr 18, 2019
    Posts:
    1
    i am stuck with same problem. i am using unity 2018.4.3. i delete the plugin and import again from unity services window and my game is already published with iap on play store but it is working on unity engine but not on android device
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide the device logs. They will tell what is wrong.

    * Connect your device via USB
    * Open a command prompt window
    * Confirm that "adb devices" sees your device
    * Run "adb logcat | grep -i unity > out.txt" (use findstr on Windows)
    * Run your game, and attempt a purchase
    * Back in the command prompt, press Ctrl+c to end the capture.
    * Review the logs, looking for "unityiap"
    * Attach here with your observations
     
  13. ragyhassan22

    ragyhassan22

    Joined:
    Jul 28, 2020
    Posts:
    15
    [Alpha test already published and testing on a phone]
    I did that , and i have logs file attached.

    i have 2 problems :
    1- IAP is not working , i can't understand why from the logs.
    2-unity ads aren't working either , it says in the log that "Unity Ads show failed: Unity Ads is not initialized".
    in unity ads , i have this Advertisement.Initialize(Googleid, testMode);
    testMode is set to false. is this wrong for alpha testing ?
     

    Attached Files:

    • log.txt
      File size:
      35.6 KB
      Views:
      281
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @ragyhassan22 I see the issue in your logs, thank you for providing. When you install IAP it asks you if you want to Update your API with "Yes, I have made a backup". You must do this or IAP will not install correctly. I see the tell-tale VRSettings::get_enabled exception. I would recommend that you upgrade to IAP 1.23.4 and ensure you say "Yes" to this prompt. I would not be able to assist with your ads issue, you would need to post in the Ads forum. But you are getting the error "no static method with name='addListener'" so be sure to post your code there https://forum.unity.com/forums/unity-ads.67/
     
  15. ragyhassan22

    ragyhassan22

    Joined:
    Jul 28, 2020
    Posts:
    15
    Thank you so much.
     
  16. ragyhassan22

    ragyhassan22

    Joined:
    Jul 28, 2020
    Posts:
    15
    so i tried to reimport IAP , and it didn't ask me to update my API .
    i attached a new logs file and an image for the IAP says that its up to date.
     

    Attached Files:

    • log.txt
      File size:
      29.6 KB
      Views:
      279
    • IAP.PNG
      IAP.PNG
      File size:
      25.6 KB
      Views:
      327
  17. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    What version were you using previously? Is the same error in the logs? Then you'll need to remove IAP altogether and reinstall it. You may need to start with a recent backup.
     
  18. ragyhassan22

    ragyhassan22

    Joined:
    Jul 28, 2020
    Posts:
    15
    I believe i was using IAP 1.23.4
    i tried to remove IAP and kept getting a lot of errors , even though after solving these errors and reinstalling IAP , the update your API window never appeared.
    so i created a totally new empty project with a different unity ID and installed IAP but the window didn't also.

    should i uninstall unity w reinstall it again ?
     
  19. ragyhassan22

    ragyhassan22

    Joined:
    Jul 28, 2020
    Posts:
    15
    i fixed it thank god.
    i was using unity 2019.1.2f1 so i upgraded it to unity 2019.4.6f1 and reimport IAP and it worked.
     
  20. SanketVaria

    SanketVaria

    Joined:
    Aug 27, 2017
    Posts:
    17
    Not working for me, Using 2021.3. Game just crashes upon pressing the IAP button.
     
  21. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    How are you debugging, on what line of code does it crash? Please provide the device logs, and share your purchase code and screenshots of your settings in the Unity Editor. And please don't multipost, I see I've already answered your question. Again, do not use Codeless. Instead, use the Samples shipped with IAP, or start with this Sample IAP project v3 https://forum.unity.com/threads/sample-iap-project.529555/#post-7922275
     
  22. SanketVaria

    SanketVaria

    Joined:
    Aug 27, 2017
    Posts:
    17
    I used Coded IAP and that is working instead of codeless like you said. For codeless, I ran logcat but it did not gave me any error, it just crashed without any information. Problem has been sorted out by simply coding the IAP.