Stripe charges the card on a recurring basis for you. Your application isn't responsible for creating new charges for users who have subscribed for your service.
From the docs
Stripe makes handling failed payments easy. Stripe can automatically retry a recurring payment after it fails, and can automatically cancel the customer's subscription if it repeatedly fails. How long to wait, and how many times to retry, can be easily set in your account settings.
I might track a :subscription_active
boolean or similar on my User
model. When a user logs in, you can check against the API to see the status of a user's subscription. The API docs have this to say about the status
of a subscription in the response (emphasis my own):
Possible values are
trialing
,active
,past_due
,canceled
, orunpaid
. A subscription still in its trial period istrialing
and moves toactive
when the trial period is over. When payment to renew the subscription fails, the subscription becomespast_due
. After Stripe has exhausted all payment retry attempts, the subscription ends up with a status of eithercanceled
orunpaid
depending on your retry settings. Note that when a subscription has a status of unpaid, any future invoices will not be attempted until the customer’s card details are updated.
If the response comes back as one of the above bolded states, mark the :subscription_active
to false
for the user. Check user.subscription_active?
wherever you need to conditionally enable features of your application for a user.