nomadreservations / ngx-stripe

Angular 8.x wrapper for StripeJS
41 stars 32 forks source link

StripeService missing redirectToCheckout #28

Closed kuncevic closed 4 years ago

kuncevic commented 4 years ago

Currently looking in to it https://stripe.com/docs/payments/checkout/client

So as the docs show you have to use redirectToCheckout to redirect to stripe to process the payment. I can not see the redirectToCheckout method in StripeService

Any thoughts?

kuncevic commented 4 years ago

Just end up using stripe.js directly

Index.html

   <script src="https://js.stripe.com/v3/"></script>

tsconfig.app.json

    "compilerOptions": {
    "types": [
      "stripe-v3"
    ]
  },

stripe.service.ts:

var stripe = Stripe(this.key);
    stripe.redirectToCheckout({
      items: [{sku: this.sku, quantity: 1}],

      successUrl: `${this.getBaseUrl()}/success`,
      cancelUrl: `${this.getBaseUrl()}/canceled`,
    })