【问题标题】:Adding zip code and address to Coffee for Stripe payment将邮政编码和地址添加到 Coffee 以进行 Stripe 付款
【发布时间】:2017-12-07 20:47:28
【问题描述】:

我们有一个 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

【问题讨论】:

    标签: coffeescript stripe-payments


    【解决方案1】:

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

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

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

    附带说明,zipCode: true 不是必需的,因为邮政编码将作为帐单地址的一部分收集(即 billingAddress: true 隐含。

    【讨论】:

    • 添加该行时出现以下错误。 “请求 req_Axo0vFFera2bCX:您为 'card' 传递了一个空白字符串。您应该从请求中删除 'card' 参数或提供一个非空白值。”
    • 非常感谢,您在令牌工作之前对推杆 billingAddress 的编辑,天才 ;)
    • 很高兴能帮上忙! :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-26
    • 2014-06-08
    • 1970-01-01
    相关资源
    最近更新 更多