Service Factory
If you get your stripe key in a lazy way, or if you need to work with more than one key, you can use the factory service.
If you don't know the key just call the forRoot
method with no params
Then you can use the factory service to create stripe instances. The stripe instance has the same api as the regular StripeService.
You need to pass the stripe instance you create with Factory to the ngx-stripe-card component, or any other HTML element
Don't use the StripeService when you work with StripeFactory, use your own instance. Check in the example the function createToken. We call createToken on the stripe instance, not the normal StripeService.
StripeService only works with the public key you pass in the forRoot. If you call forRoot with no key, the StripeService will not work at all
Last updated