Stripe subscription cancellation

Hi, im using webhook to detect what the user do at stripe account level, using endpoints.
i put only subscription_deleted and subscription_updated
What i dont understand is this:
1- How i can detect if is cancellation or update?
2- As update it meant that the user update his subscription (ex th monthly cycle)?

Thanks

I’ll give you a tip in the right direction. Try canceling a subscription in test mode and then head back to your Stripe Dashboard.

From the Stripe dashboard you’ll go to your Event logs and you’ll see the event subscription, open it up and start reading and digest the information.

The same result is sent back to your API on Bubble.

Cancelation and updates are two seperate events.

Yes, and regarding cancelation, it depends on the way you define the cancelation policy on stripe side. Either real-time cancelation (prorated) either cancelation at the end of the billing cycle.

For the update, replicate the plan ID in your bubble database, so that in case of subscription update, you’ll received the new plan ID from Stripe webhook, and you’ll be able to do the necessary stuff in your bubble app (give or remove credentials, access to information, and so on)

Thanks,
The issue i’m having now is: when i got the webhook of cancellation sim not able to check wich user i have to change the state.
Then im using the subscription id to identify the user is it correct?

Thanks when stripe charge the card at the charge time is this considered an update correct?
This mean that the webhook wil lbe invoked
In this case i need to set another endpoint? Or i can use one endpoint for both?
There is no way to emulate a periodic charge without wait 1 day?

You can have only one webhook, and so endpoint, to manage several types of Stripe events. But that would imply a complex workflow with lot of steps and conditionals on Bubble app end. So my recommandation is to have 1 endpoint per Stripe event / webhook. That way, maintenance or evolutions will be easier.

I’m not sure you can emulate periodic charges without a 1 day delay…

Hey! This can be detected using “previous_attributes” of the Stripe webhook - i did a really basic video on how to get this working here: How to unlock secret Stripe webhook attributes in your Bubble app - YouTube

1 Like

Thanks Ben,
your postman seems to be a good start to start as periodic charge < 1 day…
thanks

Thanks Christophe is what im doing now. 1 Endpoint each action. Essentially using subscription i have to catch: cancellation, fail of payment for the cycle and status of subscription.

Sorry but why i get in db a date 1/1/1970 instead of real timestamp sent?

Screenshot(43)

Screenshot(42)