question

Mateus Dyonisio avatar image
Mateus Dyonisio asked

Problem in RedeemAppleAppStoreInventoryItems (Value cannot be null. (Parameter 'source'))

I've been trying to solve an issue when RedeemAppleAppStoreInventoryItems api. If i test in the app: "Value cannot be null.\r\nParameter name: key". The code I'm using is:

 string transactionReceipt = _appleExtensions.GetTransactionReceiptForProduct(e.purchasedProduct);
    
 PlayFabEconomyAPI.RedeemAppleAppStoreInventoryItems(new RedeemAppleAppStoreInventoryItemsRequest()
                 {
                     Receipt = transactionReceipt
                 }, response =>
                 {
                     Debug.Log("[PoR Store] Validation successful!");
                     _onPurchase?.Invoke(true, e.purchasedProduct);
                 },
                 error =>
                 {
                     Debug.Log("[PoR Store] Validation failed: " + error.GenerateErrorReport());
                     _onPurchase?.Invoke(false, e.purchasedProduct);
                 });

And i receive this error:

uian6Go.png Ew5dt7Z.png

In-Game Economy
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.

Neils Shi avatar image Neils Shi commented ·

This error looks like you’re trying to perform an operation on a null object. Could you add the “transactionReceipt” and “e.purchasedProduct” null checks before calling the API RedeemAppleAppStoreInventoryItems?

0 Likes 0 ·
Mateus Dyonisio avatar image Mateus Dyonisio Neils Shi commented ·

Both are not null, as I was able to see it in the XCode console, would you like me to send it to you?

0 Likes 0 ·

1 Answer

·
Neils Shi avatar image
Neils Shi answered

The API RedeemAppleAppStoreInventoryItems uses the validation process explained : Validating receipts with the App Store | Apple Developer Documentation. Please make sure that you obtain the receipt in the same way when calling the API.

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.