question

tudorjude47 avatar image
tudorjude47 asked

Regarding purchase validation.

Hello Playfab developers,

I had a question regarding receipt validation for google play store and the App store. Currently, as I understand it, the client functions ValidateInappPurchaseIOS and ValidateInappPurchaseGoogle work like this. The user completes a transaction on said store (i.e their money has been retracted from their bank account) and receives a receipt. I then pass this receipt to the Playfab validation functions and if all is ok the user will get the bundle with the appropriate ID that i setup in the Playfab Economy tab. This is the best case scenario. But what happens if the user buys something, receives a receipt but then the validation function fails for some reason or another? The solution i was thinking of trying was to cache this receipt and try the validation again later. I don't know if it will work since i am not sure how you make that receipt validation ( for example if you check the receipt time stamp for example ). I've had a user that had his money taken away but received nothing in game ( I checked to see if he received said bundle and he did not in his playfab inventory page ). I am sorry if this question was asked before, I checked the forums and could find no solution to this problem. Any help would be apprectiated.

Keep up the good work!

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

Specifically, we check that the receipt is valid, that it's actually for your game, that it's for an item in your game's catalog, and that it hasn't been used before. For that last one, we store the unique ID for the receipt in our own data table after we've processed the receipt and provided the virtual goods. So no, no worries on that front - the only way we would say the receipt has been used is if it really has. So, the cases you need to think about are when you can't get a good response from us for the receipt (whether due to the client dropping its connection, the receipt's item not being in your catalog, etc.), or when the user changes devices on Google Play (iTunes provides a "restore" receipt which is for use in the case that the player switches devices). So for those cases, keeping the receipt info locally would indeed be a good idea.

I would also recommend adding an alternate sign-in mechanism which is not device-specific, like Facebook, Twitch, etc., so that a player moving between devices can always get to the same account, regardless.

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.

tudorjude47 avatar image tudorjude47 commented ·

I did eventually end up caching the receipts and it works flawlessly. Thanks for the help!

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.