Stripe webhook 400 error


I have a subscription based app, where I am using two webhooks with Stripe:

  1. invoice.payment_succeeded in one API endpoint
  2. invoice.payment_failed in another API endopoint

The first one is for when a user subscribes correctly and each month sends the user an email.

The second one is when a user’s payment method is declined (insufficient funds, etc…), and also send an email to the user.

When a user tries to subscribe for the first time and the payment is declined (I am using one of this cards to try this), the invoice.payment_failed is triggered, but in Stipe it appears that the webhook had a 400 error. I thought the invoice.payment_failed was only triggered if a consequent payment’s charge failed, no the first payment.

So, I have a few questions:

  1. Is the 400 error really an error or it should be fixed by checking Return a 200 if condition is not met?
  2. What are the most used / correct Stripe events for a subscription based app?

Thanks in advance :slight_smile: :computer:



This topic was automatically closed after 70 days. New replies are no longer allowed.