#shubhamjha

1 messages · Page 1 of 1 (latest)

trim cloakBOT
junior tapir
#

Hi there

crude dome
#

hloo

junior tapir
#

This happens because the Subscription is first created in a status of incomplete in order for the Checkout Session to be able to be completed.

#

Then once the payment is successful the Subscription moves to a status of active

#

And that causes that webhook to fire

crude dome
#

how can i stop it ?

junior tapir
#

You can't

#

You just ignore it in your webhook handler

#

Just return a 200 and don't action that Event

crude dome
#

how can i do it please explan

junior tapir
#

Well what are you doing in your webhook handler right now when customer.subscription.updated fires?

crude dome
#

problem is that when i do a payment for new subscription by chekout it will first call customer.subscription.updated and after chekout session complete event

junior tapir
#

That is fine

#

You just want to handle the checkout.session.completed event, right?

crude dome
#

yes

junior tapir
#

Like in your webhook handler code you can basically just say "do nothing" with the customer.subscription.updated event

crude dome
#

why it will call customer.subscription.updated this event when i just need checkout.session.completed even

junior tapir
#

Because your webhook endpoint is listening for that event

#

All events will always be sent to your endpoint if it is a type that the endpoint is listening for

crude dome
#

but i have use the break for every event

junior tapir
#

Sure so the event still hits your endpoint but you just don't action it if you call break immediately after receiving that event type

crude dome
#

yes