Search Unity

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

    Joined:
    May 2, 2017
    Posts:
    14,446
    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:
    16
    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,519
  5. JeffDUnity3D

    JeffDUnity3D

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

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    781
    Ok, it impossible to track back history of purchased without save if by yourself by PlayerPrefeb or other local save system, Right?