我将Stripe库用作付款选项,我想使用多个按钮之间的单选按钮进行简单选择,因为我看到了Stripe的API,因此无法在建议的表单中传递其他参数。

例如:

<form action="/tt-server/rest/billing/subscribe" method="POST">
        <script
                src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                data-key="pk_test_nz81cav6bbcEP4gxWxp1yFw7"
                data-image="https://storage.googleapis.com/tt-images/company/img_2015111514124193.png"
                data-name="myCompany"
                data-description="Pro Subscription ($400 per month)"
                data-panel-label="Subscribe"
                data-label="Subscribe"
                data-amount="400">
        </script>
    </form>

制作多个按钮并使用简单的单选按钮在它们之间进行选择的最佳方法是什么?
<input type="radio" name="imgsel" value="subscribe" checked="checked" />

聚苯乙烯

表单中没有“提交按钮”,此选项在Stripe的库中实现。

有什么建议么 ?

像这样或更基本的东西:

https://www.formget.com/wp-content/uploads/2014/08/online-single-product-payment-form.gif

BR

最佳答案

您可以简单地在Checkout表单中传递额外的输入字段。这些将与卡 token 一起自动提交。

您的代码如下所示:

<form action="/tt-server/rest/billing/subscribe" method="POST">
    <script
            src="https://checkout.stripe.com/checkout.js" class="stripe-button"
            data-key="pk_test_nz81cav6bbcEP4gxWxp1yFw7"
            data-image="https://storage.googleapis.com/tt-images/company/img_2015111514124193.png"
            data-name="myCompany"
            data-description="Pro Subscription ($400 per month)"
            data-panel-label="Subscribe"
            data-label="Subscribe"
            data-amount="400">
    </script>
    <input type="radio" name="imgsel" value="subscribe" checked="checked" />
</form>

关于javascript - 如何将Stripe付款库与HTML/JS中的单选按钮选择的多个按钮结合使用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37936886/

10-11 22:14
查看更多