question

andreswx@gmail.com avatar image
andreswx@gmail.com asked

Receipt validation (iOS/Android) after restore purchase

I'm currently using UnityIAP to make purchases and PlayFab for receipt validation. The first time the player makes the purchase everything works fine.

If purchase restoration is triggered, Unity IAP tries to restore the purchase, and I send the receipt to playfab for validation.

Validation fails, because the receipt has already been used during the first validation.

Is there a way to fix this?

Thanks in advance!

10 |1200

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

brendan avatar image
brendan answered

[Edit: Updated with the correct Store Kit API reference]

We track on receipt usage, to ensure that players can't cheat and get the item they paid for multiple times. Otherwise, a hacked client could just send the same receipt over and over again, to amass tons of VC, for example.

To restore previous purchases (when a player signs into a new account due to a lost phone, etc.) on iOS, you need to use a Restore Receipt (https://developer.apple.com/reference/storekit/skpaymentqueue/1506123-restorecompletedtransactions). This is a fresh receipt, generated by the iTunes service, which can be used to grant the items to the player.

Google does not provide a similar "restore" style receipt currently. On their platform, you would need to get the list of items the player purchased (https://developer.android.com/google/play/billing/billing_integrate.html - check the "Querying for purchased items" section) and grant them to the player again in Cloud Script (after checking to make sure the player doesn't already have the items).

1 comment
10 |1200

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

brendan avatar image brendan commented ·

Of course, ideally, you'd just get them back to their original account by having a common login method, like Facebook, Twitch, etc. :)

0 Likes 0 ·
andreswx@gmail.com avatar image
andreswx@gmail.com answered

Thanks Brendan! We do have a common login method, but we wanted to check other options too.

10 |1200

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

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.