Stripe payments 如何使用3D Secure with stripe托管发票页面为支付卡创建付款缩进

Stripe payments 如何使用3D Secure with stripe托管发票页面为支付卡创建付款缩进,stripe-payments,3d-secure,stripe-invoices,Stripe Payments,3d Secure,Stripe Invoices,当我创建在线支付时没有问题,当需要身份验证时不能再收费,当Stripe必须向客户发送一封带有确认链接的信函时,不了解一种方法,链接指向Stripe托管页面,如 使用SCA所需卡的请求我收到一个卡错误(需要授权) 我找到了这种方法。在条带仪表板中设置电子邮件。 可能一定是与发票API有关,但我在文档中看不到流程 预期成功创建paymentIndent,状态为Requireds_confirmation。通过确认按钮发送给客户的电子邮件。根据3D secure的新规定,需要额外的付款确认。您可以使用

当我创建在线支付时没有问题,当需要身份验证时不能再收费,当Stripe必须向客户发送一封带有确认链接的信函时,不了解一种方法,链接指向Stripe托管页面,如

使用SCA所需卡的请求我收到一个卡错误(需要授权)

我找到了这种方法。在条带仪表板中设置电子邮件。 可能一定是与发票API有关,但我在文档中看不到流程


预期成功创建paymentIndent,状态为Requireds_confirmation。通过确认按钮发送给客户的电子邮件。

根据3D secure的新规定,需要额外的付款确认。您可以使用以下代码实现这一点。

将意图传递给此功能(服务器代码)

提示传统3D安全弹出窗口(前端代码)


这些设置仅在您使用Stripe的计费产品(订阅/发票,因此此流:)时适用。如果你使用它,你不会自己创建PaymentIntents。如果你像在你共享的第二个链接中那样,自己手工支付会话费用,你需要建立一些东西,给客户发送电子邮件,让他们回到会话中。
        $intent = PaymentIntent::create([
            'amount'               => 1100,
            'currency'             => 'usd',
            'payment_method_types' => ['card'],
            'customer'             => $customerId,
            'payment_method'       => $paymentMethodId,
            'off_session'          => true,
            'confirm'              => true,
        ]);
    const generate_payment_response = (intent) => {
    if (
      intent.status === 'requires_action' &&
      intent.next_action.type === 'use_stripe_sdk'
    ) {
      // Tell the client to handle the action
      return {
        requires_action: true,
        payment_intent_client_secret: intent.client_secret
      };
    } else if (intent.status === 'succeeded') {
      // The payment didn’t need any additional actions and completed!
      // Handle post-payment fulfillment
      return {
        success: true
      };
    } else {
      // Invalid status
      return {
        error: 'Invalid PaymentIntent status'
      }
    }
  };
function handleServerResponse(response) {
    console.log(response, "handling response");

    if (response.data.success) {
      // Show error from server on payment form
      alert("Paymemt successful");

    } else if (response.data.requires_action) {
        alert("require additional action");
        // Use Stripe.js to handle required card action
        stripe.handleCardAction(
            response.data.payment_intent_client_secret
            ).then(function(result) {
                if (result.error) {
                    // Show error in payment form
                } else {
                    // The card action has been handled
                    // The PaymentIntent can be confirmed again on the server
                    let data = {
                        payment_intent_id: result.paymentIntent.id 

                    }
                    axios.post(`${baseUrl}/confirmPayment`, data).then(response => {
                        handleServerResponse(response);
                    });
                }
            }).catch(error => {
                console.log(error, "error");

                alert("rejected payment");
            })
        } else {
            // Show failed
            alert("Failed transaction");
            alert(response.data.message);
            console.log(response.data, "error during payment confirmation");
    }
  }