#blackbearftw_webhooks

1 messages ¡ Page 1 of 1 (latest)

shrewd tangleBOT
#

👋 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.

faint shoal
#

Hello

rich nacelle
#

You have checkout.session.completed but also customer.subscription.created

faint shoal
rich nacelle
#

yeah

faint shoal
#

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

rich nacelle
#

but then what is customer.subscription.created for?

#

that confuses me

faint shoal
#

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

rich nacelle
#

okay

#

mhm

faint shoal
#

Yeah invoice.paid is another option

rich nacelle
#

but that happens when they renew right?

faint shoal
#

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

rich nacelle
#

I would preferable have separate conditions for that

#

instead of updated and then having to check the status

#

pressumably

faint shoal
#

You can do that, but more work really, since invoice.payment_failed will fire on retries as well

rich nacelle
#

what do you mean retries?

#

when a customer tries to pay again and it fails again?

faint shoal
rich nacelle
#

ah

#

mhm

#

so generally just use customer.subscription.updated

#

alright

faint shoal
#

That's what I recommend.

#

You can look at previous_attributes to tell what happened

rich nacelle
#

how would you recommend then checking if its a cancel

faint shoal
#

status will change

rich nacelle
#

to canceled?

faint shoal
#

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

rich nacelle
#

welp

faint shoal
#

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

rich nacelle
#

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

faint shoal
#

No you can't "restart" a canceled Sub

#

You would have to create a new Subscription in that case

rich nacelle
#

okay so the above approach would be valid?

faint shoal
#

Yeah that would work fine if you want to remove their ID from your database upon cancellation and then check based on that

rich nacelle
#

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

faint shoal
#

That is based on your billing settings

rich nacelle
#

well we do not offer a trail period

faint shoal
#

Not sure what you mean.

#

Cancellation is based on your retry settings

#

Under Manage failed payments for subscriptions

rich nacelle
#

honestly I should probably just check the status

#

if its active

#

allow stuff

#

if its anything else

faint shoal
#

Mostly, yes.

rich nacelle
#

but stripes docs mention that subscription.updated is called whenever the subscription is changed right

#

I guess that would also mean the status

faint shoal
#

Yes