angularjs-stripe-element
Easily add Stripe Elements in your Angular.js apps.
Usage
Install from NPM:
npm install --save angularjs-stripe-elements
Include the Stripe.js script in your index.html
From the Stripe website:
To best leverage Stripe’s advanced fraud functionality, include this script on every page on your site, not just the checkout page. Including the script on every page allows Stripe to detect anomalous behavior that may be indicative of fraud as users browse your website.
Add as a dependency of your app
angular
Configure the provider
angular
Inject the provider into a component's controller
It's a configured instance of the Stripe object.
var component = templateUrl: 'templates/payment-form.html' controller: MyCtrl { var elements = StripeElementselements var element = elements element thiselement = element { thiscardErrors = eerror ? eerrormessage : '' }}
stripe-element
element to your template and pass it your Element instance
Add a <!-- a Stripe Element will be inserted here. --> <!-- Used to display form errors --> {{$ctrl.cardErrors}} Submit Payment
Make sure to handle the submission of the form inside your controller
...
ctrl { StripeElements}