Last active
August 29, 2015 14:01
-
-
Save namlet/242ceca8b6a4a018879f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var handler = StripeCheckout.configure({ | |
key: '*****', | |
//image: '/square-image.png', | |
token: function(token, args) { | |
// Use the token to create the charge with a server-side script. | |
// You can access the token ID with `token.id` | |
console.log(token); | |
console.log(args); | |
var pkg = {'token':token, 'args':args}; | |
$.post('/stripe/charge', pkg, function(data){ | |
console.log("RETURN from server"); | |
console.log(data); | |
location.href = "thankyou.html"; | |
}); | |
} | |
}); | |
$('.btn-buy').click(function(e) { | |
// Open Checkout with further options | |
handler.open({ | |
name: 'My Teen Driver', | |
description: '3 Years of Service and Window Stickers', | |
image: 'img/logo-car.png', | |
billingAddress: true, | |
shippingAddress: true, | |
amount: 3999 | |
}); | |
e.preventDefault(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment