Solved

Failure to restore purchases made using local StoreKit testing

  • 2 August 2021
  • 2 replies
  • 739 views

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 would like to use that local StoreKit testing to test restoring RevenueCat-enabled purchases after an app re-install.

Unfortunately, even though such a restore succeeds when testing on a device using a sandbox account, that restore always fails when performed using local StoreKit testing in Xcode (either on a real device or on the iOS Simulator).

My question: does RevenueCat support the restoration of purchases after an app re-install when local StoreKit testing in Xcode is being used to make and subsequently restore the purchases?

Here are the steps I performed in the effort to test the restore of purchases using local StoreKit testing.  Note: I have tried these steps both on a real device and in the iOS Simulator, and the result is the same in each case.

  1. I set up local StoreKit testing in Xcode with a StoreKit configuration file using RevenueCat's instructions (and importantly uploading the public certificate to RevenueCat).

  2. I successfully make an in-app purchase using the local StoreKit testing scheme. The RevenueCat purchaserInfo object resulting from that transaction properly registers the entitlement for that purchase.

  3. I delete the app

  4. I use Xcode to re-install the app. I tap the button in my app to restore purchases, which triggers a Purchases.shared.restoreTransactions call.

  5. The purchaserInfo object returned from that call does not contain the entitlement from the previous purchase. (Possibly of note?: that object contains only one RevenueCat RCAnonymousID app user ID, and it is different from the RevenueCat RCAnonymousID app user ID originally returned when that purchase was successfully made before the app deletion and re-install.)

  6. The RevenueCat debug log in Xcode returns the following error: "ERROR: 😿‼️ The data object identifier couldn't be found on the receipt."

It looks as if RevenueCat can't successfully restore the purchase previously made using local StoreKit testing (and, as noted above, that appears to be true regardless of whether the local StoreKit testing occurs on a real device or in the iOS Simulator). Is that because RevenueCat doesn't currently support restoration of purchases made using local StoreKit testing, or is there some other reason for that failure?

Thanks for any info anyone has.

icon

Best answer by tina 2 August 2021, 20:45

View original

2 replies

Userlevel 5
Badge +10

Hi @Chad Mohler!

Since local StoreKit testing can be tested without sandbox accounts, this sounds like the reason why RevenueCat is unable to parse the receipt after deleting the app. The flow that you described here is deleting the app and attempting to restore purchases when there is no receipt to parse. I’m not too familiar with where the receipt is stored during local StoreKit testing when there’s no sandbox account, but it sounds like the receipt is wiped after the app is deleted. Note that in production a receipt is generated once a customer downloads an app and is saved against the app store account (iOS would be their Apple ID), while in sandbox testing the receipt is saved against the sandbox account. We recommend using StoreKit testing to test your app’s purchase flow and sandbox accounts for other tests (e.g: restoring functionality). Also, StoreKit configuration files can produce weird sort of incomplete receipts.

I want to point out that specific error that you’re running into. This error means that our local receipt parser failed when parsing. If anything goes wrong with the local receipt parsing, we will default to the backend. That being said, if you run this error in production there is no need to worry since it will not affect your customers. 

Badge +4

Thanks, Tina, for the informative reply— that explanation is good to have.  I’ll be sure to use sandbox accounts for testing the restoration of previous purchases.

Reply