question

jdurriher avatar image
jdurriher asked

Unknown error response from RedeemAppleAppStoreInventoryItemsRequest

I'm calling RedeemAppleAppStoreInventoryItemsRequest to validate IAPs on iOS, passing in the receipt and entity key.

Testing these purchases in a sandbox environment, my initial purchase received a successful response from the API call. However, after this initial try I keep getting a failure response:

"FailureCode":"Unknown", "FailureDetails":"Failed to redeem offer [productId]. Please try again later."

The odd thing is that the item request actually succeeds and adds the item to the player's inventory in the PlayFab backend, but returns a failure response.

Checking the transaction history for the player, everything looks fine and the item is successfully redeemed. Additionally, this error doesn't occur on Android using RedeemGooglePlayInventoryItemsRequest.

Retrying the request with the same receipt multiple times in a row returns the exact same failure response.

Do you know what could be causing this call to return a failure response despite actually succeeding?

apisappleIn-Game EconomyPlayer Inventory
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

·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

Once you've redeemed a Receipt with PlayFab and not observed any failures, you should call finalizeTransaction() on the client to cleanup the receipt as needed. If you don't, PlayFab might identify the receipt as already granted to the player. Inversely, if you do finalize the transaction, but keep sending the receipt to PlayFab, the backend might have trouble verifying it with Apple. For the Apple integration, it is not expected that you use the same receipt multiple times in a row.

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

jdurriher avatar image jdurriher commented ·

Hey, apologies for the misunderstanding; I only mentioned sending the same receipt multiple times to check if that would return a successful response after the initial failure asking to 'try again later'

Each time I manually retry the purchase I am sending a new receipt to PlayFab but am getting this error.

I believe the transaction is being properly finalized (I am using Unity's IAP service and completing the purchase successfully). I have two products and I can validate receipts for both products successfully one time before getting the error. Restarting the app completely still gives the unknown error, but after waiting a while it seems to reset and I get the initial single success before getting the failure response again.

I can't understand why the call would return a failure but still grant the item successfully. My understanding is that only if the receipt is valid will PlayFab grant the item (which it's doing) so why would it return an error despite completing the transaction successfully?

Moreover, I am following the exact same flow for Android and it is working perfectly. Do you know in what circumstances PlayFab would return an error asking to try again later?

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com jdurriher commented ·

Receipts aren't singular things. They can contain multiple entitlements and we grant the contents individually. It's possible there's something else in the receipt causing the error. What Title Id are you using. We can take a look at the logs.

0 Likes 0 ·
kylemc@microsoft.com avatar image kylemc@microsoft.com kylemc@microsoft.com commented ·

I figured it out (I think I found your title). Your product id is too long. This is our bug, but not one that's easy to fix. You have a couple options.

  1. Wait. We're working on a major update for Fall 2023 that will fix the issue.

  2. Make your product id shorter. The java-style naming that typically occurs with Google Play items adds extra characters. Apple allows you to use shorter names.

0 Likes 0 ·
Show more comments
Show more comments

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.