#jayy26
1 messages ยท Page 1 of 1 (latest)
When you get the customer.subscription.created event you can check if schedule is included on the subscription (https://stripe.com/docs/api/subscriptions/object#subscription_object-schedule)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ooo Thanks!
one more question..
const customer = await stripe.customers.retrieve(stripeCustomerId)
customer.test_clock // this returns the following error:
/**
Property 'test_clock' does not exist on type 'Response<Customer | DeletedCustomer>'
**/
why doesn't this provide the correct type ?
If you're using TypeScripe then it's likely that you're on an older version that doesn't include test_clock in the Customer type
so just update my stripe package?
Yeah you'll want a version after 8.206.0 (https://github.com/stripe/stripe-node/blob/v12.12.0/CHANGELOG.md#82060---2022-03-01)
I don't think how i'm initialising stripe affects the typings but here's a snapshot of my stripeConnection file
Ahhh... I think the issue may be that you need to eliminate the possibility it's a deleted customer - DeleteCustomer probably doesn't have test_clock but Customer does
oh so i cast it as Stripe.Response<Stripe.Customer> ?
Yeah try doing const customer = await stripe.customers.retrieve(stripeCustomerId) as Stripe.Customer
now it yells as me that test clock is not a string ๐คฃ
i'll cast that one too i guess since i'm not expanding it
is it working now?
the error stopped on customer.test_clock but still had to cast it since it's not explicitly as string
Yeah, that's how it goes with all the expandable fields
yup, thank you Karbi! ๐
Is there a way i can trigger an event with stripe CLI but let it take data from actual places?
like for example i want to re-send a webhook event to log some things .. the event is customer.subscription.created
how can i go about that without having to replay the scenario with test-clocks ?
You can override values using stripe trigger or create you own "fixtures" depending on the compelxity of what you want to set
But for complex flows, honestly a test script is likely easier
that's cool! where can i see how to use this "override" ?
And fixtures: https://stripe.com/docs/cli/fixtures
overrides can be tricky with multiple objects involved
Let me pull up a good explanation on stack overflow
alright ๐
Oooo there's this>> stripe events resend
i think that would work for my case
Yeah i just tested the resend, it does re-trigger the webhook ๐
much much easier than scripts & over riding since i only want that specific event to check something with the flow i have
Thanks Synthrider ๐
Ah, nice, NP
Yes sorry i was going to mention that, but the specific data seemed relevant
it's alright! You still showed me the right way ๐