3

I need to build an app for a system, which already has a subscription on its website. It looks like Apple doesn't allow to use any own subscriptions and forces to integrate any app with iOS in-app subscriptions.

Is it any way to integrate two subscription systems? The main problem is that users can manage iOS subscriptions via iTunes and I can't find whether it's possible to get information about this and to stop subscription in the existing system if it's stopped via iTunes.

So is it possible to get notifications about unsubscribed iTunes users?

Dmitry Khryukin
  • 6,408
  • 7
  • 36
  • 58

2 Answers2

5

Using third party subscriptions

First off, it is possible to support an existing subscription system in your app, but it must be in addition to the App Store subscriptions. Also you have to be very careful about the UI you use. You can't prompt users to bypass the App Store and purchase through your server, but you can offer existing subscribers the ability to sign in with credentials they may have previously obtained through your website.

That said, Apple can be fairly capricious in their rulings on what is and isn't allowed in the App Store. I have worked on apps that have done this sort of thing, but they have been for fairly well known magazine publications. There's no guarantee that they will allow it for everyone.

Detecting unsubscribed App Store subscriptions

As for using App Store subscriptions, when a user purchases a subscription in your app, they will receive a receipt in the SKPaymentTransaction object. This receipt should be posted to your backend server to make sure it is valid before you give the user access to anything. See the In-App Purchase Programming Guide for more details.

When you setup a subscription type, you specify how long that subscription lasts. So if you log the transaction date in the SKPaymentTransaction when you receive a receipt, you can determine exactly when that subscription should expire by adding the duration of the subscription to the transaction date.

If it's an auto-renewing subscription, you will receive a new receipt when the subscription is renewed. So once you have validated that with your backend server, you can update your expiry date based on the new transaction date. If you don't receive a new receipt before the first one expires, it's likely the user has cancelled their subscription.

On the backend, your server can also tell when a particular subscription will expire based on the response from the verification server. First there is the status code which will tell you whether the subscription has already expired, but there is also an expiry date returned in the decoded receipt which will tell you when it is expected to expire if it hasn't already.

For more details, see the Auto-Renewable Subscriptions documentation.

Testing auto-renewing subscriptions

It's worth noting that when you are testing auto-renewing subscriptions in the App Store sandbox environment, the length of the various subscription types is dramatically shortened to make it easier to test. For example a 1 week subscription lasts only 3 minutes in the sandbox environment. You can see the full list of times in the iTunes Connect Developer Guide.

James Holderness
  • 22,721
  • 2
  • 40
  • 52
  • thanks. actually it's what I was thinking about, but couldn't formalize. In addition: I've found a great example of such kind of integration - http://www.nytimes.com/ and associated iOS app – Dmitry Khryukin Aug 05 '13 at 04:35
2

So you want the people that have bought the service from the website to be able to use the app, exactly like if they had purchased it from in App Purchases and in App Purchases people to be able to join the service just like people that joined through the site? As far as I know, Apple doesn't allow you to pay through other services as you said, but let's say someone buys the service from the app. What should happen would be that the money will be transferred to the company. Then after the payment you should include some code doing what the site does after a new person has payed for the service, so create his account as a paid account. Then, the app should also have a login screen where the registered users (no matter where they registered from) will be able to login into the app and use the service. Now the problem is indeed that if the subscription is stopped through iTunes you would never know, though a way around this would be to make a check in the server of this company which should monitor the income coming from one account. Then if this user has stopped paying (or stopped the subscription) you would be able to stop the service from the app. And you should recheck the server for payment after the duration of the subscription has passed, let's say a weekly subscription should be checked every week. (Sorry I would do this a comment but I haven't got enough reputation for this)

isklikas
  • 190
  • 2
  • 16
  • how can I check payments, which are done through Apple system, automatically? – Dmitry Khryukin Aug 04 '13 at 09:12
  • @DmitryKhryukin Well it's rather simple, right after the in App purchase you can obviously run some code. There you would either create an account as I suggested or/and edit a BOOL variable that is by default FALSE, which will be located in a plist and the app will read from this plist. You will then make it to change this BOOL to TRUE so the app will be able to check automatically. If you were referring to check if the subscription is still active, I wasn't referring to Apple's servers, I was referring to the company server which will (and should) log the transactions for each account. – isklikas Aug 04 '13 at 09:30
  • @DmitryKhryukin now if you spot in the company's server that the customer hasn't paid after the duration of his subscription has passed, then you know that his subscription is over. You should also have an NSDate check, which will check the date of the event and measure the interval from the expiration date. If this is negative or zero, then you should check the company server for this account set the BOOL to FALSE and only if a transaction has occurred recently that makes the subscription valid till a later day, make the BOOL TRUE again and validate the account as purchased again. – isklikas Aug 04 '13 at 09:37
  • 1
    @DmitryKhryukin as a person with a rep. Of 350 said, "there's no way to say when the subscription expires. you have to watch that on your server and application has to ask the user to renew the subscription. there's also no way to check whether current device has active subscriptions other than log it on your server and ask your server each time. everything with these subscriptions is just frustrating." why? Because Apple has almost no API for this, In app purchases are just a transaction medium – isklikas Aug 04 '13 at 09:38