Possible bug with react-native-purchases

  • 16 January 2023
  • 5 replies
  • 750 views

Userlevel 1
Badge +7

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!


5 replies

Badge

Hi, iOS app native. it worked before in sandbox, testflight and production, but now in sandbox failed with error: Error Domain=RevenueCat.ErrorCode Code=8 "The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit." UserInfo={source_file=RevenueCat/HTTPClient.swift:410, readable_error_code=INVALID_RECEIPT, rc_response_status_code=422, source_function=convertUnsuccessfulResponseToError(), rc_backend_error_code=7712, NSLocalizedDescription=The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit., NSUnderlyingError=0x282a56be0 {Error Domain=RevenueCat.BackendErrorCode Code=7712 "The purchased product was missing in the receipt. This is typically due to a bug in StoreKit." UserInfo={NSLocalizedDescription=The purchased product was missing in the receipt. This is typically due to a bug in StoreKit., rc_backend_error_code=7712}}}

 

I’ve updated to latest version  Installing RevenueCat 4.17.7 (was 4.17.4) and turn off storekit2 ( .with(usesStoreKit2IfAvailable: false) )

But I still get this error. And the error is not for all products. This error occurs the first time I make a purchase of a weekly product only

Any ideas ?

Badge +5

Hey Guys!

Since last weekend we are experiencing a decrease in our conversion rates on iOS. We didn’t change anything in our code and that’s why we are suspecting that is something related with the purchases… 

It’s an intermitant behaviour and that’s why is difficult for us to clearly identify the issue.

We are using: react-native-purchases”: “4.6.0", em ios
 

I don't know if anyone else is having this type of issues.
Thanks

Badge

@Cesar To confirm, I started seeing the same issue suddenly occurring on multiple iOS device using our Staging Deployment (Apple Account + Testflight). We have not changed any purchases related libraries (i.p. react-native-purchases) in the time frame in question. We are on v5.7.0. I’m not sure, but it may be related to one of two things:

  • trying the purchase the first subscription after updating or reinstalling a new build in Testflight
  • changing from an expired Monthly to Yearly subscription (or vice versa)

We still don’t have a clear replication scenario, but it is a definite issue. I’d be curious, if any of the above reports were seen in Production (i.e. non-Testflight environments).

We use the Purchases.purchasePackage(...) method to make the subscription purchase. On iOS we are passing `null` as the second argument, as the “upgradeInfo” is indicated to be only for Android.

We will try an upgrade to RN Purchases 5.11.0.

 

Badge +3

 

I just observed the same behavior:

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

Then I rebuild the app with a null second argument and Purchases.PURCHASE_TYPE.SUBS as a third argument and purchases are successful.  

If I delete the line and rebuild I can reproduce [Error: The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.]

 

@Cesar I think this is not just a spurious app store issue.

Userlevel 3
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