Stripe subscription webhook events problem

38 views
Skip to first unread message

MALIK forz

unread,
Feb 22, 2022, 11:24:36 AM2/22/22
to Stripe API Discussion
Hello   i am using stripe subscriptions checkout and  i followed the guide  here  https://stripe.com/docs/billing/subscriptions/build-subscription?ui=checkout
But   the webhook doesnt seem to work properly  as  when a customer subscribes for the first time   it should trriger onley the event of checkout session completed .  nothing more . 
But  the problem is that  it keep trigering the event of invoice.paid   which something i didnt understand why it is happening  .
it seems that stripe send the event checkout.session.completed:  receive a 200 response.
then send invoicee.paid ....... which triggers it .
 can you help me please     i need an answer asap  thank you  

Remi J.

unread,
Feb 22, 2022, 11:28:42 AM2/22/22
to api-d...@lists.stripe.com
Hello,

When a Subscription is created via Checkout, it will trigger all relevant events for a Subscription, not just the Checkout ones. The behaviour you described is expected behaviour.

If you don't care about `invoice.paid`, then you need to configure your webhook endpoint to only listen for `checkout.session.completed` and ignore all the other events. If you care about that event then you need to invoice the first one related to the Subscription creation since you will handle this via the Checkout event. One solution would be to look at `billing_reason` on the Invoice [1] and ignore the event if it's set to `subscription_creation`.

I hope this helps, but if you have any follow up questions, please contact our support team directly: https://support.stripe.com/contact
Best,
Remi


--
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
Reply all
Reply to author
Forward
0 new messages