I've created one... even though is not updating properly after I get the
successful payment:
onSubmit(form):void{
this.form = form;
this.clearError();
if(form.valid){
this.waiting = true;
Stripe.card.createToken({
number: form.value.card_number,
cvc: form.value.card_cvc,
exp_month: form.value.card_expiry_month,
exp_year: form.value.card_expiry_year
}, this.stripeResponseHandler.bind(this));
}
}
stripeResponseHandler(status, response):void {
if (response.error) {
this.error = 'The card provided is not valid:' + response.error.message;
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// reset the error
const data = {
whatever: this.form.value.whatever,
stripeToken: token
};
this._httpService.enrollCourse(data)
.subscribe(
data => this.handleSuccess(data, this.form),
error => this.handleError(error)
)
}
};
Apart from that you just need to add Stripe.js include in the index.html
On Tuesday, 29 March 2016 06:31:52 UTC+1, Martin Wawrusch wrote:
>
> Looking for one of those (nope, google did not find any).
>
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.