├── README.md ├── bower.json └── stripe-angular.js /README.md: -------------------------------------------------------------------------------- 1 | # Stripe Angular [](http://badge.fury.io/bo/stripe-angular) 2 | Angular directives to deal with [Stripe](https://stripe.com/). 3 | 4 | ## Setup 5 | 1) Install `stripe-angular` with bower 6 | ``` 7 | bower install stripe-angular 8 | ``` 9 | 10 | 2) Include `stripe.js` and this module in your page 11 | ```html 12 | 13 | 14 | 15 | ``` 16 | 17 | 3) Set your Stripe `publishable API key` 18 | ```js 19 | angular.module('myApp', ['stripe']) 20 | .config(function() { 21 | Stripe.setPublishableKey('your-publishable-key'); 22 | }) 23 | ``` 24 | 25 | ## Directives 26 | List of available directives (only one at the moment :grin: ): 27 | 28 | ### `stripe:form` 29 | It abstracts what you would be doing manually as described in [https://stripe.com/docs/tutorials/forms](https://stripe.com/docs/tutorials/forms) to create a `single-use token`. 30 | 31 | ```html 32 |
41 | ``` 42 | 43 | The `saveCustomer` function or whatever function you set as a value for the `stripe:form` attribute is the form's response handler - the Stripe API docs refer to this as the `stripeResponseHandler`. 44 | 45 | You can now do whatever you want with the response, like sending the `single-use token` to your server to [complete a charge or save the payment details for later](https://stripe.com/docs/tutorials/charges). 46 | 47 | ```js 48 | angular.module('myApp', ['stripe']) 49 | .controller('IndexController', function($scope, $http) { 50 | $scope.saveCustomer = function(status, response) { 51 | $http.post('/save_customer', { token: response.id }); 52 | }; 53 | }); 54 | ``` 55 | 56 | ## License 57 | This is licensed under the feel-free-to-do-whatever-you-want-to-do license. 58 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stripe-angular", 3 | "main": "stripe-angular.js", 4 | "version": "1.0.2", 5 | "homepage": "https://github.com/gtramontina/stripe-angular", 6 | "description": "Angular directives to deal with Stripe.", 7 | "keywords": [ 8 | "angular", 9 | "ng", 10 | "stripe" 11 | ], 12 | "ignore": [ "README.md" ], 13 | "authors": [ 14 | "Guilherme J. Tramontina