#blackbearftw_webhooks
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1237854944841826336
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
You have checkout.session.completed but also customer.subscription.created
Have you taken a look at https://docs.stripe.com/billing/subscriptions/webhooks yet?
yeah
If you are using Stripe Checkout then mostly you can just use checkout.session.completed for a Subscription starting and customer.subscription.updated for when it renews or cancels.
That is going to be the easiest way to go
Well not all integrations use Stripe Checkout
But also customer.subscription.created will fire regardless of whether the Subscription's initial payment was successful here
So unless you want to pay attention to every one that was created, you should use checkout.session.completed as that will signal that the initial payment was successful
okay
mhm
https://docs.stripe.com/billing/subscriptions/build-subscriptions
actually uses invoice.payed?
Yeah invoice.paid is another option
but that happens when they renew right?
But I think just using customer.subscription.updated is easier
As that will indicate renewal or a failed payment on renewal
So you can track who you should provision
I would preferable have separate conditions for that
instead of updated and then having to check the status
pressumably
You can do that, but more work really, since invoice.payment_failed will fire on retries as well
Yeah or auto-retries (see: https://docs.stripe.com/billing/revenue-recovery/smart-retries)
how would you recommend then checking if its a cancel
status will change
to canceled?
Yep
Hmm wait actually
I might be misremembering on that -- not positive if we fire customer.subscription.updated in that case or if you explicitly need to listen for customer.subscription.deleted
welp
Yeah looks like I'm wrong and we don't fire customer.subscription.updated in that case
So you do want customer.subscription.deleted for cancellation
oh
okay
uhm
lets say the customer then wants to resubscribe later
what would happen?
would it then just continue with the same subscription
or would you get a new subscription id
trying to figure out how I can validate if a tenant has a valid subscription
and was thinking about setting the subscriptionId to null in our own database
No you can't "restart" a canceled Sub
You would have to create a new Subscription in that case
okay so the above approach would be valid?
Yeah that would work fine if you want to remove their ID from your database upon cancellation and then check based on that
but what about paymend being due?
like
what happens if a payment is not made before the renewal period, will it automatically cancel the subscription at the start of the renewal period?
lets say for example each month
That is based on your billing settings
What you set at https://dashboard.stripe.com/settings/billing/automatic
well we do not offer a trail period
Not sure what you mean.
Cancellation is based on your retry settings
Under Manage failed payments for subscriptions
honestly I should probably just check the status
if its active
allow stuff
if its anything else
Mostly, yes.
but stripes docs mention that subscription.updated is called whenever the subscription is changed right
I guess that would also mean the status
Yes