Reputation: 3847
I have a subscription product that offers users monthly and annual subscriptions without free trials. All the docs I've seen kind of assume that I should know what types of actions to take when a new user subscribes to my service. The Stripe docs on provision and monitor say the minimum events to monitor are:
But then what do after monitoring for these events? In the dj-stripe docs on webhooks there are some clues as to what I should be doing including:
Is there anything else I should consider doing? And how do I know when to do what?
Sorry if these are newb questions but this all just seems really subjective and I am just grasping for some guidance. Of course with dj-stripe I will be adding a lot of info to the database and this is all handled automatically. And of know that I can and should email the user when an invoice is paid or payment failed.
But what about checkout.session.completed
? Why is this a minimum event to monitor for? When a checkout session is completed Stripe redirects the user back to my site so what else should I do? Further, when testing Stripe locally with stripe listen
when a checkout subscription is completed I see the below.
2022-01-03 10:43:13 --> charge.succeeded [evt_3KDtcoKxszORsacj2FQfXUML]
2022-01-03 10:43:13 --> checkout.session.completed [evt_1KDtcrKxszORsacjTw9deAqR]
2022-01-03 10:43:13 --> payment_method.attached [evt_1KDtcrKxszORsacjaXyLietR]
2022-01-03 10:43:13 --> customer.created [evt_1KDtcrKxszORsacj9uw5NaU8]
2022-01-03 10:43:13 --> customer.updated [evt_1KDtcrKxszORsacjRinrFA0W]
2022-01-03 10:43:13 --> invoice.created [evt_1KDtcrKxszORsacjrT6Iqq1d]
2022-01-03 10:43:13 --> invoice.finalized [evt_1KDtcrKxszORsacjCEEjfN1A]
2022-01-03 10:43:13 --> customer.subscription.created [evt_1KDtcrKxszORsacjJoc8bIwy]
2022-01-03 10:43:14 --> invoice.updated [evt_1KDtcrKxszORsacjLWiDYTDN]
2022-01-03 10:43:14 --> customer.subscription.updated [evt_1KDtcrKxszORsacj8dw2DX35]
2022-01-03 10:43:14 --> invoice.paid [evt_1KDtcsKxszORsacjxJzrlZRS]
2022-01-03 10:43:14 --> invoice.payment_succeeded [evt_1KDtcsKxszORsacjzaBHyX6z]
2022-01-03 10:43:14 --> payment_intent.succeeded [evt_3KDtcoKxszORsacj2XHeCjzp]
2022-01-03 10:43:14 --> payment_intent.created [evt_3KDtcoKxszORsacj29ByjaXa]
Are the only actionable events here the invoice.paid
and checkout.session.completed
?
I may be overthinking this but I want to make sure I am doing this right and not letting anything fall through the cracks. Everything I have seen online seems to indicate I should "just know" which events to monitor for based on my business and "just know" what to do. If there is any more clarity that can be provided on what events to monitor for and what needs to be done I'd love to hear it. For reference, if legalese is involved, I am operating in the U.S. and kind of assuming GDPR. Thanks!
Upvotes: 1
Views: 272
Reputation: 7419
The checkout.session.completed
event is only relevant if you're creating the subscription via Checkout -- it would not be emitted if you're creating subscriptions directly via the API.
The exact events that you need to listen to depend entirely on what you want to achieve! While subscribing to invoice.payment_failed
is necessary to handle failed payment recovery yourself, you you might also choose to allow Stripe to handle that for you with automatic recovery.
If you need to take some action in your system with each monthly renewal, then invoice.paid
will be what you want for that, but isn't necessary in the strict sense.
Broadly, Stripe recommends to only subscribe to events that you need to run your business. None are strictly required, but some are commonly used.
If you can expand your question with the context of the actions you need/intend to take in your own system or with your customers, then I can try to recommend which events might be useful for that.
Upvotes: 2