Question

I am Using MKStoreKit for autorenewable subscription.

On Button's TouchUpInside method I am using following code..

if([[MKStoreManager sharedManager] isSubscriptionActive:kSubscriptionMonthlyIdentifier]){
  //access to subscription feature
}else{
  //ask user to buy
}

It always returns me false. And ask user to buy.

When I tried to buy again it shows me that You are already subscribed.

  • Is there something that I am doing wrong?

  • Is there any other method to check if subscription is active or not.

  • How should I know that subscription is renewed?

Any help would be appreciated.

Thanks in Advance.

Was it helpful?

Solution

1) You should initialize MKStoreKit by adding [MKStoreManager sharedManager]; in your applicationDidFinishLaunching.

2) You should check, that you correctly fill MKStoreKitConfigs.plist:

you must add your subscriptions in-app ids to Subscriptions dictionary (in format: "subs id" - "subs duration").

In apple documentation you could find info about auto-renewable subs: every renewal of the auto-renewable subscription new transaction would be generated and send to your application. In theory, MKStoreKit must take care about all this stuff, and isSubscriptionActive should work.

Also, you could add button for restoring previous purchases. So, in your case, when user press buy button before calling -isSubscriptionActive call -restorePreviousTransactions, or you can add this button, so user can restore previous transaction^ if he already has bought subscription.

You could add observers for this notifications:

#define kSubscriptionsPurchasedNotification @"MKStoreKitSubscriptionsPurchased"
#define kSubscriptionsInvalidNotification @"MKStoreKitSubscriptionsInvalid"

First notification MKStoreKit generate, when Subscription was renewed (or purchased), second one - when renewing failed.

OTHER TIPS

There is an open issue on the MKStoreKit GitHub that might be related to what you are experiencing. The people in that thread claim that after the app is initialized MKStoreKit always returns NO for isSubscriptionActive. It seems they were able to successfully use a previous release of MKStoreKit, though. You might want to try that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top