Handling revoking In-App purchase with iOS 14

Published

I added the new revocation API provided with iOS 14 but i’m still confused about some aspect of it. I tested revoking my subscription using StoreKit Framework and I do enter in the didRevokeEntitlementsForProductIdentifiers callback.

But I’m wondering if this will cover all the cases where apple actually revoke access to a user because the user asked for a Refund. What happen if the app is closed? Will this method be called upon launching the app the next time?

Here is my code:

extension PurchaseManager: SKPaymentTransactionObserver {
    func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        /*no-op*/
    }

    @available(iOS 14, *)
    func paymentQueue(_ queue: SKPaymentQueue, didRevokeEntitlementsForProductIdentifiers productIdentifiers: [String]) {
        SubscriptionHandler().validateSubscription()
    }
}

Source: Ios Questions

Published
Categorised as ios, storekit, swift Tagged , ,

Answers

Yes, I understand paymentQueue(_:didRevokeEntitlementsForProductIdentifiers:) will be invoked when a refund request is granted, as well as if their access to the product changes. For example, with Family Sharing, they may cancel the subscription or leave the family. Note though that they may still have access to the purchased product so one should examine the receipt to know whether or not to revoke access (local receipt validation or via your server). For more information, see this WWDC 2020 video and the documentation.

If your app is not running, I understand paymentQueue(_:didRevokeEntitlementsForProductIdentifiers:) can be invoked when your app is launched next once you add an observer via SKPaymentQueue.default().add(self), similar to how paymentQueue(_:updatedTransactions:) works.


Miss Libbie West I

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq