Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Unity 2018.3 is now released.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Recipets on iOS before restoring purchases

Discussion in 'Unity IAP' started by Shmulzious, Feb 10, 2019.

  1. Shmulzious

    Shmulzious

    Joined:
    Jul 22, 2013
    Posts:
    5
    Hello,

    I am using the latest IAP package for 2017.2.1p4 (1.20.1). To make I am not doing something incorrectly, I used the IAP Demo scene, and only changed the products that are added. This is the scenario -

    1. Purchase a non-consumable product on the app, and kill it.
    2. Run app again, initialising Unity IAP.
    3. Look for the receipt of the product you've previously purchased.

    Expected : receipt member of Product should not be null or empty
    Actual : it is. Only after successfully restoring purchases the receipt is populated.

    This happens only with non-consumables. With subscription I do get the receipt right after OnInitialised.

    This issue is relevant to me only on iOS (on Android it automatically calls restore purchases so no problems there), also should be mentioned I am working in a sandbox environment (i.e. testing iap environment).

    I need this receipt before RestorePurchase because I need to detect refunds and potentially re-add monetisation.

    Thanks,
    Shmulik.
     
  2. Shmulzious

    Shmulzious

    Joined:
    Jul 22, 2013
    Posts:
    5
    The code I used in case anyone asks
     

    Attached Files:

  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    2,204
    This is the expected behavior, depending on what you mean by "purchase [...] on the app, and kill it":

    Closing the app should not delete purchase receipts, whereas uninstalling does. Android does restore purchases automatically indeed, but only on the first app launch after reinstalling. When uninstalling the app on iOS, the app receipt gets deleted with it, requiring to call restore purchases on the next app install.

    If this is not what you are experiencing, then there is something wrong. Source: our Simple IAP System asset used in several live games.
     
  4. Shmulzious

    Shmulzious

    Joined:
    Jul 22, 2013
    Posts:
    5
    I do not uninstall it, just kill it (i.e. close it completely) and restart it. And in this case I do expect to have the receipt but I don't on iOS.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,380
    You won't! You need to track purchases on the device. Inventory management is something we are considering for a future release
     
  6. Shmulzious

    Shmulzious

    Joined:
    Jul 22, 2013
    Posts:
    5
    Just to make sure

    1. I buy an item, I now have access to its receipt through Product.receipt
    2. I close the app and restart it
    3. If I dont restore purchases, I should not except Product.receipt to be there? (if so, how do I know if there was a refund?)

    Thanks
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    3,380
    Where are you checking the receipt? You won't get a ProcessPurchase callback, if that is what you mean. Refunds are an issue, the stores do not provide a callback mechanism. So we can't support refunds.