#__leak__
1 messages ยท Page 1 of 1 (latest)
Hello
Events will always fire and be sent to your Webhook endpoint whenever they occcur. You can't prevent that. What you need to do instead is write code in your Webhook handler to ignore these Events if they are for a new Subscription as opposed to a renewal.
how can i do that that it only runs the checkout.session.complete when a new user makes a payment
You look at the data that the customer.subscription.updated Events contain and you ignore ingesting that Event if it is for a new Subscription.
For instance, you can use the previous_attributes on the customer.subscription.updated to know why that Event actually fired.
And that information will likely be able to tell you whether it was for a new Subscription or a renewal
Mostly you want to test this out and use test clocks to see the different Events over time (see: https://stripe.com/docs/billing/testing/test-clocks)
ok thank you, i will try it out
๐
when i have a question again with this,do i need to send a new message or can i just write it in this chat
You can write in this same thread unless it is closed (they get closed after a period of inactivity) in which case you can just post again in the main channel.
ok