我无法理解为什么我在提交表单时从Stripe收到此错误:
An unexpected error has occurred submitting your credit card to our secure credit card processor. This may be due to network connectivity issues, so you should try again (you won't be charged twice). If this problem persists, please let us know!
但是, 事务已成功处理。
我的代码与示例表单不同,只是因为我正在使用Parsely验证代码,并且只有在表单的其余部分有效时才想生成令牌:
if $(".error-block").length > 0 && $(".error-block").html() != ''
$.scrollTo($(".error-block"))
Stripe.setPublishableKey($('#stripe_key').val())
stripeResponseHandler = (status, response) ->
if response.error
$(".error-block").text(response.error.message)
$('#join-button').attr("disabled", false).removeClass('disable').html('Join')
else
$form = $('#user_new')
token = response['id']
$('#user_stripe_token').val(token)
$('#user_card_number').val('')
$('#user_card_cvc').val('')
$('#user_card_expiry_month').val('')
$('#user_card_expiry_year').val('')
$form.get(0).submit()
$('#user_new').submit ->
valid = $(@).parsley().isValid()
if valid != false
$('#join-button').attr("disabled", true).addClass('disable').html('Please wait...')
Stripe.card.createToken({
number: $('#user_card_number').val(),
cvc: $('#user_card_cvc').val(),
exp_month: $('#user_card_expiry_month').val(),
exp_year: $('#user_card_expiry_year').val()
name: $('#user_first_name').val() + " " + $('#user_last_name').val()
}, stripeResponseHandler)
return false
return false
我出错的任何想法?