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

Retrieving IAP user's Non-Consumable Purchase History on Scene Load, iOS

Discussion in 'Unity IAP' started by jamesmtsn, Jan 26, 2019.

  1. jamesmtsn

    jamesmtsn

    Joined:
    Jan 26, 2019
    Posts:
    2
    Does anyone have any example code in order to send a call to the iOS App Store immediately when a scene loads to check for whether an IAP non-consumable product has already been purchased by the user, and then to trigger a response?

    I have a button in a scene to purchase a non-consumable IAP product on click; the button is coded to de-activate once the product has been purchased successfully. However, every time the scene re-loads, the button re-appears even if the user has already successfully completed the IAP and de-activated the button.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,439
    You could store the purchase information in PlayerPrefs, or other local or cloud storage. And could you just not set a state in your app that persists this information? Preferably a static/singleton manager class, or at least a global variable.
     
  3. skhan2523

    skhan2523

    Joined:
    May 26, 2016
    Posts:
    1
    Hi, If I have multiple (lets say 20) non consumables, so I would have to create PlayerPrefs for each of them? Is there anyother way? like to create a file
     
    Last edited: Aug 8, 2019
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,385
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,439
    Actually any non-consumables or subscription purchase would be in the Product controller list with the receipt data. Only consumables would not be present.
     
unityunity