Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the logic behind auto-renewing subscription in iOS

I'm working with a client to build a newsstand app that uses auto-renewing subscriptions. I can't seem to figure out the correct logic for this. I understand in-app purchases but have never messed with a subscription before.

I can't seem to wrap my head around keeping track of this. It seems Apple wants this as difficult as possible.

I want to have an app that offers a new magazine every month as a single, non-consumable purchase, or allow them to subscribe.

I understand the concept of validating the receipt when the subscription is purchased, but what happens after that? Is the app re-checking the subscription every time it is launched to see if the subscription is current? After the initial purchase, where are the renewal receipts coming from?

I looked into Urban Airship which seems to keep track of this for you - but I didn't find a sample app or tutorial for implementing the subscriptions. Are there other services like this?

like image 393
Brodie Avatar asked May 21 '12 17:05

Brodie


People also ask

Does Apple automatically renew Subscriptions?

They automatically renew at the end of their duration until the user chooses to cancel. Subscriptions are available on iOS, iPadOS, macOS, watchOS, and tvOS.

What percentage does Apple take from Subscriptions?

Apple App Store: 30 percent standard commission on apps and in-app purchases of digital goods and services; sales of physical products are exempt. Subscription commission falls to 15 percent after one year.


1 Answers

I want to have an app that offers a new magazine every month as a single, non-consumable purchase, or allow them to subscribe.

I think Apple created auto-renewable in-app purchases for precisely your situation. The analogy for auto-renewable is magazine subscription where the subscription renews at the end of each subscription period. For example, you might have a one year subscription of NYTimes where at the end of the subscription NYTimes bills you for another year to keep the subscription going.

Similarly, with iTunes auto-renewable, Apple will bill the subscribed users when their subscription expires unless the user unsubscribed before the expiration period. To work correctly, you--the developer--will need to check with iTunes to see if the user's subscription is still valid before granting them access to current months' newsstand content. In other words, you unlock the content after verifying the user's subscription receipt.

You store the user current receipt you get from iTunes somewhere (e.g., NSUserDefaults) after you get it from apple. To verify if the user's receipt is still active, you'd submit the stored receipt to apple for verification.

By the way, you should have a way for users to restore their receipts from your app--in case they have a new device or re-install your app from scratch.

I agree that the documentations from Apple leaves a lot to be desired. It took us a couple of weeks of tedious work to get this working for our app. It looks like other people are spending similar amount of time to make theirs work as well. Hence, take your time or out-source this task if you can't afford to spend the time to learn it.

Take a look at In-app programing guide for a description of how things are supposed to work. The two in-app purchase videos from the 2011 WWDC: "In-app Purchase for iOS and Mac OS X" and "What's New in App Publishing" were somewhat helpful to us as well.

Other helpful links include:

  1. The limited world of auto-renewable subscriptions,
  2. In App Purchases: A Full Walkthrough,
  3. Verifying Apple App Store Receipts For In App Purchases With PHP and cURL and
  4. All About In-App Purchases Part 3: Anti-Piracy Measures.

You will need the code -createEncodedString method in the last link to correctly submit your receipt to a server for verification.

With these links, I hope I have saved you a ton of research and trial and error to get yours working. Good luck.

like image 126
Sunny Avatar answered Oct 21 '22 04:10

Sunny