question

freelancegordon avatar image
freelancegordon asked

Is there any way to restore purchases without using RefreshReceipt on IOS?

HI guys,

I'm trying to implement restore purchases on ios for Unity, and unfortunately Unity's IAP SDK doesn't seem to provide a way to get the RefreshReceipt that PlayFab requires in order to restore purchases for IOS.

So I'm wondering the best way to proceed, as I can validate the receipt locally with UnityIAP, and then manually grant the item but that's obviously not as secure.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Our sincere apologies for the confusion on this issue. The issue here was one of confusion between "refresh" and "restore" receipts, and we're fixing all documentation to clarify this. In point of fact, 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 PlayFab account.

One thing to bear in mind though, is that this does provide a hacked client with a way to get multiple instances of non-consumable goods, by hitting the restoreCompletedTransactions call multiple times, and using all those receipts. While this would, ultimately, only cause problems for the player (since it would cause the inventory to fill up with these items if they did this a lot), a safer route would be to only sell virtual currencies (a consumable good) in the iTunes store, and then use that VC to make purchases of digital goods via your game's Catalog (using PurchaseItem). And, of course, the best route is always to make sure you can reliably get the player back to their original account on any device by incorporating alternate authentication systems, like Facebook, Twitch, and Google whenever possible.

3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

freelancegordon avatar image freelancegordon commented ·

Thanks for the clarification Brendan, it's much appreciated.

That may have to be the route I take for this application, thankfully inventory shouldn't be too much of an issue as the only non-consumable item we sell is 'remove advertisements' the rest is consumable virtual currency. Unfortunately my client is insisting on totally anonymous users, so we won't be able to log them in with fb/twitch/twitter/etc (additionally, we're having a lot of issues balancing the 65k DEX limit on android)

Lastly, do you have any advice as to how I might access the restoreCompletedTransactions method of StoreKit via Unity? I've asked on their support forums but haven't had a response as of yet and this is one of the last things I need to do that's critical for Apple App Store submission for this app.

Thanks again!

0 Likes 0 ·
brendan avatar image brendan freelancegordon commented ·

I don't believe Unity offers direct access to that API call. Most developers I know are using a plugin such as Prime31 for this, or writing native code to access that part of the Store Kit.

0 Likes 0 ·
brendan avatar image brendan freelancegordon commented ·

Update: The Unity folks confirmed that you can get the restore receipt via UnityIAPRestoringTransactions.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.