What webhooks do I need to setup within Stripe when using Bubble’s Stripe plugin?
(I’m using Stripe plugin by Bubble and Stripe Customer Portal plugin by Lantz)
I’ve build an app that allows users to bulk-generate custom email copies via OpenAI.
User needs to subscribe to a monthly plan after which they get 1000 email credits. Meaning, they can generate 1000 email copies within the current subscription period, which is a month. Next month upon successful charge of the card I add another 1000 credits.
I’ve built Stripe integration according to Cranford Tech’s video on Youtube.
When user subscribes to a plan he/she gets is Redirected back to dashboard and I update: subscription status, couple other things and most importantly add 1000 email credits on user balance.
If user cancels the subscription Subscription.Deleted is initialized on Stripe’s end. I have a webhook left in Stripe for such cases. And when it happens I have actions into a BW to update user data.
Although I have set up cancelation part manually, the redirection happens I guess from Customer Portal plugin. Unfortunately neither plugins are documented well enough to know what endpoints are built-in. This causes confusion on my end.
I wonder if I need to setup up a web-hook for the case when the user’s card declines on a second charge. Like imagine I sub the user successfully but the next month card declines.
- Do I have to setup a separate webhook for this or the initial setup for cancelation takes care of this use case too?
- Or what if user’s card expires during the initial month. Do I have to have a separate webhook for it too?
- What are some other use cases I need a webhook set up that I’m not thinking of?
Let me tag some of you OGs here in case you can help!
@NigelG @mikeloc @adamhholmes @rico.trevisan
Thanks in advance
@MattDot is my Stripe expert.
First, there are various ways you can set this up, some of which is contextual to your application.
- At a minimum you need to setup a webhook for successful payment - to push out the expiration date of the account or active flag.
- If a card expires in the middle of the month it doesn’t matter for two reasons. First, in many cases Stripe can automatically update the card/expiration (depending on the issuing bank). Second, it doesn’t even matter until you need to bill the card again. At the next billing cycle you will pick up on the card expiration because the payment will fail.
- You need to setup a webhook for a failed payment / canceled subscription.
The way we setup our events is to capture all webhook events from Stripe and store them so we can always utilise them later if necessary. However, we only process events of certain types. The two types we process are:
This is because our app(s) strictly handle subscriptions. Other things we do with Stripe regularly that you may want to consider (not on the webhook side, but on the application logic) are:
addcoupon - Your offer discounts in the form of coupons
hassubscription - Check to see if the current stripe customer has an active subscription
subscribe - Create a customer and subscription (if no customer/subscription is present)
editcard - Allow the customer to edit their card that is on file
removecard - Allow the customer to remove their card on file
history - Provide a list of invoices to the customer so they can download them from Stripe
cancel - Allow the customer to cancel their subscription
resubscribe - Allow an existing Stripe customer to create a new subscription
updatesubscription - Modify an existing subscription