【问题标题】:How can I provide billing details for SCA compliance using Stripe Payment Intents?如何使用 Stripe Payment Intents 提供 SCA 合规性的计费详细信息?
【发布时间】:2019-09-07 22:23:57
【问题描述】:

我正在按照Payment Intents Quickstart 中的说明使用 Stripe Payment Intents。正如文档所述:

为确保您的集成为 SCA 做好准备,请务必始终向 stripe.handleCardPayment 电话提供客户的姓名、电子邮件、帐单地址和送货地址(如果有)。

const stripe = Stripe('pk_test_lolnothisisnotreal', {
  betas: ['payment_intent_beta_3']
})

根据the handleCardPayment doc in the link,我提供billing details in the format specified

// https://stripe.com/docs/stripe-js/reference#stripe-handle-card-payment
const {paymentIntent, error} = await stripe.handleCardPayment(clientSecret, cardElement, {
  // https://stripe.com/docs/api/payment_methods/create#create_payment_method-billing_details
  payment_method_data: {
    billing_details: {
      address: {
        line1: cardholderAddressLine1.value,
        line2: cardholderAddressLine2.value,
        city: cardholderAddressCity.value,
        state: cardholderAddressState.value,
        country: cardholderAddressCountry.value,
        postal_code: cardholderAddressPostalCode
      },
      name: cardholderName.value,
      email: cardholderEmail.value,
      phone: cardholderPhone.value
    }
  }
})

但是handleCardPayment() 返回:

Received unknown parameter: source_data[billing_details]

如何使用 Stripe Payment Intents 提供 SCA 合规性的账单详情?

【问题讨论】:

    标签: javascript stripe-payments strong-customer-authentication


    【解决方案1】:

    代码传递payment_method_data[billing_details],这是您提供详细信息(例如持卡人的帐单地址)以将其与创建的PaymentMethod 资源相关联的方式。

    但问题是,这仅在您尚未使用旧 beta 标志初始化 Stripe.js 时才有效,其中 handleCardPayment 将在幕后创建 Source 对象 (src_123) 而不是 PaymentMethod (pm_123) .

    当您这样做时,库会将 payment_method_data 转换为 source_data,然后发送 source_data[billing_details],但 API 服务器端拒绝它,因为它不是服务器端的有效参数。

    为避免此错误,您需要确保在没有 betas 标志的情况下初始化 Stripe.js。所以转

    const stripe = Stripe('pk_test_123', {   betas: ['payment_intent_beta_3'] });
    

    进入:

    const stripe = Stripe('pk_test_123');
    

    【讨论】:

      猜你喜欢
      • 2021-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      • 2019-04-22
      • 1970-01-01
      • 2020-06-14
      • 1970-01-01
      相关资源
      最近更新 更多