#.suryamani

1 messages Β· Page 1 of 1 (latest)

fringe fiberBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

drowsy spear
#

Hi, please elaborate here

wanton raptor
#

How will i get seesionId in webhook events api code

drowsy spear
#

Please be a lot more specific. What is your current code and which Id you are trying to retrieve?

wanton raptor
#

I need to get sessionID

#

cs_test_a1tSkKtp4snb9C3ZgtNGJmlo1wm3OkeVUy1zQmLFUfnnx5AXKHIh8s85jM

#

like this

#

@drowsy spear Are you there?

fringe fiberBOT
wanton raptor
#

Hii

#

This is my code, I need to retrieve SessionId in Webhook How will i do that?

barren lintel
wanton raptor
#

i need SessionID

barren lintel
#

if you look at the code on that page it shows to create a variable called session and you'll notice a few lines later it calls session.Id, which is the ID you're looking for.

wanton raptor
#

How will i use that id in my code?

barren lintel
#
var sessionId = session.Id;
// code that uses sessionID
// ....
wanton raptor
#

var sessionObj = (Stripe.Checkout.Session)stripeEvent.Data.Object;

            var session = sessionObj.Id;
#

is this format is correct?

barren lintel
#

I invite you to test the code yourself and find out.

wanton raptor
#

I dont get value so only I'm asking this code is correct or not?

barren lintel
#

those two lines you shared are correct in isolation.

wanton raptor
#

var sessionObj = (Stripe.Checkout.Session)stripeEvent.Data.Object;

#

My code doesn't cross this line while debugging

barren lintel
#

Maybe stripeEvent is not a checkout.session.completed event?

wanton raptor
#

I need sessionid on begining

barren lintel
#

not sure what that means. But you can't do anything until you know what type of event you are receiving(that is why you wrote code with multiple if-statements that check the event type πŸ™‚ ) and you can't access a CheckoutSession ID until you actually know it's a Checkout event you are handling.

wanton raptor
#

The event is need to must CheckoutSessionCompleted event or anything else

barren lintel
#

sorry, I can't understand what you're saying("need to must" doesn't make sense to me).

wanton raptor
#

When stripeEvent type is customer.subscription.deleted event then i will get session id or not?

barren lintel
#

You will not.

wanton raptor
#

only on CheckoutSessionCompleted event type will i get sessionid I'm i right?

barren lintel
#

Yes.

wanton raptor
#

Any other way to get sessionId?

barren lintel
#

not really.

#

why do you want it? It should only be relevant at the time you are handling a CheckoutSessionCompleted event and we shared documentation on how to handle that event.

wanton raptor
#

I need SessionId to retrieve some values

valid orbit
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

#

Could you please describe on the high-level what you're trying to achieve?

valid orbit
#

Are you with me?