bendrucker/angularjs-stripe

promise not be given - .then() undefined

Closed this issue · 3 comments

I am using this on the angle dashboard plugin running anuglar 1.3.10 found at https://wrapbootstrap.com/theme/angle-bootstrap-admin-app-angularjs-WB04HF123 if it is a compatability issue.

I get a successful response from stripe with a created token. But

$scope.charge = function () {
return Stripe.card.createToken($scope.stripeAccount)

   .then(function (token) {
        console.log('token created for card ending in ', token.card.last4);
        var payment = angular.copy($scope.payment);
        payment.card = void 0;
        payment.token = token.id;
        return $http.post('https://yourserver.com/payments', payment);
      })
      .then(function (payment) {
        console.log('successfully submitted payment for $', payment.amount);
      })
      .catch(function (err) {
        if (err.type && /^Stripe/.test(err.type)) {
          console.log('Stripe error: ', err.message);
        }
        else {
          console.log('Other error occurred, possibly with your API', err.message);
        }
      });
  };

and below is the error:

TypeError: undefined is not a function
at f.$scope.charge (http://loc.rvshare.com:8888/panel/app/js/app.js:4016:8)
at $o.functionCall (http://loc.rvshare.com:8888/panel/app/js/base.js:7:10219)
at ra.(anonymous function).compile.n.on.i (http://loc.rvshare.com:8888/panel/app/js/base.js:7:16597)
at f.$get.f.$eval (http://loc.rvshare.com:8888/panel/app/js/base.js:6:1083)
at f.$get.f.$apply (http://loc.rvshare.com:8888/panel/app/js/base.js:6:1309)
at HTMLButtonElement. (http://loc.rvshare.com:8888/panel/app/js/base.js:7:16649)
at HTMLButtonElement.Z.event.dispatch (http://loc.rvshare.com:8888/panel/app/js/base.js:2:14424)
at HTMLButtonElement.Z.event.add.m.handle (http://loc.rvshare.com:8888/panel/app/js/base.js:2:11199)base.js:5 (anonymous function)base.js:5 $getbase.js:6 $get.f.$applybase.js:7 (anonymous function)base.js:2 Z.event.dispatchbase.js:2 Z.event.add.m.handle

I need to see your code.

Not a bug, I was not loading the module correctly.

:)

I made it lowercase on purpose so you can still get at Stripe, the original service.