title: How to make a Stripe subscription status go from trialing to cancelled if there is no card?
body: <p>We let our customers do a 30 day free trial using Stripe subscriptions. We want the trial period to last exactly 30 days. If the subscription status is <code>trialing</code>, <code>active</code> or <code>past_due</code> then the customer can use our service.</p>
  
  <p>If the customer has moved out of the trial period and has been paying and for some reason their card is no longer good then the subscription status goes from <code>active</code> to <code>past_due</code>. And the subscription status is <code>past_due</code> for 15 days (dictated by our retry settings). In other words, if they have been a paying customer and their card is not good when their monthly payment is due, then they can still use our service for an additional 15 days while they fix their card.</p>
  
  <p>If the 30 day trial period ends and there is no card then the status moves from <code>trialing</code> to <code>active</code>. And then 3 minutes later the status goes from <code>active</code> to <code>past_due</code>. And then the status stays <code>past_due</code> for 15 days - essentially making the trial period 45 days. We don't want that; we want the trial period to only be 30 days.</p>
  
  <p>How do we not allow those 15 extra days?</p>
  
  <p>I would think that there would be a setting to make the subscription status go from <code>trialing</code> to <code>cancelled</code> in this situation so that it is easy to set the trial period length given the way we have it setup above. But this setting does not appear to exist.</p>
  
  <p>So do I need to manually cancel the subscription when I detect(via webhook) the <code>trialing</code> to <code>active</code>, and then 3 minutes later <code>active</code> to <code>past_due</code>? I would store the datetime in my database when it goes from <code>trialing</code> to <code>active</code>. And then when it goes from <code>active</code> to <code>past_due</code>, I would check to see if that stored datatime was say less than 15 minutes ago - and if it is then I know I have a trial period that ended without a card and I cancel the subscription. Or is there a simpler way to do it?</p>