#Shahriyar

1 messages · Page 1 of 1 (latest)

rotund vesselBOT
haughty olive
#

👋 happy to help

#

what is your question?

cinder trellis
#

I mean when I write this code I get error that object.id is any but in reality its a string

haughty olive
#

you need to cast event.data.object as the type you have (e.g. in this case Subscription)

cinder trellis
#

From where do I import Subscription type

haughty olive
#

const sub_id= (event.data.object as Subscription).id;

#

import {Subscription} from 'stripe';

cinder trellis
haughty olive
#

which version of stripe are you using?

cinder trellis
#

"stripe": "^11.11.0",

haughty olive
#

sorry my bad

#

it's accessible through Stripe

#

import Stripe from 'stripe';

#

const sub_id= (event.data.object as Stripe.Subscription).id;

cinder trellis
#

Works now. Thanks

haughty olive
#

yes sorry about that

#

let me know if you need any more help