Search Unity

Question Google you already own this item in codeless IAP

Discussion in 'Unity IAP' started by jpom001, May 19, 2023.

  1. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I'm running into an issue testing consumables on Google console.I'm using codeless IAP. I want to test a remove ads consumable again, so I refunded the consumable on my console, but I forgot to remove the entitlement. Now my test device cannot purchase the remove ads again.

    I know on apple once someone buys a consumable, they are entitled to have it again and I have to provide restore functionality, is there a way I can do this on android.
    When someone buys ad free I update a boolean value to ignore ads. But on a fresh install, the game is out of sync with Google. Google says your have already purchased this, so it blocks the purchase complete event that updates this field.
    Any advice on what this will be like in real life (other then people not using the store of my first game :D ), I would like to avoid bugs and issues here since this involves people spending money in my game.
     
  2. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    Hi, first off, I think you mean a remove ads non-consumable, instead of consumable? Consumables can by definition be purchased multiple times because they are consumed, while non-consumables are not.

    In the same way. When Unity IAP is initialized you would loop over its controller > products and if product.hasReceipt returns true, you would set your boolean value again.

    Unfortunately I do not know how you can remove the product from Google now, since you've refunded already but did not remove the entitlement. If you cannot invoke the refund+remove on the purchase entry on Google again, you might want to contact Google, or in the mean time, use a different Google account for testing.
     
    jpom001 likes this.
  3. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    Does that mean wait for the start method and do it there when the player enters the shop?
     
  4. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    No, it means in Unity IAP's OnInitialized callback. Codeless IAP does not really have a way to do this, besides placing the Restore button in your shop scene. However I do not know if that actually does something on Android.
     
  5. jpom001

    jpom001

    Joined:
    Dec 3, 2020
    Posts:
    69
    I'm guessing I cant have a mix of coded and codeless IAP?
     
  6. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,261
    No, coded and codeless cannot be mixed (theoretically it can, but you will run into weird bugs).