Created
September 7, 2012 13:51
-
-
Save paymill/3666426 to your computer and use it in GitHub Desktop.
Zahlungsformular
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
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> | |
<script type="text/javascript"> | |
var PAYMILL_PUBLIC_KEY = 'YOUR_PUBLIC_API_KEY'; | |
</script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script type="text/javascript" src="https://bridge.paymill.de/"></script> | |
<script type="text/javascript"> | |
$(document).ready(function () { | |
function PaymillResponseHandler(error, result) { | |
if (error) { | |
// Shows the error above the form. | |
$(".payment-errors").text(error.apierror); | |
} else { | |
$(".payment-errors").text(""); | |
var form = $("#payment-form"); | |
// Token | |
var token = result.token; | |
// Insert token into form in order to submit to server | |
form.append("<input type='hidden' name='paymillToken' value='" + token + "'/>"); | |
form.get(0).submit(); | |
} | |
$(".submit-button").removeAttr("disabled"); | |
} | |
$("#payment-form").submit(function (event) { | |
// Deactivate submit button to avoid further clicks | |
$('.submit-button').attr("disabled", "disabled"); | |
if (false == paymill.validateCardNumber($('.card-number').val())) { | |
$(".payment-errors").text("Invalid card number"); | |
$(".submit-button").removeAttr("disabled"); | |
return false; | |
} | |
if (false == paymill.validateExpiry($('.card-expiry-month').val(), $('.card-expiry-year').val())) { | |
$(".payment-errors").text("Invalid expiration date"); | |
$(".submit-button").removeAttr("disabled"); | |
return false; | |
} | |
paymill.createToken({ | |
number:$('.card-number').val(), | |
exp_month:$('.card-expiry-month').val(), | |
exp_year:$('.card-expiry-year').val(), | |
cvc:$('.card-cvc').val(), | |
cardholdername:$('.card-holdername').val() | |
}, PaymillResponseHandler); | |
return false; | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Paymill Test</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 60: attribute should be named
cardholder
, notcardholdername