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

2

There are 2 best solutions below

3
Rob On

Ok here is your answer. I have also followed this same tutorial and it helped me. I validated the receipt and confirmed that the payment is made. See the link below. Hope it helps.

In App Purchase in Swift, with Receipt Validation

0
enc_life On

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
    }
}