Reference & Instance

For situations where the module has any mistakes or missing methods (I'm aware it has) you can now access both your elements instance and a reference to Stripe:

import { Component, OnInit } from '@angular/core';

import { StripeService } from 'ngx-stripe';

@Component({
  selector: 'app-stripe-test',
  templateUrl: 'stripe.html'
})
export class StripeTestComponent implements OnInit {

  constructor(
    private fb: FormBuilder,
    private stripeSerivce: StripeService
  ) {}

  ngOnInit() {
    // this is equivalent to window.Stipe, but it make sure the module is loaded
    const Stripe$: Observable<any> = this.stripeService.getStripeReference();

    // this is a reference to the stripe elements object
    const stripe = this.stripeService.getInstance();
  }
}

Last updated