Question

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

  • 30 March 2023
  • 14 replies
  • 2777 views

Userlevel 1
Badge +7

Hello,

 

`ERROR - The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit`.


I was recently rejected from app store review due to this weird RevenueCat bug ("react-native-purchases": "5.13.0") that I sometimes experience.

I believe that I have set up all of my code correctly, but when clicking on a subscription purchase (using the purchaseProduct method - `const purchase = await Purchases.purchaseProduct(identifier, null, Purchases.PURCHASE_TYPE.SUBS);`) the request can fail and throw the following error. “The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.” It seems that this error will happen in patches 5-10 times in a row, then once I see one success, they are all successful from there forward (the purchase modal shows up with the product, and the user can subscribe to my subscription). Now when I go back into the app, I cannot reproduce the bug as it will be successful once I get one success (if that makes sense). Eventually I will return to my app later and the bug will show up again. I have seen the bug show up in sandbox testing only, and have been unable to pass app store review due to this issue. Also I am trying to get more verbose debug logging in react native on iOS, I tried adding Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG) in the setup before `configure`. It seems that the docs surrounding this are outdated - how can I get debug logging on a dev client (expo) with the react native SDK?

Please help.

Thanks,
Carl


14 replies

Userlevel 3
Badge +6

Hey @Carl Reiser,

Sorry to hear this is happening! We’ve mostly been seeing this error with StoreKit2 - can you try testing with StoreKit 1 and seeing if the bug persists?

Regarding the debug logs - thanks for pointing out the outdated doc section! `.setDebugLogsEnabled` is being deprecated but `Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG)`should work for you - you can see it being used here in our React sample app.

Badge

Hi, the same issue in native iOS. StoreKit2 is turn off.

Userlevel 1
Badge +7

To anyone else looking here, I was able to get past app store review with revenue cat and 1. the clicking on IAPs and subscriptions load much faster on apples production servers (which was extremely slow on their dev ones). And 2. this bug doesn’t seem to exist anymore?? It’s very difficult to tell as I am not purchasing my own IAPs in my app, but I have had successful subscriptions and IAP purchases so I assume everything is OK. Again, pretty hard to tell without proper usage logging.

Badge +3

My app keeps getting rejected due to this problem as well. Can you please explain what you did to fix the issue. The symptoms are exactly as you described.

Userlevel 1
Badge +7

Really this only happened on occasion in development. It seemed to happen once, when I clicked my subscription button like 6 or 7 times eventually it started working, and I didn’t see the error anymore on a dev client (so once I got past the fail state once, I was good for a while). I don’t know a ton about how the SDK works but I do see in the configure method (static configure({ apiKey, appUserID, observerMode, userDefaultsSuiteName, usesStoreKit2IfAvailable, useAmazon }: PurchasesConfiguration): void;). There’s a parameter usesStoreKit2IfAvailable that defaults to false, I think this feature is in beta - but my only guess is that this bug is somehow related to storeKit2? I didn’t end up ever setting this to true and don’t really know but that was going to be my next attempt if I failed review again. It seems that kaitlin suggested setting it to storeKit 1 and I assume that just means not supplying true to this parameter. To Kaitlins response, I saw this error without setting the usesStoreKit2IfAvailable parameter to true.

To pass review - I probably just got a reviewer who didn’t encounter the bug. And in production (which my app is now “Juice Reel”) you can click the purchase subscription in the store and it seems to work every time. So I hope that this is a bug that only exists on test purchases in iOS, so if you can pass review and get lucky you should be alright.  

Badge +2

I’m getting this in TestFlight builds.
The trouble I’ve had with iOS purchases in the last couple of weeks makes me wonder who is responsible for this and how can they be held to account. The process just screams of unprofessionalism.
The whole caboodle is an absolute farce.
No trouble at all with Google Play purchases.

Badge +3

The thing that solved it for me, was to set this variable to false: usesStoreKit2IfAvailable

Badge +2

I’m using flutter and it’s actually deprecated in the library and I’m not overriding that so I’m presuming that’s not where the problem is.

 

 

Badge +2

Just to be clear:

 

 

Badge +3

I’m using flutter and it’s actually deprecated in the library and I’m not overriding that so I’m presuming that’s not where the problem is.

 

 

Looks like RevenueCat has realized that StoreKit 2 is unstable and have deprecated it for now. 
I think the problem is on the Apple server side. I did not change my code (other than forcing it to use StoreKit 1) and it finally passed Apple Review.
Unfortunately, Apple Review will never admit that the problem is on their side.

Badge

Hi, the same issue in native iOS. StoreKit2 is turn off.

anyone know how I can set the storekit2 to false in a swiftui project???

How do I “ try testing with StoreKit 1 and seeing if the bug persists?”

This was fine last night when i tried it (for the first time). Now this is occurring. Up until now I’ve only ever seen sk1product populated, so I assumed it was using StoreKit 1 (my app deploys back to iOS 13, although I’ve been running in a 16.4 simulator).

I thought maybe the testing certificate had changed, so I uploaded it again, but it made no difference.

FYI, iOS/Apple are approving these test purchases (in simulator using a synced storekit file), and I can see the transactions in Xcode.

Oh! And `Purchases.shared.getCustomerInfo` is returning a valid receipt, it’s only when I purchase a package that this fails for me.

I have the same issue, any updates on this?

Badge +2

Got this error here running in Simulator on my Mac when open paywall:

Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “receipt” couldn’t be opened because there is no such file."

UserInfo={NSFilePath=/Users/XPTO123/Library/Developer/CoreSimulator/Devices/1111111-123-123-ABC3-000000000/data/Containers/Data/Application/99999999999-9999-999-9999-111111111111/StoreKit/receipt,
NSUnderlyingError=0x600000e73ea0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

WARN: 🍎‼️ App running on sandbox without a receipt file. Unable to determine into eligibility unless you've purchased before and there is a receipt
available.

 Library versions:

"react-native-purchases": "^7.17.0"
"react-native-purchases-ui": "^7.17.0"

 

Reply