如何将Stripe付款库与HTML / JS中的单选按钮选择的多个按钮结合使用

Vit*_*lyT 5 html javascript payment html5 stripe-payments

我将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>
Run Code Online (Sandbox Code Playgroud)

制作多个按钮并使用简单的单选按钮在它们之间进行选择的最佳方法是什么?

<input type="radio" name="imgsel" value="subscribe" checked="checked" />
Run Code Online (Sandbox Code Playgroud)

聚苯乙烯

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

有什么建议么 ?

像这样或更基本的东西:

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

BR

koo*_*jah 1

您只需在结帐表单内传递额外的输入字段即可。这些将与卡令牌一起自动提交。

你的代码看起来像这样:

<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>
Run Code Online (Sandbox Code Playgroud)