【问题标题】:Stripe, webhooks and SCA European law checkout flowStripe、webhooks 和 SCA 欧洲法律结帐流程
【发布时间】:2020-08-10 15:38:20
【问题描述】:

我正在使用 Stripe 付款的网站,它是基于欧洲的,所以我必须处理 SCA 3D 安全身份验证,stripe 文档建议我异步处理付款履行,而不是等待 confirmCardPayment 承诺解决,要做到这一点,您必须使用 webhook。

来自文档:

stripe.confirmCardPayment(clientSecret, {
  payment_method: {
    card: card,
    billing_details: {
      name: 'Jenny Rosen'
    }
  },
  setup_future_usage: 'off_session'
}).then(function(result) {
  if (result.error) {
    // Show error to your customer
    console.log(result.error.message);
  } else {
    if (result.paymentIntent.status === 'succeeded') {
      // Show a success message to your customer
      // There's a risk of the customer closing the window before callback execution
      // Set up a webhook or plugin to listen for the payment_intent.succeeded event
      // to save the card to a Customer

      // The PaymentMethod ID can be found on result.paymentIntent.payment_method
    }
  }
});

注意下面的评论:

// There's a risk of the customer closing the window before callback execution
// Set up a webhook or plugin to listen for the payment_intent.succeeded event

由于该警告,我对如何处理 confirmCardPayment 承诺感到困惑。

我是否应该在从客户端调用 confirmCardPayment 后将用户带到另一个页面,并在新页面中显示状态为 PENDING 或 PROCCESING 的订单。

我应该在使用计时器调用 confirmCardPayment 几秒钟后执行此操作,还是检查回调中没有错误,在 promise 回调的 else 括号内并使用 location.href 移动用户以查看订单?

之后,我将使用 webhook 在后端处理订单履行(监听 payment_intent.succeded 事件、从库存中移除、发送订单电子邮件并执行剩余的数据库操作)

如果我这样做,SCA 模式还会出现吗? Stripe 说 Stripe.js 处理 SCA 并显示模态,但是如果我将用户重定向到没有 stripe.js 的待处理订单页面,SCA 模态操作将如何完成?

这很令人困惑。

【问题讨论】:

    标签: javascript php laravel vue.js


    【解决方案1】:

    当我们在正面确认刷卡支付后,我们基本上关闭了支付模式,并显示“订单”页面或您当前状态的任何页面。

    我们正在使用 Pusher 将服务器状态更改的服务器更新从服务器推送到客户端,这使我们能够更新客户端以方便用户。

    如果无法使用推送器或其他基于套接字的解决方案,您可以将其显示为“请稍候”状态,并每隔 X 次轮询服务器更新。

    这里没有“对或错”;这仅取决于您的设置以及您的确切要求......

    【讨论】:

    • 我知道,但是您如何确认付款? SCA 模态何时完成?收到confirmCardPayment 承诺后?用户可以在网络之外完成 SCA 吗?
    • 不确定您的意思? SCA 由 Stripe 处理。他们为您处理一切,包括 3DS 验证。
    • 当他们“同意”设置 paymentIntent 时,SCA 就完成了。那是Stripe(强烈)识别客户的时候。因此,当您获得 webhook 并确认收费时,客户实际上已经同意您获取付款。根据流程,当您让客户同意您创建的 paymentIntent 时,您将无法收取“超过”您与客户约定的费用。
    猜你喜欢
    • 2020-01-13
    • 2021-09-10
    • 2018-09-04
    • 1970-01-01
    • 2020-06-26
    • 2018-01-13
    • 1970-01-01
    • 2020-04-02
    • 2016-02-12
    相关资源
    最近更新 更多