#Ema.subscription-events

1 messages ยท Page 1 of 1 (latest)

onyx needle
gray estuary
#

Hello ynnoj! I fixed my webhook doubt for the question I initially submitted, and proceeded to create a webhook that executes successfully. I'm still doubtful about at which part of the transaction I should save the subscription in the database

#

I don't think these requests are ordered since I see payment_intent.succeeded before creation?

#

Also, I'm on MERN stack!

onyx needle
#

If this is to provision access to your product/service, you'd likely be best of listening to the invoice.* related events to act accordingly

gray estuary
#

Yes, it's about provisioning access, so I want to make sure people get access to the service once the payment is successful

#

Also would you have any insight about how to cancel subscriptions when managing them through Stripe? Is there any specific event I should listen for?

#

I'm sorry for the beginner questions but I recently started as a software engineer and this is my first exposure to Stripe!

onyx needle
gray estuary
onyx needle
#

Np! Let me know if something isn't clear

gray estuary
#

I have noticed your very well designed dashboard handles cancelling subscriptions, renewing them, switching tiers and more, but how would this connect to my app's backend?

#

And is there any way to set some extra headers for the requests I send to the webhook? e.g. I want to have the UID of the user that is doing things with their subscriptions so that I can perform operations on the related document in my DB (like setting the flag)

onyx needle
onyx needle
onyx needle
gray estuary
#

Yes, the customer portal!

#

my apologies :p

onyx needle
#

You'd just listen for the corresponding events that the action in the Customer Portal would trigger

gray estuary
#

so the customer portal still fires back to my webhook and triggers the events?

onyx needle
#

Yep, exactly

gray estuary
#

Last question, and I'm sorry for asking so many!

#

I've seen that accessing the customer portal takes a Checkout Session ID, how would I approach getting to the customer portal without a checkout session? Like, the customer is in their personal area on my website and they want to access stripe settings

onyx needle
#

But yes, you'll need to generate one via your server and return the URL to your app to redirect the user

gray estuary
#

I think checkoutSession just makes it so that the API pulls the customer ID on its own?

#

so I could just pass the customer ID

onyx needle
#

Hmm, I'm confused. You keep mentioning Checkout?

gray estuary
#

if you go to server/node/server.js, you'll see the code I'm referring to.

onyx needle
#

Ah, the customer ID

#

You said Checkout Session ID and it confused me ๐Ÿ˜†

#

Yep, if you have the Customer ID from elsewhere then you can just pass that. Not need to fetch a Checkout Session

gray estuary
onyx needle
#

Sure, np!