#dineshkumar6419

1 messages · Page 1 of 1 (latest)

fierce wraithBOT
muted bone
#

hi, any code you can share?

south sage
#

my code was,
switch (stripeEvent.Type)
{
case Events.CustomerSubscriptionUpdated:
{
var stripeSubscription = (Subscription) stripeEvent.Data.Object;
if (stripeSubscription != null && stripeSubscription.Status == "active")// i got error here
{
}
break;
}

muted bone
#

what is the event ID evt_xxx for the webhook event? What version of stripe-dotnet do you have installed?

south sage
#

stripe event ID is "evt_1OnhgNBUmBAZBIgtHcbKkjkH"

#

stripe version is 43.6.0

muted bone
#

the best fix would be to delete the webhook endpoint and create it again and pick "latest API version" when setting it up

south sage
#

sorry i can't understand, please clear me

#

i created latest endpont last week only on stripe dashboard.

muted bone
#

I'd suggest deleting the webhook endpoint and create it again and pick "latest API version" when setting it up

#

not the "default API version"

south sage
#

i am not clear, i wiil again check with my team and document then i will ask anyhelp need.

#

this is latest event from another account please check this , "evt_1OnzvqESdEyRtJkzqmhb95aC"

muted bone
#

what error happens in your code?

south sage
#

i got error, Object reference not set to an instance of an object"

#

same code,

my code was,
switch (stripeEvent.Type)
{
case Events.CustomerSubscriptionUpdated:
{
var stripeSubscription = (Subscription) stripeEvent.Data.Object;
if (stripeSubscription != null && stripeSubscription.Status == "active")// i got error here
{
}
break;
}

muted bone
#

what's the full code, how do you create stripeEvent?

south sage
#

full code is below

muted bone
#

does it work if you do stripeEvent.Data.Object as Subscription ?

south sage
#

here not showing to select api version, i logged in developer role

muted bone
#

and pass true to the second argument to ParseEvent (it would throw an exception for the problem you had which I described above so it's good to do that so you can detect that happening)

south sage
#

not showing me api version selection

muted bone
#

that's because your account's default API version is also the latest version, so it's all good.

south sage
#

so can i create new one again, delete old endpoint?

muted bone
#

if you want. Shouldn't be needed(it's needed on the other account that you first shared).

south sage
#

I deleted and created again it will showing api version is
2023-10-16

muted bone
#

great, so what is your curent problem?

muted bone
south sage
#

i will check this stripeEvent.Data.Object as Subscription

#

can i test this webhook in local machine?

silver haven
#

hi! I'm taking over this thread.

south sage
#

also i should need to pass second argument is true?
var stripeEvent = EventUtility.ParseEvent(json, false);

silver haven
south sage
#

sure, thanks!

#

how to use stripe CLI to listing stripe events in local machine?

silver haven
#

I shared the link that explains how it works. it's something like this stripe listen -f http://localhost:3000/webhooks/

south sage
#

i got error like this

silver haven
#

did you install the Stripe CLI?