如何将自定义字段添加到Stripe Checkout的弹出窗体中 [英] How to add custom fields to popup form of Stripe Checkout
问题描述
如何将自定义字段添加到Stripe Checkout表单中,例如名字,姓氏,甚至可以使用自定义按钮的复选框?
到目前为止,我想出了这个;
< script src =https:// checkout。 stripe.com/checkout.js\"></script>
< form action =/ chargemethod =POST>
src =https://checkout.stripe.com/checkout.jsclass =stripe-button
data-key =pk_test_i2txBI2jUjSQIMoqFz3Fo326
data-image =https://stripe.com/img/documentation/checkout/marketplace.png
data-name =Matt's Widgets and Gizmos
data-description =2部件($ 20.00 )
data-amount =2000
data-billingAddress =true
data-shippingAddress =true>
< / script>
< / form>
我发现Stripe Checkout只能包含下面的自定义值;
stripeBillingName:
stripeBillingAddressLine1:
stripeBillingAddressApt:
stripeBillingAddressZip:
stripeBillingAddressCity:
stripeBillingAddressState:
stripeBillingAddressCountry:
stripeBillingAddressCountryCode:
有没有办法解决这个问题?请让我知道
谢谢
不幸的是,无法调整Stripe Checkout来添加自定义字段或一个复选框。此处的解决方案是使用自定义结帐并将这些额外字段添加到您自己的表单中。例如,您可以收集客户的姓名,并要求他接受您自己的服务条款,并且只允许他们在点击付款按钮后点击。然后,一次客户使用他们的卡详细信息填写Checkout,Stripe会将您发送给您的令牌发送给您的服务器以及您在收到的额外详细信息中。
How can i add custom fields to Stripe Checkout form such as First Name, Last Name and maybe even a checkbox with a custom button? So far i've come up with this;
<script src="https://checkout.stripe.com/checkout.js"></script>
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_i2txBI2jUjSQIMoqFz3Fo326"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-name="Matt's Widgets and Gizmos"
data-description="2 widgets ($20.00)"
data-amount="2000"
data-billingAddress="true"
data-shippingAddress="true">
</script>
</form>
And i found that Stripe Checkout can only include the following custom values which are as under;
stripeBillingName:
stripeBillingAddressLine1:
stripeBillingAddressApt:
stripeBillingAddressZip:
stripeBillingAddressCity:
stripeBillingAddressState:
stripeBillingAddressCountry:
stripeBillingAddressCountryCode:
Is there any way around this? Please let me know Thank you
There is no way to tweak Stripe Checkout unfortunately to add a custom field or a checkbox. The solution here is to use Custom Checkout and add those extra fields to your own form. You would for example collect the customer's name and ask him to accept your own Terms of Service and only allow them to click on the Pay button once they do.
Then, once the customer fills Checkout with their card details and Stripe sends you back the token you would send it to your server along with the extra details you collected on your end.
这篇关于如何将自定义字段添加到Stripe Checkout的弹出窗体中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!