1

In the this Article Apple wrote how to enable an auto-renewing subscription from the users point of view. But my question is how to handle this auto-renewing subscription as the developer of an app?

In my app (currently in developing) the user can buy some subscriptions (30 days, 3 months and 1 year) via in-app-purchase. After a successful payment I send the bought item identifier to my server to save the new subscription time (also used for other platforms). This works perfectly in the sandbox-environment.

But if I correctly understand the article the auto-renewing subscriptions is performed from inside the AppStore and inside my app. How can I now track the subscription?

Dumoko
  • 2,614
  • 3
  • 25
  • 34
AlexVogel
  • 10,601
  • 10
  • 61
  • 71
  • WARNING: Please see the comments on the question in this link for why it might be a bad idea to even consider auto-renewing subscriptions. http://stackoverflow.com/questions/7688197/auto-renewing-subscription-differences-to-non-renewing-subscription – Andrew Jan 17 '12 at 20:16

2 Answers2

3

If a subscription is autorenewed, the transaction won't pass the paymentQueue:updateTransactions method. The renew just happens on the Store.

If you want to test for it you have to either:

  • Revalidate the receipt on your application server, if you store the receipt there.
  • Revalidate the receipt on your iOS client

See: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/VerifyingStoreReceipts/VerifyingStoreReceipts.html#//apple_ref/doc/uid/TP40008267-CH104-SW1

In order to avoid testing for an autorenew each launch/activation you should store the endDate of the subscription period to test for a renew afterwards.

Also see: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StoreKitGuide/RenewableSubscriptions/RenewableSubscriptions.html#//apple_ref/doc/uid/TP40008267-CH4-SW4

However, there seems to be a bug in the sandbox. Subscriptions sometimes get renewed, sometimes not. Hard to test....

Steph Sharp
  • 11,462
  • 5
  • 44
  • 81
Rene Berlin
  • 1,171
  • 7
  • 21
  • Also see my answer on http://stackoverflow.com/questions/6526544/storekit-for-ios-subscriptions-question – Rene Berlin Oct 20 '11 at 14:46
  • 2
    +1 Rene has it right. You don't have to `restoreCompletedTransactions` to find out if an auto-renewal occurred. From your server, just send *any* receipt you have stored for that user to the App Store for verification. They will respond with the `latest_receipt` or `latest_expired_receipt` if relevant. – Andrew Dec 06 '11 at 21:07
0

based on the (rather scant) info found in apple's in-app-purchase documentation, my impression is that whenever you need to determine the state of a user's auto-renewal subscription, you would restore their transactions.

this would cause the app store to send all auto-renewal transactions to your app, at which point you would process the receipts and make the appropriate content available.

presumably, you would only need to do this when the user's current subscription (which you can track locally) is set to expire, or when they are first installing the app.

Ivan Vučica
  • 9,529
  • 9
  • 60
  • 111
ilyashev
  • 371
  • 3
  • 14