Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Best practice return status code for stripe webhook application error

In my webhook for checkout.session.completed, I do some validation for the received metadata, i.e. whether an organisation exists. If I do come across an application error, i.e. the organisationId given does not in fact exist, should I be returning a status code of 200 to indicate it has been acknowledged, or should I be returning 400 or 500 to indicate that it has failed?

if (!organisation) {
  // Return 200, 400 or 500?
  return res.status(200).send({ code: 'code', message: 'message' });
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You should return a 200 to Stripe. Otherwise, Stripe will continue to retry sending the event to your endpoint.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading