Is there an easy way to check the status of the user's Subscription on the App Store, or the only way is to do a receipt and Subscription validation?

Viewed 2282

Does anyone know the easy way to check if the user already purchased a subscription or not when the app loads?

I just need to check if the user already purchased the subscription, nothing else. Seems easy, but it is not in reality, because I need to validate a receipt and check a subscription date.... The subscription validation technique seems to be not an easy task and I didn't find a good tutorial or a good guide that describes how to implement it step by step. I've read Apple documentation here Is there any easy Local Receipt Validation and Subscription Validation technique to check if the user subscribed or not?

Maybe anyone knows a framework or a method to do it fast? Any help appreciated.

Using: Swift 4, Xcode 9.4

3 Answers

The RevenueCat SDK provides a good out-of-the box solution for this.

More than a couple reasons why I like this approach:

  • Validates receipt server side (without requiring me to set up a server)
  • Checks for an "active" subscription with a server timestamp so can't be spoofed by changing the device clock
  • Caches the result so it's super fast and works offline

There's some more details in this question: https://stackoverflow.com/a/55404121/3166209

Which boils down to:

subscriptionStatus { (subscribed) in
    if subscribed {
        // Show that great pro content
    }
}

I am using IAPHelper https://github.com/JonasTillges/IAPHelper

Its Really easy to use !

IAPHelper.verifyPurchase(with: IAPHelper.proSubscription, sharedSecret: IAPHelper.sharedSecret, type: .autoRenewable)

In the IAPHelper.swift you could set a UserDefaults for .purchased .expired and .notpurchased

Related