Question

"Receipt not valid" error when using local StoreKit testing in Xcode with a Mac Catalyst app


Badge +4

At WWDC 2020, Apple introduced the ability to do local StoreKit testing in Xcode (that is, testing without connecting to App Store servers and without using sandbox accounts). I am interested in an answer to the question of whether RevenueCat supports local StoreKit testing in Xcode for a RevenueCat-enabled Mac Catalyst app.  As you’ll see below, I’ve been getting a “receipt not valid” error when I attempt that kind of testing for a RevenueCat-enabled Mac Catalyst app.

Apple's documentation on StoreKit testing in Xcode indicates that local StoreKit testing does work for Mac apps (on a Mac running Xcode 12 or later, and macOS 11 or later). And in its own documentation, RevenueCat gives instructions for setting up local StoreKit testing in Xcode. What's not clear is whether StoreKit testing in Xcode works with the combination of RevenueCat and Mac Catalyst apps.

I followed RevenueCat's instructions (just noted in the last paragraph) for setting up local StoreKit testing in Xcode (importantly, also uploading the public certificate to RevenueCat's website). That local StoreKit testing works perfectly with the iOS version of my app. And the local StoreKit testing initially appears to work perfectly with the Mac Catalyst version of the app. Here, though, is what happens when I try testing the Mac Catalyst version:

  1. When I attempt to make a purchase in the Mac Catalyst version, I get the standard Apple prompt with the title, "Confirm Your In-App Purchase", the question, "Do you want to buy [in-app purchase X]?", and the specification of "[Environment: Xcode]."

  2. When I click the "Buy" button on that prompt, I get the standard Apple prompt for a successful purchase, "You're all set. Your purchase was successful. [Environment: Xcode]."

  3. When I click the "OK" button on that prompt, though, I am subsequently greeted with an "Invalid App Store Receipt" error message.

Here is the relevant RevenueCat debug log from Xcode (with two {}-bracketed descriptions where specific values appeared in the log):

[Purchases] - DEBUG: ℹ️ makePurchase[Purchases] - DEBUG: 💰 Purchasing product from package  - com.appsolutelyfun.ArguMap.freeTrial in Offering TrialPlusPro[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: com.appsolutelyfun.ArguMap.freeTrial (null) ((null)) (null) - 0[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: com.appsolutelyfun.ArguMap.freeTrial 6 ((null)) 4 - 1[Purchases] - DEBUG: ℹ️ Loaded receipt from url Contents/_MASReceipt/receipt -- file://{path to built app in Xcode's Derived Data folder}/Build/Products/Debug-maccatalyst/ArguMap.app/[Purchases] - DEBUG: ℹ️ Found 0 unsynced attributes for App User ID: {specific RCAnonymousID}[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request POST /receipts[Purchases] - DEBUG: ℹ️ API request started: POST /v1/receipts[Purchases] - DEBUG: ℹ️ API request completed with status: POST /v1/receipts 400[Purchases] - ERROR: 😿‼️ The receipt is not valid.[Purchases] - DEBUG: ℹ️ Serial request done: POST /receipts, 0 requests left in the queue[Purchases] - DEBUG: 💰 Finishing transaction com.appsolutelyfun.ArguMap.freeTrial 6 (4)[Purchases] - DEBUG: ℹ️ PaymentQueue removedTransaction: com.appsolutelyfun.ArguMap.freeTrial 6 (4 (null)) (null) - 1

 

Does anyone have any idea why the "receipt is not valid" error occurs? Everything seems to work fine up until the receipt validation step by the RevenueCat SDK.

(As noted above, I did, indeed, upload the public certificate to RevenueCat.)

Does RevenueCat not support Xcode's local StoreKit testing of Mac Catalyst apps (or at least the receipt validation part of it)?  Or is there some other explanation of the "receipt is not valid" error above? Thanks for any info you have.


11 replies

Userlevel 6
Badge +8

Hey @Chad Mohler!

Thanks for reporting this- I was actually able to reproduce this on my end as well. I filed a bug report with our engineering team for further research here.

I’ll follow up when I have more information!

Badge +4

Thanks for the update, Cody; I appreciate the quick reply.  I look forward to hearing more info when it becomes available.

Userlevel 1
Badge +4

Hello,

I’m running into this exact problem on my Mac app. It’s not a Catalyst app, just a SwiftUI Mac App that is part of a universal app.

Any updates? I too have got the public certificate loaded, and everything is working well on the iOS version of the app. It’s just the receipt validation that’s failing.

Badge +4

Hi, Matt.

I originally was getting the “receipt not valid” error with the Purchases SDK v. 3.12.2.  Today I saw that a new version (3.12.3) is available, and I installed it.  Unfortunately, the error still occurs with that new SDK version as well.

Badge

Has there been any solution to this? I am running into this problem now also. 

here’s my full error message: 

 

2021-12-12 19:56:05.132962-0500 StoreKit Test[27385:1288157] [Purchases] - ERROR: 😿‼️ The receipt is not valid.

 

However, the visual display that pops up in the simulator shows a successful sale. 

Badge +1

@Nac @Chad Mohler @Matthew @cody Did any of you managed to find a solution to it?

Badge +4

Hi, Mykola.

I continue to receive the “receipt is not valid” error for Xcode-based local StoreKit testing on Mac Catalyst apps using RevenueCat. 

On the positive side, sandbox testing (using sandbox users created via Apple’s AppStoreConnect) is perfectly functional for Mac Catalyst apps using RevenueCat.

Badge +1

Hi, Just to report that I am getting exactly the same experience as well - Universal App where iOS works fine but the Mac App (not catalyst) has the ‘receipt not valid’ problem, in the same way.

 

Badge +1

Also getting this issue and I only have an iOS SwiftUI app, no Mac involved. I verified that the product names match between the store kit configuration file and RevenueCat and I tried recreating and reuploading the certificate. Everything works fine up until I click ok on the “You’re all set” message.

Badge +1

Hi, Just to mention that I did find a workaround to this problem for my situation, which is specific to Mac OS.  I created another mac OS user account (under Settings), associated a different, dedicated Apple user account with it.  When I want to test, I need to switch to this user and run the app.   Unfortunately, this means I do not use the Xcode debugger when testing.   I have also made this other Apple user a TestFlight tester and test under TestFlight with that user also.   Hope this helps.  

Badge +1

Also getting this issue and I only have an iOS SwiftUI app, no Mac involved. I verified that the product names match between the store kit configuration file and RevenueCat and I tried recreating and reuploading the certificate. Everything works fine up until I click ok on the “You’re all set” message.

Can’t figure out how to edit or delete my answer. I’m an idiot and simply had the bundle ID wrong. (I forgot I had a different debug bundle ID that I should have been using.)

Reply