Skip to content
Advertisement

Unable to update database in Stripe webhook

I have a mongodb database tracking if a user has paid through stripe. Once a user pays, I would like to change the database from False to True. However, even though my webhook seems to be working on the Stripe dashboard, the database isn’t updating. Additionally, if I add a print statement it doesn’t print anything.

I am using the test mode on stripe and using Heroku domain for my endpoint. My stripe dashboard indicates that the invoice.payment_succeeded is working normally and is marked as – ‘succeeded’

Here’s my webhook code:

JavaScript

Heroku Logs indicate a 200 on the webook:

JavaScript

Advertisement

Answer

Your question talks about seeing invoice.payment_succeeded events in the dashboard, but your code is handling the invoice.paid event type. If the mismatch was unintentional, your code needs to be updated to handle the invoice.payment_succeeded event type.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement