#Shahriyar
1 messages · Page 1 of 1 (latest)
I mean when I write this code I get error that object.id is any but in reality its a string
you need to cast event.data.object as the type you have (e.g. in this case Subscription)
From where do I import Subscription type
const sub_id= (event.data.object as Subscription).id;
import {Subscription} from 'stripe';
which version of stripe are you using?
"stripe": "^11.11.0",
sorry my bad
it's accessible through Stripe
import Stripe from 'stripe';
const sub_id= (event.data.object as Stripe.Subscription).id;
Works now. Thanks