Search Unity

Unity codeless IAP works in editor and nothing happens on iphone

Discussion in 'Unity IAP' started by Paratrooper82, Jul 1, 2018.

  1. Paratrooper82

    Paratrooper82

    Joined:
    Jan 17, 2018
    Posts:
    13
    Hey all, so I've been trying to get Unity IAPs working for a while now and still can't figure it out. Everything works as intended with the fake store within the Unity editor. But the second I build the iOS build, then use Xcode to put it on my iPhone 6, with a sandbox account, the actual codeless IAP button doesn't do anything. I mean literally 0.

    I get no fatal error messages within Xcode, nor in the Unity log files. This is my log after trying it in the editor:

    UnityAdsEditor: Initialize(2630602, True);
    UnityEditor.Advertisements.UnityAdsEditor:EditorOnLoad()

    Initializing UnityPurchasing via Codeless IAP
    UnityEngine.Purchasing.IAPButton:OnEnable()

    UnityIAP Version: 1.20.0
    UnityEngine.Purchasing.IAPButton:OnEnable()

    Using configuration builder objects
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    UnityIAP: Promo interface is available for 1 items
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    Ad was skipped before end.
    UnityEngine.Debug:Log(Object)
    LevelManager:HandleShowResult(ShowResult) (at Assets/Scripts/LevelManager.cs:171)
    UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, Int32, GUISkin, Int32, Single, Single, GUIStyle)

    IAPButton.PurchaseProduct() with product ID: com.xaagaming.bjorn.123
    UnityEngine.EventSystems.EventSystem:Update()

    purchase({0}): com.xaagaming.bjorn.123
    UnityEngine.EventSystems.EventSystem:Update()

    Basically clicking that purchase button and selecting "YES" for purchasing, sets an integer to 1. If that integer is 0, then post death ads play. However, if you purchase this for 0.99 cents, then the post death ads stop playing.

    Code (CSharp):
    1. //disabling ads
    2.     public void purchaseFulfillmentNoAds(){
    3.         noAdsPurchase = 1;
    4.         Debug.Log ("No Ads have been purchased");
    5.  
    6.         PlayerPrefs.SetInt ("noAdsPurchase", 1);
    7.     }
    Then in my respawnCoroutine I have this because it plays ads right before you respawn.

    Code (CSharp):
    1. //Advertisement.Show();
    2.         if (noAdsPurchase == 0) {
    3.             showAds ();
    4.         }
    I get this message after clicking on the codeless IAP button that reads:

    Do you want to Purchase com.CompanyName.GameName ?
    Environment: Fake Store
    Yes/NO

    When I click yes, everything works fine. I just can't get this to work within a test environment...
     
  2. JeffDUnity3D

    JeffDUnity3D

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

    mergatroid

    Joined:
    Apr 23, 2017
    Posts:
    5

    I am experiencing the same problem, works in editor but not when built. I am using the codless IAP buttons and have ticked the 'Automatically initialize UnityPurchasing' box so I assume that I do not need to manually implement UnityPurchasing as suggested in the links supplied by Jeff?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    My same recommendations apply here also (screenshots and logs)
     
  5. bostudio

    bostudio

    Joined:
    Nov 28, 2017
    Posts:
    20
    Anyone that solved this problem ?
     
  6. bostudio

    bostudio

    Joined:
    Nov 28, 2017
    Posts:
    20
    Did you fix the issue ?
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    If you could provide the logs, I likely could suggest a solution
     
    bostudio likes this.
  8. bostudio

    bostudio

    Joined:
    Nov 28, 2017
    Posts:
    20
    It was working until I updated to 2019. I am using Unity 2019.1.2f1. I tried deleting the IAP folders, reimporting the plugin, I updated the plugin. I tried to reimport all the assets. Nothing worked. I checked that my products in IAP catalog have the same names as the ones in the play store console.
    In the editor it works fine. But in the android device, when I click on the IAP button nothing happens.

    Unfortunately, I can't provide the logs now !!
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, we are having issues with IAP on Unity 2019 as posted on this forum.
     
  10. bostudio

    bostudio

    Joined:
    Nov 28, 2017
    Posts:
    20
    I fixed the error by removing Unity IAP 1.22 and installing Unity IAP 1.20. Now when I click on the iap button, google purchase dialog pops up.
    I am using Unity 2019.1.2f1 and IAP 1.22 didn't work for me.
     
  11. Jimbo_Slice

    Jimbo_Slice

    Joined:
    Oct 1, 2015
    Posts:
    44
    How did you install the older version?
     
  12. Jimbo_Slice

    Jimbo_Slice

    Joined:
    Oct 1, 2015
    Posts:
    44
    Nevermind, I just found the sticky :)
     
  13. affadnplay

    affadnplay

    Joined:
    Aug 21, 2019
    Posts:
    2
    im having the same issue with unity 2019.3.6f1 tried everything. Works in unity but in final build nothing . like a dead button .
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    How are you debugging on the device? Then I can provide specific details.
     
    affadnplay likes this.
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446