Search Unity

How can I remember consumable IAP purchases across installs without a login

Discussion in 'Unity IAP' started by zakmackraken, Apr 3, 2019.

  1. zakmackraken

    zakmackraken

    Joined:
    Jun 16, 2017
    Posts:
    9
    Hello,

    I have a situation where I have to use a consumable IAP (the product can be bought over and over), and the user is anonymous (they can optionally login, we can't force the login - its against Apples App Store guidelines). My problem is that I need to somehow persist the consumable info on the server so that if the same user reinstalls the app (or if the same user on an other device e.g. 1 iOS user with both an iPhone and iPad) I can restore the consumables they bought.

    From reading it sounds like the Unity IAP implementation keeps a record of all transactions, even consumables, but I can't find a way to restore these (Apples restore function does NOT restore consumables - I believe Google PlayStore does).

    Does anyone have any idea how to solve this problem?

    I'm thinking of storing the transaction ID in the apple keychain (which should persist it to the user) and then if I find that on each app run I query the server for the consumable for that transaction id.

    Does anyone have a better way?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I don't believe you want to do that. Consumables behave this way for a reason. What is preventing a user from multiple restores for consumables? If I paid $.99 for "50 Gold Coins", and if I had two iOS devices, I could potentially get all the gold coins I wanted without ever paying again. If this is something you really need, then you could use your own server to store purchases, but it would only work for those users who optionally login.