Search Unity

[Solved] Unity IAP - consume - non consumable items?

Discussion in 'Unity IAP' started by RaventurnPatrick, Nov 23, 2017.

?

Which option do you recommend?

  1. Option A - PurchaseProcessingResult.Complete + iterating products array

    0 vote(s)
    0.0%
  2. Option B - PurchaseProcessingResult.Pending

    0 vote(s)
    0.0%
  3. Option C - PurchaseProcessingResult.Complete + PlayerPrefs

    0 vote(s)
    0.0%
Thread Status:
Not open for further replies.
  1. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    Hi, I'm a little bit confused with the implementation of Unity IAP.
    I have a single non-consumable item "full game" to check wether the player has bought the full game via iap.

    I'm unsure how exactly to implement IStoreListener.ProcessPurchase

    Option A:
    - returning PurchaseProcessingResult.Complete + storing the purchase state in a static variable
    -- problem: ProcessPurchase never called again
    -- solution: iterate s_storeController.products in initialize and checking the receipt of the product, setting the "game purchase static variable = true"

    Option B:
    - returning PurchaseProcessingResult.Pending + storing the purchase state in a static variable
    -- Unity should call ProcessPurchase on every application start (so static variable should be fine?)

    Option C:
    - returning PurchaseProcessingResult.Complete + storing the purchase state in the PlayerPrefs
    -- problem: easily "hackable" by the players - right?
    -- solution: obsfucate the value?

    So which of the 3 options is recommended by Untiy? Are all those options valid on Android and iOS (i also call restore purchases for ios in the initialize method)?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You would want to implement your own inventory solution. Storing in PlayerPrefs might not be the best solution in case users reinstall your game, and these settings would be lost. Option A should work.
     
  3. RaventurnPatrick

    RaventurnPatrick

    Joined:
    Aug 9, 2011
    Posts:
    250
    Ok thanks for the info. I will go with Option A then probably :)
     
Thread Status:
Not open for further replies.