我正在爲我的電子商務網站使用Stripe,並且我的代碼沒有錯誤,但由於某種原因,新客戶未在我的條紋儀表板中註冊。條紋沒有在儀表板中列出新客戶
有一段時間它工作,但不再。我遵循Stripe網站上的教程。
下面是代碼:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
Stripe.setPublishableKey('pk_test_Zr7oAROGNha5GcEdthCemM0a');
function stripeResponseHandler(status, response) {
var $form = $('#signupform');
if (response.error) {
// Show the errors on the form
$form.find('.payment-errors').text(response.error.message);
$form.find('button').prop('disabled', false);
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and submit
$form.get(0).submit();
}
};
jQuery(function($) {
$('#signupform').submit(function(event) {
var $form = $(this);
// Disable the submit button to prevent repeated clicks
$form.find('button').prop('disabled', true);
Stripe.card.createToken($form, stripeResponseHandler);
// Prevent the form from submitting with the default action
return false;
});
});