richnologies / ngx-stripe

Angular 6+ wrapper for StripeJS
MIT License
221 stars 75 forks source link

[BUG]TypeError: Cannot read properties of undefined (reading 'redirectToCheckout') at _StripeService.redirectToCheckout (ngx-stripe.mjs:656:24) #263

Open humanely opened 3 months ago

humanely commented 3 months ago

Describe the bug The stripeService is called but in there the "stripe" object is undefined in the following function redirectToCheckout(options) { return this.stripe.redirectToCheckout(options); }

To Reproduce Steps to reproduce the behavior:

  1. Implement this example: https://richnologies.gitbook.io/ngx-stripe/core-concepts/checkout#create-a-subscription
  2. Click on '.Checkout'
  3. Scroll down to '.Inspect'
  4. See error
    core.mjs:6531 ERROR TypeError: Cannot read properties of undefined (reading 'redirectToCheckout')
    at _StripeService.redirectToCheckout (ngx-stripe.mjs:656:24)
    at subscription.component.ts:1457:37
    at switchMap.js:14:23
    at OperatorSubscriber2._this._next (OperatorSubscriber.js:15:21)
    at Subscriber2.next (Subscriber.js:34:18)
    at map.js:7:24
    at OperatorSubscriber2._this._next (OperatorSubscriber.js:15:21)
    at Subscriber2.next (Subscriber.js:34:18)
    at filter.js:6:143
    at OperatorSubscriber2._this._next (OperatorSubscriber.js:15:21)

Expected behavior The redirection should have worked

Desktop (please complete the following information):