Question

Disable Receipt Validation in DEBUG mode (Swift SDK)

  • 13 January 2024
  • 5 replies
  • 65 views

Badge +2

I’m using StoreKit 2 with an automatically synced StoreKit Configuration file in Xcode which is an amazing tool to use in development. Unfortunately, even though I uploaded the public certificate for StoreKit testing, I always get the “ERROR: 😿‼️ The receipt is not valid.” message during development.

I’ve read in other threads that this is a common issue. Also, I’ve read somewhere to use StoreKit 1 or to not provide a StoreKit configuration file. But I’m not willing to use older APIs and features when there are shiny new tools that make development much more fun. Please don’t try to convince me that StoreKit 1 is more stable. I’ve used StoreKit 2 directly, and it was an awesome development experience. I’m just using RevenueCat for the Live Data, Experiments, and for the Paywall UI. But my development experience has degraded since I made the switch.

To improve this, I would like to simply turn off receipt validation when I run my app in DEBUG mode. In other words, I’m looking for something like the following code to work in the Swift SDK:

```Swift
#if DEBUG

Purchases.receiptValidationEnabled = false
#endif

```

If you want to enforce receipt validation in production for some reason, you could instead name the option something like `disableReceiptValidationInDebugMode` and do the DEBUG check yourself internally within the SDK. Alternatively, I would be also fine to turn off receipt validation in sandbox mode for all my apps or with an app-specific setting.

All I want is a reliable and smooth development experience where I can use Xcodes awesome built-in StoreKit transactions manager and the fact that I can make purchases quickly without having to sign in to any Sandbox account (which I no longer need with StoreKit config files). I don’t like to get errors during development because of some security measures.


5 replies

Userlevel 4
Badge +6

Hey @Jeehut !

 

Thanks for reaching out! 

 

I am sorry you are encountering that error and issue, can you please ensure that you have done the following:

 

If you have made any changes in the StoreKit config file you will need to re-upload the new file in order to make sure that we have the current latest information. 

 

Also, can you please confirm that you have uploaded an In-App purchase key? 

 

As far as toggling this off in debug mode, we currently do not have a feature for this. 

Badge +2

I will not constantly re-generate and re-upload a certificate file just for debugging purposes. Having to do this once was already annoying enough, and I really don’t understand why it’s needed given that I’m in development mode. There really should be no receipt validation in debug mode if it’s not possible to do the validation without constant annoyances.

Badge +2

P.S. I know that you currently “don’t have a feature for this“, that’s why I created the discussion in the first place. I’m suggesting to add it. It’s really annoying that I have to sign in to an App Store Connect account multiple times a day to test my app. Even Apple admitted that and solved it. Would be great if RevenueCat didn’t break that solution.

Userlevel 4
Badge +6

Hey @Jeehut ,

 

Thank you for the feedback, I will share it with the rest of the team as we are always working on bettering our system for developers. 

 

Currently you will need to re-generate that file but that could change in the future. It is not on our backlog as of now, but I will share this so more eyes can get on it. 

I agree with this. I am migrating from StoreKit to RevenueCat and encounter the ERROR: 😿‼️ The receipt is not valid. error when testing from Xcode using .storekit file, which worked before.

Reply