title: In app auto-renewable subscriptions
body: <p>Sorry for the millionth question about iTunes subscriptions, but I still have a few doubts.</p>
  
  <p>Basically I'm implementing auto-renewable subscriptions in my app and I want to make sure I got it right. Here's a list of steps to take that I came up with:</p>
  
  <ul>
  <li>whenever an user buys a subscription, send the receipt to the server to validate it
  
  <ul>
  <li>if the receipt is valid, save it on the database</li>
  </ul></li>
  <li>on application load, ask the server if a receipt for this UDID exists (this is to figure out if the user has a valid subscription)
  
  <ul>
  <li>if so, check if a new item has been added on the store in a date range from the subscription start date to the expire date
  
  <ul>
  <li>if any, notify the user about those items in some way and mark them as freely downloadable</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>Are these steps correct? And if so, why does the Apple doc say: </p>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>In most cases, your iOS client application should not need to change. In fact, your client application is now made simpler, as you can use the same code to recover auto-renewable subscriptions as you do to recover nonconsumable products. This is described in “Restoring Transactions.”Your application receives a separate transaction for each period of time where the subscription was renewed; your application should verify each receipt separately.</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>To me it looks like this needs some code to handle all the various cases I mentioned, instead. Or I'm totally wrong about it. Am I?</p>
  
  <p>Plus, how do I know about the subscription expiration date? I can't find a way to get this information anywhere. Am I supposed to save this on my own database?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>I've figured out a few things since I posted this question. Feel free to correct me if I'm wrong. </p>
  
  <p>First of all I guess I'm supposed to store the length of the subscription somewhere on my own database, because as stated on Apple's docs, you cannot retrieve it in any way through Apple's web services. In fact, each subscription length has a different product identifier, so you should have a way to convert a product identifier to a subscription length.</p>
  
  <p>Also, Sylvian <a href="https://stackoverflow.com/questions/5329336/in-app-auto-renewable-subscriptions/5426030#5426030">has posted</a> details about his implementation of auto-renewable subscriptions, so at least I know my thinking wasn't too much flawed. </p>
  
  <p>Now the only problem is this: <b>how do I know that an user has a valid subscription?</b> I could store this information on my server, yeah, but how do I associate an user with a completed transaction? Should I save the device's UDID? </p>