Search Unity

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:
    3,267
    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

    Joined:
    May 2, 2017
    Posts:
    14,446
    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

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