Search Unity

How to restore non-consumable offline

Discussion in 'Unity IAP' started by tsp120, May 16, 2020.

  1. tsp120

    tsp120

    Joined:
    Dec 6, 2013
    Posts:
    15
    I'm pretty much ready to release my first game. But my IAP implementation right now is not completely functioning as I want, and given that involves monetary transactions, I really don't want to get this wrong.

    My game just has one non-consumable IAP that removes ads and unlocks the full game. My current implementation is working except for when the user opens up the game in airplane mode or is offline. The non-consumable purchase is not activated.

    I'm validating the receipt successfully when online, and doing so in the OnInitialized function. But when offline, that doesn't get called.

    I found this link and tried to follow the process to do local validation. But my script never enters the PurchaseProcessingResult function.
    https://docs.unity3d.com/Manual/UnityIAPValidatingReceipts.html

    If this is a simple question or has been answered, my apologies but I just haven't been able to find an answer. How do you validate local receipts when offline so you can give the user their non-consumables?

    Edit: Game is only going to be released on android right now
     
    Last edited: May 16, 2020
  2. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    Unity IAP requires a network to successfully initialize, so please restore the products when there is a network.
     
  3. tsp120

    tsp120

    Joined:
    Dec 6, 2013
    Posts:
    15
    Thank you. I've been absolutely convinced that "Local" receipt validation must have been something that can be done offline. I'll get creative in coming up with a solution for these cases.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    A restore uses the Google Billing Library and connects to their stores. You can award your user any products that you choose to persist locally via receipt or other storage, but that would not be a store-based restore operation.