title: Monthly subscription with Firebase
body: <p>I want to implement a monthly subscription thing for my app, but I don't know which approach is the correct one.</p>
  
  <p>This is my structure:</p>
  
  <pre><code>groups
   -groupId
      - premium:true/false
      - owner: userId
  </code></pre>
  
  <p>This should be the flow:</p>
  
  <ol>
  <li><p>User can purchase a subscription for 1 month which will make his selected groupId/premium = true.</p></li>
  <li><p>After one month+grace period, if the user has not paid his subscription, the groupId/premium should change to false.</p></li>
  </ol>
  
  <p>At first I thought I could just check on the android device if his subscription is active, or if it is not, and update the data accordingly. But then what happens If the user never opens his app? Then I cant check, and his group stays premium until he opens the app? I can't have that, because there are other users associated with that group and then they would get a free subscription.</p>
  
  <p>So will I have to do this with a daily cron job running on a appengine server, which will, every day, check which subscriptions reached their end time, and then check if the user associated has paid for it, and update the database accordingly?</p>
  
  <p>That would mean adding more nodes to the database like this.</p>
  
  <pre><code>- groupSubscriptions
    - groupId
      - ownerToken: token
      - expireDate: timestamp
  </code></pre>
  
  <p>and then querying it according to expireDate, grabbing the ownerToken, and checking if they have paid for the IAP.</p>
  
  <p>Is this the correct way to solve my problem? Am I overthinking this? Would it be possible to do without a server? </p>