question

Tommy Li avatar image
Tommy Li asked

Why are prices needed in some validation API? Difference between ValidateIOSReceipt and RestoreIOSPurchases?

I have been reading documentations on validating receipts from in-app purchases. I noticed that App Store and Windows Store receipt both require me to provide a price and currency code. I don't think this makes sense, since Apple IAP receipts and Windows Store receipts can contain more than one IAP records, plus the response may give multiple fulfillments, the PlayFab API does not require me to provide an Item ID intended to be validated -- without specifying which item to look for it makes little sense to provide a price, at least for me.

I also noticed "RestoreIOSPurchases" which seems to serve the same purpose as the "ValidateIOSReceipt", except that the former does not need pricing information, per the documentation. Are there any differences between these two API?

apis
10 |1200

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

Seth Du avatar image
Seth Du answered

I have filed a bug for this but am not sure if this is an issue that should be fixed because there is a possibility that CurrencyCode, PurchasePrice are only aimed at informing PlayFab side that how much this player has paid for the item so that value-to-date can be calculated at the back-end. These 2 properties may not be involved in the validating process but are still necessary. We are discussing if it should be a "required" property in the request.

2 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.

franklinchen avatar image franklinchen commented ·

Update: the CurrencyCode and PurchasePrice fields are all not required for ValidateIOSReceiptRequest API now

1 Like 1 ·
Tommy Li avatar image Tommy Li commented ·

Thank you for the follow up. It does sounds like I can safely pass 0 USD (for example) as a workaround.

0 Likes 0 ·
Seth Du avatar image
Seth Du answered

RestoreIOSPurchases and ValidateIOSReceipt are 2 different APIs designed for separate application scenario.

  • ValidateIOSReceipt will be used shortly after when iOS purchase is done, to validate the receipt so that PlayFab can grant corresponding items to the player. Since the IAP products’ IDs and prices is prior defined in the Apple side and PlayFab reflects those products from there. There is already an exact match for each item, which also means, the receipt from Apple should contain enough product information. Since there can be multiple currency defined for an item, PlayFab will confirm validity of this receipt via the receipt itself, also if the player pays the correct number of currency. You may also refer to https://docs.microsoft.com/en-us/gaming/playfab/features/commerce/economy/getting-started-with-unity-iap-android.
  • RestoreIOSPurchases is used when a player’s device is changed or data is wiped, and he wants to recover IAP items. In this case, we will simply need to retrieve a receipt from Apple as an approval of the historical purchase, while there is no need to confirm the purchase again because the purchase has been validated before. Theoretically, the process to retrieve a receipt of previous purchase is different from the one returned from the purchase meanwhile the returned result contains different information compared with the purchase callback result. I am not familiar with this part but the receipt that returned from initial purchase can be for one time use.

PS. There can be other accidents, for example the purchase is successful but app is crashed when validating. Here is the thread you may refer to: https://community.playfab.com/questions/5482/ios-receipt-validation-after-restore-purchase.html

2 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.

Tommy Li avatar image Tommy Li commented ·

I appreciate the explanation, but this still does not convince me why price information is needed to validate purchase.

The amount that user actually pays using Apple IAP system is never returned to the developer. The only pricing information available is in the product information. For Apple's remote receipt validation, the price information is not a part of the response from Apple server return to the server endpoint. If PlayFab uses the Real Money amount defined in the item information (which defaults to USD), how is it going to handle pricing policy changes, and temporary price changes?

Also, taking a step back, if providing pricing information is required for iOS and Windows in the API, why is it not required for Android? --> https://docs.microsoft.com/en-us/rest/api/playfab/client/platform-specific-methods/validategoogleplaypurchase?view=playfab-rest

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Tommy Li commented ·

I will discuss with the team about your concerns on price validation. However, in terms of RM defined in the item, it will be used for calculating value-to-date on the PlayFab side for most of the cases when doing receipt purchase. The actual price that a player should pay is defined on Apple side, where multiple currency can be added to the same product. It is changed according to the App Store region and customers' payment methods.

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.