Angular Stripe Checkout
Angular 2+ component for Stripe's Checkout feature.
You can install the package with the following command:
npm install ng-stripe-checkout
1. Import the
This is typically done in your
2. Inject the StripeCheckoutLoader
Wherever you need to utilize Stripe Checkout, inject the service
StripeCheckoutLoader in your constructor.
3. Create a Stripe Checkout handler
The Stripe Checkout handler is essentially a readily configured Stripe Checkout window, prepared to open when you need it.
createHandler method takes the configuration options you know from the Stripe Checkout documentation. Required options are:
4. Open the Stripe Checkout window to begin payment flow.
Finally, you may trigger
open somewhere in your code, to open the payment window.
open method takes the Stripe Checkout configuration options again, but this time
token are not required.
Use this to set amount, user's email and other things that might change from each time the window is opened.
After payment, the
token callback will be triggered (see step 3 above).
New in 1.0.4
The open method now returns a promise, while still being fully backwards compatible. Using the promise handlers lets you simplify your code, as you don't have to configure separate callback functions to receive the token.