Possible bug with react-native-purchases

  • 16 January 2023
  • 1 reply
  • 40 views

Badge

Error: The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.

I think I found a bug with the react-native-purchases purchaseProduct method on iOS (not android). 

See the types in the screenshot attached (the function invocation in the screenshot works, without the optional parameters it does not on iOS). I also see it says “subs by default”, but on a subscription purchase it does not work without explicitly supplying the PurchaseTypes.SUBS enum value. Revenue Cat lists the first parameter as required and the other 2 parameters as optional (upgradeInfo?, type?). However, if you don’t supply the second 2 parameters on iOS an exception is thrown with error message - “Error: The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.” This took me a while to figure out as the types seem to be incorrect here, they should be required because without them this exception is thrown. For anyone encountering this error on react-native-purchases purchaseProduct method, this was the fix for me and it was pretty confusing. Is this a bug?

Thanks!


1 reply

Userlevel 2
Badge +3

Hi Carl, I can’t see the picture, it doesn’t load.

The second and third parameters in `purchaseProduct` are not required for iOS and not passing them works. Whatever is passed as upgradeInfo and type is ignored in iOS and only used when running on Android.

The error you were seeing was most likely not related to passing anything as second parameter and probably an issue with Apple receipts (which we don’t have much control around) that most likely got fixed by itself. 

Reply