1

我有一个 Express 应用程序,我已经成功测试了支付标记化。由于我在英国并且将主要接受英国卡,我相信我需要实施 3D 安全处理。我真的很难理解官方文档——在我看来,例子很少而且相差甚远。来自以下内容:https ://stripe.com/docs/sources/three-d-secure

我让 Sources 工作,而不是使用令牌进行卡支付。这是第 1 步。第 2 步要求我确定卡是否支持 3D Secure。我一直在做这个客户端,但不确定随后如何处理这个问题——如果不需要 3D Secure,我一直在尝试向用户发送卡付款。但是如果需要,我需要创建另一个来源吗?我做这个服务器还是客户端?我也无法让 return_url 字段做任何事情 - 3D 安全卡根本失败。

有没有可以帮助我的例子?我发现官方文档只是粗略地告诉你该怎么做,而不是“如何”做事。

我应该补充一下,我正在使用 v3 和 Elements,而不是 Checkout。

谢谢你的帮助。

编辑:下面的服务器端似乎没有做任何事情:

stripe.sources.create({
amount: 6500,
currency: 'gbp',
type: "three_d_secure",
three_d_secure: {
  card: stripeSource,
},
redirect: {
  return_url: "http://example.com"
}
  })

文档指出“为了让您的客户使用 3D Secure 验证他们的身份,请将他们重定向到 Source 对象的 theredirect[url] 属性中提供的 URL。”

我的源对象不包含此字段?

编辑:这就是我现在所拥有的。重定向有效,但一旦我授权付款,卡就会拒绝:

stripe.customers.create({
  email: cust_email,
  source: stripeSource
  }).then(function(customer){
  return stripe.charges.create({
    amount: fee,
    description: "Client Ref: " + clientref,
    currency: "gbp",
    customer: customer.id,
    metadata: {
      'allocation:': allocate
    },
    receipt_email: cust_email,
    source: request.query.source,
  })
}
  ).catch(err => {
    console.log(err)
  })

  stripe.sources.create({
    amount: fee,
    currency: 'gbp',
    type: "three_d_secure",
    three_d_secure: {
      card: stripeSource,
   },
redirect: {
  return_url: "http://localhost:8000/charge"
}
 }).then(function(test) {
    response.redirect(test.redirect.url)
 })
4

0 回答 0