Stripe webhooks with subscription-based web app

Hey,

I have a subscription-based web app where I am using only two webhooks with Stripe:

  1. “invoice.payment_succeeded” in one API endpoint
  2. “invoice.payment_failed” in another API endpoint

The first one is for when a user’s invoice succeeds, and each month (subscription renews), it sends an email to the user. The second one is when a user’s invoice fails (insufficient funds, etc.) and sends 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 these cards to try this 1), no subscription is created, and the user is still on the Stripe Checkout. But the invoice.payment_failed is triggered, and in Stripe, it appears that the webhook had a 400 error. I thought “invoice.payment_failed” was triggered if a consequent payment’s charge failed, not the first payment.

So, I have a few questions:

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

I really appreciate any help you can provide. :slight_smile: :computer:

Anyone?

Thanks, @NigelG.

Can you please explain?

The webhooks are not for front-end actions; they are for server-side actions. Stripe talks to Bubble through webhooks.

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