Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity IAP working fine on Editor but not on phone (Android)

Discussion in 'Unity IAP' started by ziadgapp, May 6, 2019.

  1. ziadgapp

    ziadgapp

    Joined:
    Aug 17, 2018
    Posts:
    4
    Hello,
    Hope all is well.
    I have implemented IAP in my application, which works perfectly fine on my Unity Editor, however, does not work at all when I upload it to the Play Store and test it on my phone (the item the user is supposed to own now stays locked. It works fine in the editor. The onPurchaseComplete method (and occasionally onPurchaseFailed) are not getting called. Some information:
    - I am using codeless IAP;
    - When I click the button of the item to buy, I am prompted to choose either BUY or CANCEL. If I click BUY, however, it looks like the code doesn't do anything from there. I went further in my investigation and checked if my code goes into the if (button.productId == e.purchasedProduct.definition.id) statement in the ProcessPurchase function (which it should when I click BUY), it doesn't.
    - I have uploaded my managed product list on the Google Play Console.
    I spent at least fifty hours trying to figure this problem out. I will be really thankful if you can help me out!
    Thank you very much!
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. mawejjenikolas

    mawejjenikolas

    Joined:
    Nov 11, 2020
    Posts:
    4
    Hello I have a relatively similar problem, I have used the codeless IAP and everything worked fine in the editor, however, I made a test app and uploaded it to google play, when I click buy everything works but after payment, it seems like the onPurchaseComplete is not called at all, but in the editor, it was working.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please show the code you are using and a screenshot of your IAP button properties in the Inspector. The documentation for Codeless shows a single method called GrantCredits, not onPurchaseComplete, is this a method you wrote? Typically an on* method is a callback, not an explicit method.