2016-03-20 36 views
0

我正在爲我的電子商務網站使用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; 
    }); 
}); 

回答

0

你在你的條紋日誌看?

https://dashboard.stripe.com/logs?method=not_get

成功的呼叫/ V1 /令牌只,或/ V1 /令牌和/ V1 /客戶呢?

通常這是在您創建令牌時發生的,但不是您的客戶或後端中的費用。用Stripe爲客戶收費通常是一個兩步驟的過程。

第1步:您使用Checkout或Stripe.js表單收集客戶的信用卡信息,並將其傳遞給Stripe,Stripe會爲您提供一個令牌。

第2步:將此令牌傳遞給您的後端,然後告訴Stripe對其進行收費,或將其保存到客戶以便稍後收費。您需要在您的服務器上有一個腳本來處理這個腳本,並從POST參數中獲取該令牌。這裏有一個代碼示例,https://stripe.com/docs/tutorials/charges

這聽起來像是第二步不會發生在你身上---如果你已經有了後端腳本,那麼在信息到達Stripe之前可能會有一些錯誤導致它失敗。我建議您查看一下您的服務器和錯誤日誌,以找到更詳細的信息。

相關問題