Integrating stripe

Hi, i’m trying to build a monthly subscription app and i found that i can use Stripe. I’m trying to use this tutorials
and at some point i need to declare var StripeCheckout:any; in typings.d.ts. Can some explain what is typings.d.ts and how i can solve this issue?
(if i try to do it without it’s just going to say Cannot find name ‘StripeCheckout’.)

this.handler = StripeCheckout.configure({
      key: environment.stripeKey,
      locale: 'auto',
      token: token => {
        this.paymentSvc.processPayment(token, this.amount)


My guess is that u actually need to declare that var in the file of component where it is used (outside class definition)

Essentially Typescript needs to know what type of variable it is loading. For packages that don’t have explicit typing, adding StripeCheckout: any will type it as any and will let you use any method/variable with it. Just be careful with typos on those methods and variables.

More here:

1 Like