将邮政编码和地址添加到 Coffee 以进行 Stripe 付款

Adding zip code and address to Coffee for Stripe payment

我们有一个 Python 应用程序可以通过卡付款,被盗卡的人受到重创。为了帮助防止这种情况,我们想在付款信息中添加邮政编码和账单地址。据我所知,StripeCheckout 是在下面的 Coffee 脚本中配置的。添加 data-zip-code: true 和 data-billing-address: true 只会使应用程序失败。我对 Stripe 或 Coffee 不熟悉,如果能提供一些帮助将这些变量添加到配置中,我将不胜感激。

handler = StripeCheckout.configure
  key: window.stripeKey
  token: (token) ->
    $('.token').val token.id
    $('.buy-form').submit()

StripeCheckout 参考:https://stripe.com/docs/checkout#integration-simple-options

您正在使用 custom integration,因此您不应在选项前加上 data- 前缀——该前缀仅在选项作为 HTML 属性传递时使用简单的整合。

我对 Coffeescript 没有太多经验,但这应该可行:

handler = StripeCheckout.configure
  key: window.stripeKey
  billingAddress: true
  token: (token) ->
    $('.token').val token.id
    $('.buy-form').submit()

附带说明一下,zipCode: true 不是必需的,因为 ZIP/postal 代码将作为帐单地址的一部分收集(即,billingAddress: true.[=15 暗示了它) =]