Skip to content

Instantly share code, notes, and snippets.

@leomonteiro92
Last active September 28, 2018 14:05
Show Gist options
  • Save leomonteiro92/8867e4a6d70bcf65cd6a5de3bbe32ec8 to your computer and use it in GitHub Desktop.
Save leomonteiro92/8867e4a6d70bcf65cd6a5de3bbe32ec8 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="https://js.iugu.com/v2"></script>
<script>
Iugu.setAccountID("<<Enter your account ID HERE>>");
Iugu.setTestMode(true);
var cc = Iugu.CreditCard("4111111111111111",
"12", "2019", "Nome",
"Sobrenome", "123");
Iugu.createPaymentToken(cc, function (response) {
if (response.errors) {
console.log(response.errors);
alert("Erro salvando cartão");
} else {
document.getElementById('title').innerText = "Token criado:";
document.getElementById('token').innerText = response.id;
}
});
</script>
</head>
<body>
<p id="title">Aguarde...</p>
<p id="token"></p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment