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
  • 17 replies
  • 3128 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


17 replies

Badge +1

I ran into this yesterday and my app was rejected. I was able to reproduce the error (using TestFlight directly [not in the debugger]). I thought it might be a temporary problem, but it recurred the next day. I rebuilt the app (with a small, unrelated bug fix). Then I uploaded to the store and downloaded the new TestFlight build. Worked just fine. Rather than a bug in StoreKit itself, I wonder if there is something about how the build is prepared for TestFlight, or something that is inserted in the build or preparation process. Just a thought.

I was testing on simulator and what it cause for me the issue is re-creating subscriptions I had to delete StoreKit and recreate on Xcode and then upload revenucat. Which was caused the error and I simple DETELE THE OLD App and the problem was gone

Userlevel 1
Badge +7

@kaitlin do you guys have an other information on this issue? It still seems to be ocurring on 7.0.0 and above per lucas’ comment. I do have the flag usesStoreKit2IfAvailable set to false when configuring the package. This results in our team getting randomly rejected from app store review for a poor purchase experience, and it would be great if this got resolved.

Purchases.configure({ apiKey: apiKeys.apple, appUserID: username, usesStoreKit2IfAvailable: false });

Here are the DEBUG logs. 

DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["ji_99.99_1m_arbitrage"]

DEBUG: ℹ️ This StoreProduct represents an SK1 product, the type of product cannot be determined, the value will be undefined. Use `StoreProduct.productCategory` instead.

DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["ji_99.99_1m_arbitrage"]

INFO: 💰 Purchasing Product 'ji_99.99_1m_arbitrage'

DEBUG: ℹ️ Adding payment for product 'ji_99.99_1m_arbitrage'. 1 transactions already in the queue.

DEBUG: ℹ️ StoreKit1Wrapper (0x00000002848bc360) updatedTransaction: ji_99.99_1m_arbitrage 2000000305270533 2000000284109596 1

10.7.0 - [FirebaseAnalytics][I-ACS023141] Purchase is a duplicate and will not be reported. Product ID: ji_99.99_1m_arbitrage

DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: carl3

DEBUG: ℹ️ TransactionPoster: handling transaction '2000000305270533' for product 'ji_99.99_1m_arbitrage' (date: 2023-03-30 18:11:29 +0000)

DEBUG: ℹ️ Loaded receipt from url file:///private/var/mobile/Containers/Data/Application/39947464-B13B-46B3-BB39-2B0369EF6F16/StoreKit/sandboxReceipt

DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["ji_99.99_1m_arbitrage"]

DEBUG: ℹ️ PostReceiptDataOperation: Started

INFO: ℹ️ Parsing receipt

INFO: ℹ️ Receipt parsed successfully

DEBUG: ℹ️ PostReceiptDataOperation: Posting receipt (source: 'purchase') (note: the contents might not be up-to-date, but it will be refreshed with Apple's servers):

{"application_version":"2","bundle_id":"com.juiceintegration.juicereel","creation_date":"2024-03-08T14:55:23Z","opaque_value":"JPVrn7PGaEdtATisb1eE7g==","original_application_version":"1.0","in_app_purchases":[{"product_id":"ji_8.99_1m","is_in_trial_period":false,"quantity":1,"web_order_line_item_id":2000000054072585,"original_transaction_id":"2000000544043125","transaction_id":"2000000544043125","purchase_date":"2024-03-08T14:55:20Z","expires_date":"2024-03-08T15:00:20Z","is_in_intro_offer_period":false,"product_type":3,"original_purchase_date":"2024-03-08T14:55:20Z"},{"quantity":1,"product_id":"ji_12.99_1m","transaction_id":"2000000249835862","purchase_date":"2023-01-13T18:52:04Z","expires_date":"2023-01-13T18:57:04Z","original_transaction_id":"2000000249835862","is_in_trial_period":false,"original_purchase_date":"2023-

DEBUG: ℹ️ There are no requests currently running, starting request POST /v1/receipts

DEBUG: ℹ️ API request started: POST '/v1/receipts'

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

DEBUG: ℹ️ API request failed: POST '/v1/receipts' (422): The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit.

DEBUG: ℹ️ PostReceiptDataOperation: Finished

DEBUG: ℹ️ Serial request done: POST /v1/receipts, 0 requests left in the queue

INFO: 💰 Finishing transaction '2000000305270533' for product 'ji_99.99_1m_arbitrage'

DEBUG: ℹ️ StoreKit1Wrapper (0x00000002848bc360) removedTransaction: ji_99.99_1m_arbitrage 2000000305270533 2000000284109596 1

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

ERROR: 💰 Product purchase for 'ji_99.99_1m_arbitrage' 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={rc_response_status_code=422, source_function=parseUnsuccessfulResponse(), readable_error_code=INVALID_RECEIPT, source_file=RevenueCat/HTTPClient.swift:617, NSLocalizedDescription=The receipt is not valid. The purchased product was missing in the receipt. This is typically due to a bug in StoreKit., rc_backend_error_code=7712, NSUnderlyingError=0x28204fdb0 {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}}}

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

Unable to find module for RedBox

tcp_input [C57.1.1:3] flags=4 seq=1,692,793,210, ack=0, win=0 state=8 rcv_nxt=1,692,793,211, snd_una=3,711,314,593

tcp_input [C57.1.1:3] flags=4 seq=1,692,793,210, ack=0, win=0 state=8 rcv_nxt=1,692,793,211, snd_una=3,711,314,593

tcp_input [C57.1.1:3] flags=4 seq=1,692,793,211, ack=0, win=0 state=8 rcv_nxt=1,692,793,211, snd_una=3,711,314,593

tcp_input [C57.1.1:3] flags=4 seq=1,692,793,211, ack=0, win=0 state=0 rcv_nxt=1,692,793,211, snd_una=3,711,314,593

DEBUG: ℹ️ Skipping products request for these products because they were already cached: ["ji_99.99_1m_arbitrage"]

DEBUG: ℹ️ This StoreProduct represents an SK1 product, the type of product cannot be determined, the value will be undefined. Use `StoreProduct.productCategory` instead.

Also this thread is a duplicate of 


Thanks!

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"

 

I have the same issue, any updates on this?

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.

Badge +1

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???

Badge +4

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 +2

Just to be clear:

 

 

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 +4

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

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.

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 +4

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

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

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

Userlevel 4
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.

Reply