Restore Purchase not Working

I’m using the new StoreKit 2 APIs in my production app that sells a non-consumable iap. I’ve tested restoring purchases with a StorekitConfiguration in development, along with my own personal Apple ID in production and it works. 

The problem is that I’m getting lots of users reporting that restore purchase does’t work on a consistent basis. So my question is, is there something in my production code that is wrong or broken? Or is this a common problem with end users themselves and not my app? My app used the old version of store kit previously, so could that cause this issue?

I always recommend they make sure they’re signed in with the same Apple ID they purchased the app with. Sometimes recommending the user to quit and relaunch the app, or restart there computer fixes the issue. I’ve gotten multiple reports that the only fix was completely deleting then reinstalling the app. And there’s a good portion which non of the above work.

Here’s the code that handles restoring purchases:

/// Attempts to restore any purchases by the user.
/// This is called by the restore purchase button
public func restorePurchase() {
    Task {
        try? await AppStore.sync()
        await updateActiveProducts()
    }
}

/// Updates the status of which products have been purchased/are an active subscription
@MainActor public func updateActiveProducts() async {
    var purchasedIds: [String] = []

    // Iterate through all of the user's purchased products.
    for await result in Transaction.currentEntitlements {
        do {
            let transaction = try checkVerified(result)

            // Has the App Store revoked this transaction?
            // If it is upgraded do nothing, there is an active transaction for a higher level of service
            if transaction.revocationDate != nil || transaction.isUpgraded {
                continue
            }

            // Check if the subscription is expired
            if let expirationDate = transaction.expirationDate, expirationDate < Date() {
                continue
            }

            if transaction.productType == .nonConsumable || transaction.productType == .autoRenewable {
                purchasedIds.append(transaction.productID)
            }
        } catch {
            // Transaction not verified, don't do anything
        }
    }

     // This is a published property which unlocks the features of the app
    self.purchasedIdentifiers = purchasedIds
}

Any advice would be appreciated! 

That looks correct, if you can reproduce and provide a sysdiagnose, please file a Feedback assistant ticket. http://feedbackassistant.apple.com

You also can consider reviewing our Proactive Restore best practice to minimize the need for a customer to need to manually restore their past transactions. https://developer.apple.com/videos/play/wwdc2022/110404/

Lastly if customers are reporting past purchases not being provided, you can also verify their purchases using the customers email receipt using our App Store Server API - https://developer.apple.com/documentation/appstoreserverapi/look_up_order_id

I got exjectly same problem

Restore Purchase not Working
 
 
Q