Actaully i'm planning to create a SaaS and i was searching for a payment processor and i've found Stripe.
I read how to create a suscription method and all about it but i don't have idea how to check if the suscription no have been paid out automatically.
I explain:
With stripe suscription api: stripe.subscriptions.retrieve i can get the information of the suscription and the api return a status in a json and that's the way to check if the user have been paying, but my question is:
¿How can i do this automatically?
I will use a firestore as my database and firebase cloud functions but i don't know how to do this task automatically? or there other form to do this?
If this could be done, when user access to SaaS and the suscription expired, i can check in the database and deny the access.
Other form that i had thought, was to check every time the user enters and i think that could works but if the user not log out or if the not access, some functions like push notifications or other internal functions will follow working.
Thanks for you support.
Webhooks is the answer here. Specifically for when a subscription's invoice is paid, you'll want to listen for the invoice.payment_succeeded webhook.