Search Unity

IAP is successful but callback is not being fired on some devices?

Discussion in 'Unity IAP' started by juiced12, Jun 17, 2020.

  1. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    Edit: I am using the latest IAP version 1.23.1 with the codeless IAP and I am using unity 2019.4.0f LTS


    Hi guys,

    I'm getting emails from users stating that my IAP isn't working. The purchase is successful but it appears that the success callback isn't being called. This is only happening on some devices.

    I've tried to replicate this on my own devices but the purchase goes through as expected and there is no issue.

    I've also submitted new updates to both iOS and android stores and they haven't flagged any issues.

    Anyone else seeing this problem?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We have heard reports of this on Android devices. We believe that if the user taps outside of the Google Purchase dialog while it's displaying, this may occur. We are hoping to address this in an upcoming release, no ETA yet at this time. I've said "a few weeks" in the past, then it went much past that. But fingers crossed...
     
  3. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    Hi Jeff, thanks for replying.

    I've also had this issue with the ios store.

    I've read recently that iOS are making receipt validation mandatory. Could this be causing the callback to not be called in any way on IOS devices?

    Apple have accepted the update I made the other day using the codeless iap button. But I wonder whether this could be a reason for the callback not being invoked correctly?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, it never happens on iOS, so it's likely something in your code. Please post your purchase script here, and I can take a look.
     
  5. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    Code (CSharp):
    1. public void PurchaseSuccess()
    2. {
    3.         GameManager.Instance.PurchaseGameSuccess();
    4. }
    5.  
    6. public class GameManager : MonoBehaviour
    7. {
    8.     private static GameManager _instance;
    9.     public static GameManager Instance { get { return _instance; } }
    10.  
    11.     private bool isFullGame = false;
    12.     private void Awake()
    13.     {
    14.         if (_instance != null && _instance != this)
    15.         {
    16.             Destroy(this.gameObject);
    17.         }
    18.         else
    19.         {
    20.             _instance = this;
    21.         }
    22.         DontDestroyOnLoad(gameObject);
    23.      }
    24.  
    25.     public void PurchaseGameSuccess()
    26.     {
    27.         SaveSystem.SaveGameAsUnlocked();
    28.         isFullGame = true;
    29.         GameEvents.Instance.RaisePurchaseGameEvent(true);
    30.     }
    31.  
    32. }
    33.  
     
  6. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    I've used the same code for about 8 months now. The issue appeared when I upgraded the IAP to 1.23.1.

    I was previously using the prior version 1.23

    Because I hadn't really changed anything, I assumed that it was due something else
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    That's not your full purchase code. Where are you handling ProcessPurchase and OnPurchaseFailed? Or are you using Codeless IAP? If using Codeless, please show a screenshot of your IAP Button Inspector properties
     
  8. juiced12

    juiced12

    Joined:
    Nov 8, 2018
    Posts:
    44
    That's the function that I pass to the codeless IAP button in the inspector. I also pass another function for failure which enables an error screen
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Unfortunately I would not be able to debug your code, it's not familiar to me. So what exactly are your users reporting? I suspect they are being charged, but not awarded the product? Keep in mind that IAP buttons need to be active and visible on the scene until the purchase completes. I see you are destroying objects and sending events. In your case, you would probably need a Codeless IAP Listener. At that point, and because you would need to release a new build, you might as well use Scripted IAP, it's easier to code and more flexible. But your point about upgrading to 1.23.1 is valid, there is a chance you may need to revert to a previous version. We have had no reports of this behavior, but it may apply in your case. There is a Sample IAP project here that uses Scripted https://forum.unity.com/threads/sample-iap-project.529555/