Created
September 19, 2015 16:15
-
-
Save jcleblanc/f72a460ec7ce88774ddd to your computer and use it in GitHub Desktop.
Braintree Drop-In UI Client Sample (Node)
This file contains hidden or 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
<!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