I am trying to implement Stripe with AngularJS. In a html a introduced their code snippet for checkout:
<form>
<script src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="<pk_key>"
data-amount="100"
data-name="name"
data-description="description"
data-image="img.png"
data-locale="auto">
</script>
</form>
Now, after submiting the checkout form, I expect a token. The checkout form changes my url to something like this:
<path>/?stripeToken=tok_17VlKKLZ8lYIAVgOX7viLFlm&stripeTokenType=card&stripeEmail=mihai.t.pricop%40gmail.com#/
I need this angular to trigger a scope function with this token when the form is submited. How can I achieve something like this ?
$scope.checkout = function(token) {
<do stuff with the token>
}
Thank you.
Stripe offers a "custom integration" of Stripe Checkout. This allows you to launch checkout from javascript and get the token back in checkout.