StoreKit 2 in-app purchase restore

Apps that support in-app purchases are rejected in App Review unless they implement the ability to restore previous purchases. There is a WWDC 2022 video on doing exactly that and I am doing what that video suggests, but my app is still rejected. Here's what they say:

"When validating receipts on your server, your server needs to be able to handle a production-signed app getting its receipts from Apple’s test environment. The recommended approach is for your production server to always validate receipts against the production App Store first. If validation fails with the error code "Sandbox receipt used in production," you should validate against the test environment instead."

To which I replied:

"I don’t have a server. Can you explain what “your server” means for an iOS app that has no server-side components?"

But they won't explain themselves. They just say:

"Your question requires technical assistance and would be best addressed by Apple Developer Technical Support who can provide discrete code-level assistance for Apple frameworks, APIs, and tools."

Can someone point me to a code example that shows how to do this? My failed attempt is here: https://github.com/mvolkmann/SwiftUI-GiftTrack/blob/main/GiftTrack/ViewModels/StoreViewModel.swift

If you are using StoreKit2 then “app receipts” and verifyReceipt endpoint “ don’t apply. Those are for Original StoreKit.

A “Restore Purchases” action is important as an emergency, ideally your App actively restores service proactively without any customer action but there are cases they may need to manually. The Sync() is how to do this. https://developer.apple.com/documentation/storekit/appstore/3791906-sync/

meanwhile check out our session on this Best practice, https://developer.apple.com/videos/play/wwdc2022/110404/

You recommended watching the video "Implementing proactive in-app purchase restore". I've already watched that a few times. I think I'm doing exactly what it recommends and it is not enough to get my app past App Review. My in-app purchase is the simplest possible case. It is a one-time, non-consumable purchase that simply unlocks some functionality in my app. The part of my code that enables making the purchase and unlocking functionality is working perfectly. I just don't have the part to restore previous purchases working. I bet the solution is less than 10 lines of code. It's maddening that I can't find a working example online.

StoreKit 2 in-app purchase restore
 
 
Q