#jayy26

1 messages ยท Page 1 of 1 (latest)

limpid currentBOT
opaque siren
vivid pond
#

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 ?

opaque siren
#

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

vivid pond
#

so just update my stripe package?

opaque siren
vivid pond
#

I have version 12..

#

i just upgraded from 12.8.0 to 12.12.0

#

still the same

limpid currentBOT
vivid pond
#

I don't think how i'm initialising stripe affects the typings but here's a snapshot of my stripeConnection file

opaque siren
#

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

vivid pond
#

oh so i cast it as Stripe.Response<Stripe.Customer> ?

opaque siren
#

Yeah try doing const customer = await stripe.customers.retrieve(stripeCustomerId) as Stripe.Customer

vivid pond
#

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

opaque siren
#

is it working now?

vivid pond
#

the error stopped on customer.test_clock but still had to cast it since it's not explicitly as string

opaque siren
#

Yeah, that's how it goes with all the expandable fields

vivid pond
#

yup, thank you Karbi! ๐Ÿ˜„

vivid pond
#

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 ?

steel crow
#

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

vivid pond
#

that's cool! where can i see how to use this "override" ?

steel crow
#

overrides can be tricky with multiple objects involved

#

Let me pull up a good explanation on stack overflow

vivid pond
#

alright ๐Ÿ™‚

steel crow
vivid pond
#

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 ๐Ÿ˜„

steel crow
#

Ah, nice, NP

#

Yes sorry i was going to mention that, but the specific data seemed relevant

vivid pond
#

it's alright! You still showed me the right way ๐Ÿ˜›