Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Solved] Any way to get Refresh Receipt on IOS?

Discussion in 'Unity IAP' started by TheADrain, Mar 9, 2017.

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

    TheADrain

    Joined:
    Nov 16, 2016
    Posts:
    48
    Hi guys,

    I'm using Unity IAP to handle making my purchases from Apple, but I'm using Playfab as my back end service. Granting the purchased items works just fine, but restoring purchases I run into errors as the receipts that Unity hands me back for restoring a purchase using ProcessPurchase have already been verified by playfab and it will reject them as already having been used.

    Their documentation says specifically on iOS that you need to use a SKReceiptRefreshRequest to get a new receipt to use that they can verify.

    If there any way to do this? Or do I need to skip receipt verification and just manually grant the items myself for this instance?
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
  3. TheADrain

    TheADrain

    Joined:
    Nov 16, 2016
    Posts:
    48
    Ah, thanks you! I'm not sure how I managed to miss this but somehow I did. Really appreciated as this is the last thing we need to do here to meet minimum requirements for app-store submission.
     
  4. TheADrain

    TheADrain

    Joined:
    Nov 16, 2016
    Posts:
    48
    Unfortunately that didn't work for me. It processes ok and fetches the receipt, but I get back the same receipt I've already seen and as a result, when I send it up to Playfab for verification, it says I've already used that receipt and fails to validate.
     
  5. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @TheADrain,

    That is expected behavior. Refreshing the receipt is basically re-downloading the receipt if it is missing. It will not make any changes to the receipt.

    I don't have any experience with PlayFab. Based on this post, it sounds like other users have had this issue:
    https://community.playfab.com/questions/5815/receipt-validation-iosandroid-after-restore-purcha.html

    The receipt from the Restoration should be different than the original receipt, according to Apple's docs:
    https://developer.apple.com/library...teAppStoreReceipt/Chapters/ReceiptFields.html

    How are you passing the receipt data to PlayFab from Unity IAP?
     
  6. BVanous

    BVanous

    Joined:
    Apr 4, 2017
    Posts:
    1
    There's been some confusion on this, due to mixed use of "refresh" and "restore" receipts. The correct process is to submit the receipt obtained via a call to the restoreCompletedTransactions method of SKPaymentQueue in the Store Kit (https://developer.apple.com/reference/storekit/skpaymentqueue/1506123-restorecompletedtransactions). That receipt will contain updated receipts for all non-consumable purchases made by the player, and so will restore purchases made in another account when passed into Client/RestoreIOSPurchases in PlayFab. @ap-unity, if you can confirm the correct path in Unity IAP for a developer to get that receipt, that would help them to resolve this.
     
  7. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @BVanous, @TheADrain

    Yes, restoreCompletedTransactions the method that is called when you use the RestoreTransactions extension for iOS:
    https://docs.unity3d.com/Manual/UnityIAPRestoringTransactions.html
     
Thread Status:
Not open for further replies.