Comments (12)
First off, thanks for picking angular-stripe. You made the right choice 😄
Please format your code using the correct GitHub Flavored Markdown syntax in the future so I can read it more easily.
That error would seem to indicate that window.Stripe
isn't available. Could you verify that it is? Also, if you upgrade to the latest (4.2.0), I've added an explicit exception when Stripe is undefined.
from angularjs-stripe.
Thank you for your quick reply. And in the future I will try to use the markdown syntax.
Using angular-payment, it didn't complain about window.Stripe unavailable.
So I figured that just changing from angular-payment to your angular-stripe would be enough.
I will look into if upgrading solves the problem.
I will let you know.
from angularjs-stripe.
Using angular-payment, it didn't complain about window.Stripe unavailable
That's a bug. Upgrading will throw a better error. If Stripe isn't available and the library doesn't say so, you can end up with obscure bugs and error messages in production if Stripe doesn't load or you forget to include the script from their CDN.
from angularjs-stripe.
Okay, I don't get this at all obviously.
In index.html I do
<script src="https://js.stripe.com/v2/"></script>
Without including anything else neither your angular-stripe or other things, just to verify that connection towards stripe.com is established, what more needed to do a successfully create token?
I include the 'stripe' directive below in the controller...
angular.module('stripe', []).directive('stripeForm', ['$window',
function($window) {
var directive = { restrict: 'A' };
directive.link = function(scope, element, attributes) {
var form = angular.element(element);
form.bind('submit', function() {
var button = form.find('button');
button.prop('disabled', true);
$window.Stripe.createToken(form[0], function() {
button.prop('disabled', false);
var args = arguments;
scope.$apply(function() {
scope.$eval(attributes.stripeForm).apply(scope, args);
});
});
});
};
return directive;
}]);
from angularjs-stripe.
No idea what you're doing here. That directive is not from here. The reason I created angular-stripe in the first place was to offer a better alternative to the awful habits the author of stripe-angular encourages (that's where the snippet above is from, not here).
Check out the example. Build your form the Angular way using ng-model.
It sound like you're asking for help implementing stripe-angular which I'm not willing to do. Nothing personal here and I totally get if you're on a deadline and need to get something quick and dirty working.
from angularjs-stripe.
Okay, I'm sorry if I gave you the wrong impression.
The thing is, I really want to implement your angular-stripe, not stripe-angular. But I just tested that as well to try to understand what is really needed to get things up and running with Stripe.
What I don't understand is that I get both stripe-angular and angular-payments to work, but I cannot include angular-stripe without getting an include error:
Failed to instantiate module angular-stripe due to:
Error: Stripe must be available as window.Stripe
at new stripeProvider (http://localhost/lp/bower_components/angular-stripe/release/angular-stripe.js:253:22)
I have now upgraded to latest angular-stripe, version 4.2.0.
I feel I'm missing something that should be obvious, but I just can't get my head around it...
I really hope you can help...
from angularjs-stripe.
As you see, you were correct from the beginning, window.Stripe is not available.
You asked me to verify that it is, but how do I do that and how can I make it available?
As I mentioned, I include stripe in my index.html
<script src="https://js.stripe.com/v2/"></script>
Is there anything more needed?
And a comment to improve your Examples (which really is just one example).
It would be great if you could provide a simple working html form to go with that controller.
Then later you can point to your angular-credit-cards for those who want to use that for validation.
I really think that would improve your documentation a lot.
from angularjs-stripe.
Okay, I figured it out.
I was including angular-stripe before js.stripe.com in my index.html.
Swapping places solved the problem.
That should probably also be mentioned in your readme.md file , to include angular-stripe after js.stripe.com.
I guess obvious for some people, but clearly not for all, me included.
I rest my case for now, and will see what the future brings when trying to implement and use angular-stripe.
from angularjs-stripe.
That should probably also be mentioned in your readme.md file
996b0fd is the most I'm willing to do. I'm not interested in writing documentation based on the use of <script>
tags since I want to do everything possible to convince people to stop building applications like that.
It would be great if you could provide a simple working html form to go with that controller
An HTML form is out of scope — that's precisely what's wrong with the various other Angular/Stripe integrations. angular-stripe has no defined relationship with your forms (as it should be). This is a one line library. You just pass it data and it gives you a promise instead of taking a callback. That said, I'm committed to working on a generalized angular-stripe + angular-credit-cards + angular-form-state example project this weekend #12 (comment).
from angularjs-stripe.
Jumping in here @bendrucker, curious how that example project is going? I'm transitioning over from using the angular-payments library (which makes different scope very hard to work with). Would love to see a generalized example of your libraries.
from angularjs-stripe.
https://github.com/bendrucker/angular-payment
Code's mostly there, I just need to start hooking up a bunch of directives so you can run the app, see the states of the form controls, and see the calls being made. When the UI is done I'll put it live on GH pages and start writing docs.
In the mean time, as noted in the readme, I'm happy to answer general how-to questions in angular-payment's issues.
from angularjs-stripe.
Sounds good, I'll have a look. Looks like your libraries are definitely the most actively developed—thanks for all of the work you do!
from angularjs-stripe.
Related Issues (20)
- npm install angular-stripe doesn't build angular-stripe.js HOT 1
- Card type when user finished to add the Card Number HOT 1
- Card formatting, unable to press the backspace/delete key to edit this field HOT 1
- how to use this library into webpack+angular2+typescript project HOT 2
- Stripe v3 HOT 4
- piiData undefined HOT 1
- Version 5.0.0 doesn't export main javascript file in .bower.json HOT 1
- 5.0 change log HOT 1
- stripe.card.validateCardNumber not working
- Support with Stripe v3 HOT 1
- v5 doesn't include bower.json export of release/angular-stripe.js HOT 1
- release folder and js not included in NPM HOT 1
- Support for stripe.js v3 paymentRequest method HOT 4
- [gdpr] [lazy-load] Conditionally include Stripe.js HOT 4
- Facing an Issue in integrating angular-stripe HOT 1
- Action required: Greenkeeper could not be activated 🚨
- promise not triggered back while created token anuglar-stripe.js
- This is AngularJs not Angular HOT 1
- [question] Seems there is no possibility to set apiVersion?
- The naming of the library is misleading HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angularjs-stripe.