#tudor_ang
1 messages · Page 1 of 1 (latest)
hello
Hello! We can't provide code reviews here, but I'm happy to answer specific questions about specific parts of this code if you have them!
sure
ok so here is my flow on account creation i also create a customer on stripe
i am building a saas app where users have premium
so on customer.subscription.created i give the user premium
but when he renew the subscription what event should i handle?
when he pays automaticaly the subscription
ps above is my code
There are various options. Have a look through the Subscription-related Events here for the ones you might want to listen for: https://stripe.com/docs/billing/subscriptions/overview#subscription-events
yeah i was there but i am not sure about what to handle
so thats why i made this ticket
you have some minutes?
The ones you listen to depend on your use case, business needs, etc. There's not a general list of ones to listen to that works for everyone.
i need the event that is triggered with stripe automaticaly charge my clients
my product is a subscription that is charged monthly
There are several Events you can listen to for that. invoice.paid is one of them, for example.
ok but if the paymenth fails?
A Subscription will generate an Invoice for each period.
so lets say the user dont have money on card
we listen for invoice.payment_failed
?
right
Then you would get invoice.payment_failed, yeah.
You can use Stripe CLI to trigger Events, yeah: https://stripe.com/docs/cli/trigger