2015-02-05 60 views
0

只是想驗證之前條紋結帳表單驗證和條紋結帳

enter image description here

<%= form_tag charges_path, class: 'stripeform' do %> 
    <input type="text" spellcheck="off" placeholder="First Name" name="first_name" class="name" required> 
    <input type="text" spellcheck="off" placeholder="Last Name" name="last_name" class="name" required> 
    <input type="checkbox" id="checkbox" required> I accept the <u>Terms and Conditions</u> 
    <button id="submitter"> 
    <script src="https://checkout.stripe.com/checkout.js" class="stripe-button" 
     data-key="<%= Rails.configuration.stripe[:publishable_key] %>" 
     data-label="Pay" 
     data-panel-label="Pay"</script> 
    </button> 
<% end %> 

的推移,一些自定義參數不會發生驗證,當我點擊按鈕條紋。

當我點擊按鈕ID =「提交」,也就是其背後的驗證只發生:

enter image description here

我不希望它背後的按鈕。我想要條紋按鈕來驗證字段。如何做到這一點,因爲Stripe的按鈕的HTML生成?

回答

3

我不知道我完全明白你想要做什麼。

是否要執行自定義字段的驗證,然後如果驗證通過,然後會顯示條紋檢出彈出窗口?如果是這樣的話,你可能要做出一個自定義的結賬流程,像:

https://stripe.com/docs/checkout#integration-custom

或者,是你想顯示條紋結帳彈出之前驗證的自定義字段完成,當用戶點擊彈出窗口中的「立即付款」按鈕時執行此驗證?這種事情並不是真的被checkout支持。如果這是你正在嘗試做的,你可能會想要寫一個完全自定義結賬的形式,像:

https://stripe.com/docs/tutorials/forms

然後,你可以有任何結帳流程,你需要有,雖然這可能不僅僅是使用預先建立的結帳,而是要多一點參與。