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

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?

@TheADrain ,

You can Refresh the AppReceipt using extension method described here:

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.

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.

@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/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html

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

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 (restoreCompletedTransactions() | Apple Developer Documentation). 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.

@BVanous , @TheADrain

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