2

I am building an app that offers a 30-day subscription to premium services in the app. I am familiar with in-app purchases (consumables) and have everything setup up for that. However, I haven't found any good tutorial or explanation of what the proper procedure for validating auto-renewable subscriptions.

Can anyone point me in the right direction? What I would like to do is have the subscription setup like this:

  • User purchases in-app subscription and is verified
  • Subscription End-Date (30 days from purchase) is added to network database with user's account info
  • How to detect when the subscription is renewed so I can update the network database

UPDATE

So I have figured out the original purchasing and receipt verification, so all good on that. Then getting expired date by getting the value of 'expires_date' from the receipt data.

What I need to accomplish now is the best way to check for ALL completed transactions on app load (including any auto-renewed subscriptions) so I can unlock premium services. Using 'restoreCompletedTransactions' allows me to receive old receipt data, but it forces the user to enter a password, and I would like to avoid this. What are the alternatives?

JimmyJammed
  • 9,598
  • 19
  • 79
  • 146

1 Answers1

1

a user purchases a product and you save the receipt. keep track of a timestamp so you know how long the subscription is valid for. on each launch you validate the receipt. you will always get the latest receipt so you know whether the product was renewed. using the timestamp you can make sure the user doesnt get access after their subscription has cancelled.

Joris Weimar
  • 4,783
  • 4
  • 33
  • 53
  • Yes that is the basic concept. The problem is, how can I get the receipts from the app store without forcing the user to re-enter their iTunes account password? Using 'restoreCompletedTransactions' to get completed transactions/receipts forces the user to re-enter their password (as if they were buying something) – JimmyJammed Mar 11 '13 at 20:11
  • 1
    You store the receipt (for example in the NSUserDefaults). you then pass this as JSON to the receipt validation server. see http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html. this will not prompt the user for their password. – Joris Weimar Mar 12 '13 at 09:43