Search Unity

[Solved] hasReceipt still false on iOS after restart

Discussion in 'Unity IAP' started by Dipso, Sep 27, 2016.

Thread Status:
Not open for further replies.
  1. Dipso

    Dipso

    Joined:
    Jun 29, 2012
    Posts:
    82
    Hi

    In some posts from July people were saying that “hasReceipt” is false for a purchased non-consumable after restarting the app, on iOS. "hasReceipt" should be true.
    (Works fine on Android.)

    It was also mentioned that Unity is looking into fixing this in a future update.

    Has it been fixed yet?
    If not, any idea when will it be fixed?


    It doesn’t seem to be fixed in version 1.8.1 of IAP.
    But we are using Unity 5.3.4, so it might have been fixed but only works when using a newer version of Unity.


    Otherwise, well done to the Unity team with adding IAP to Unity :)

    Thanks.
    .
     
    Last edited: Sep 27, 2016
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Hi @Dipso,

    That is expected behavior for iOS. hasReceipt is a transient field that will only be true for the session that the purchase was made. The version of the Editor won't affect this, so no need to worry about that.

    It is up to the application to manage what the user is entitled to. For iOS, this would require you to parse the receipt for owned products. You can read more about that in this forum post:
    https://forum.unity3d.com/threads/iap-ios-non-consumables-receipt-persistence.366755/#post-2374519
     
  3. Dipso

    Dipso

    Joined:
    Jun 29, 2012
    Posts:
    82
    Hi @ap-unity

    Thanks for the feedback and link.
    We did end up using the app receipt.

    Here’s an outline of what we did:

    If the product does not have a receipt (i.e. hasReceipt=false) then we:

    - Get the app receipt (via IAppleConfiguration as explained here: https://docs.unity3d.com/Manual/UnityIAPiOSMAS.html).

    - Validate the app receipt (as explained by @nicholasr here: https://forum.unity3d.com/threads/c...m-within-processpurchase.396395/#post-2587338)

    - The CrossPlatformValidator.Validate method returns an array of products.

    - We loop through the array to find the specific product we are looking for.


    Something I wondered about, but did not have time to test (yet):
    Which product ID is in the array (i.e. is it the Unity product ID, or the store specific product ID)?


    Currently our Unity and store product IDs are the same, so the process works for us.

    Thanks
    .
     
    ap-unity likes this.
  4. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Hi @Dipso,

    I'm glad you were able to use the app receipt to get what you needed.

    This should be the Unity product ID. As mentioned in the Manual page for Defining Products, store-specific identifiers are only used when communicating with the stores.

    https://docs.unity3d.com/Manual/UnityIAPDefiningProducts.html
     
  5. Dipso

    Dipso

    Joined:
    Jun 29, 2012
    Posts:
    82
    Hi @ap-unity

    Thanks for clarifying that.
    .
     
    ap-unity likes this.
Thread Status:
Not open for further replies.