Skip to content

Instantly share code, notes, and snippets.

@jcleblanc
Created September 19, 2015 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcleblanc/f72a460ec7ce88774ddd to your computer and use it in GitHub Desktop.
Save jcleblanc/f72a460ec7ce88774ddd to your computer and use it in GitHub Desktop.
Braintree Drop-In UI Client Sample (Node)
<!DOCTYPE HTML>
<html>
<head>
<title>Dropin</title>
</head>
<body>
<form id="checkout" method="post" action="http://localhost:3000/checkout">
<div id="payment-form"></div>
<input type="submit" value="Make Payment">
</form>
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<script>
var url = "http://localhost:3000/client_token";
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function(){
if (xmlHttp.readyState == 4 && xmlHttp.status == 200){
var clientToken = xmlHttp.responseText;
braintree.setup(clientToken, "dropin", {
container: "payment-form"
});
}
}
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment