Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

IAP Codeless restore problem

Discussion in 'Unity IAP' started by lupocupo, Jul 3, 2019.

  1. lupocupo

    lupocupo

    Joined:
    Sep 23, 2017
    Posts:
    3
    I'm having some troubles in implementing IAP codeless restore.

    I have added 2 IAP buttons in 2 different scenes for non consumables products, I can buy them (already tested live in alpha closed group), problems come when I unistall/reinstall the app and I try to restore my previous purchases.
    I'm using UnityIAP version 1.22.0 and playerPrefs to save the product settings.
    Once a user buy the "No Ads" option the relative IAP button are disabled and Ads disappear, this should happen again when I reinstall my app, but it doesn't.

    My questions are:

    1) I've understood that I have to implement 2 IAP listener and check if user have already payed for the products but for some reason it doesn't work, am I missing something?

    2) Should I add a listener for each scene where IAP buttons are present, or should I use a single listener at the app start up?

    3) In IAP listener should I retrieve product ID or similar in order to enable the purchases or this should be automatic?

    Below the implementation of a listener:

    IAP Listener.png

    At the moment, as you can see below, in AcquistiMain.ListenerAcquistoCompletato(Product product) there is only a function that log the call To IAP Listener, Set PlayerPrefs Settings and refresh the scene.

    Code (CSharp):
    1.     public void ListenerAcquistoCompletato(Product product)
    2.     {
    3.         Debug.Log("IAPListener OK");
    4.         PlayerPrefs.SetInt("noAds", 1);
    5.         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    6.     }
    Thanks in advance to everybody for you suggestions and your patience.

    Have a nice day

    Riccardo
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,100
  3. lupocupo

    lupocupo

    Joined:
    Sep 23, 2017
    Posts:
    3
    Jeff,

    Thanks so much for your reply, I'll check it out in the next days.

    Riccardo
     
unityunity