Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question get purchased history of IAP

Discussion in 'iOS and tvOS' started by Rachan, Dec 2, 2023.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    746
    Hi there!

    I using Unity 2022.3.14f1 and I really want to know how to get a history purchased of user in Unity IAP
    (non-consumeable / consumeable) without record or save data on purchasing before

    there has anyway?
    Thanks!!!
     
  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,933
    Consumables are not tracked by both iOS and Android platform stores. Only non-consumables are stored which can be retrieved by restoring the purchases.
     
    Rachan likes this.
  3. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    746
    Thank you very much for your answer!
    So, it impossible to track back to purchaser before right?
    what a pity.
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,933
    You can maintain the history of all purchases (consumable) by passing the info to your backend, but there is no solution from native app stores for consumables.
     
    Rachan likes this.
  5. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    746
    Oh, the only way is I have to record my myself with PlayerPref or something right? Unity can't do this automatically...

    if yes, then I will stop researching this,

    because I thought it should have someway to track back, what is user purchased before, such as from iOS API or Play Store native API...
     
  6. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,933
    If you use Player Prefs, unfortunately, it's limited to a single device. You need make sure you sync across the devices for the player.

    To achieve this, you have two solutions
    1. Have a backend and add api's to track the purchases for the user or
    2. Use a cloud service native plugin solution (iCloud/Saved Games) which can save the data per user for free.

    Before all that, try to evaluate if it's really required to track "consumables" as I see only main reason it's useful for is for analytics.

    But if you want to have history of purchases for a specific user to evaluate "effective" coins to counter any kind of hacking, I suppose it may be worth trying above options, else just pass it on as it saves lot of time :)

    Cheers,
    VB Team