Getting notified when a customer's Stripe subscription payment fails

Hey all - this would cover the scenario where the card works when the user first subscribes but then stops working at some point during the subscription period. Does anyone know of a good way to do that?

I found this: https://stripe.com/docs/recipes/sending-emails-for-failed-payments but not sure whether it can be easily implemented with the Bubble API.

1 Like

The way to you do it is by setting up a webhook in stripe when a payment fails, and then you use an API workflow that sends an email to the user. The way to fetch the data is a bit cumbersome but you can do it. The tricky thing is that stripe sends an event Id, and then you need to go from the event id to the customer id to the Bubble user. But we have the calls to do this. Also, stripe doesn’t guarantee it’ll only hit the webhook once, so you should save the notified events in your database.

The tricky part is that you have one API call inside another, and our interface isn’t great for this yet, but here is the different parts:

2 Likes

With the new API stuff, is this still the correct way solve this problem (when customer’s CC charge fails to email them)?

Yes, the Bubble API (not the API connector) is the way for something from the outside to trigger a workflow. So no change there.

This bubble app was released publicly wasn’t it? I can’t find the url. Does anybody have the link?

Is this still the best way to configure a notification in Bubble when the customers subscription fails?

When I test this I get a 400, is this a 400 from Stripe though? Because i’m using a test event inside Stripe?

image

I know I am a bit late but my webhooks have been failing recently,

they were working beautifully before but now 100% failure rate, should I contact stripe or maybe re-initialize webhooks every now and then it’s the nature of the beast?

Hey, @natserrano,

Did you found a solution for this?

Thanks in advance :slightly_smiling_face: :computer: