简体   繁体   English

Stripe:为未来的支付设置一张经过 3d 安全认证的卡

[英]Stripe: Setting up a card for future payments that is 3d secure authenticated

I've implemented the steps described in this Stripe tutorial on how to save card information to be used later on (future payments):我已经实施了本 Stripe 教程中描述的有关如何保存卡信息以供日后使用(未来付款)的步骤:

https://stripe.com/docs/payments/save-during-payment https://stripe.com/docs/payments/save-during-payment

This is now implemented and works fine.现在已经实施并且工作正常。

I'm doing a 0.5$ charge on the card to trigger the 3d secure authentication process.我在卡上收取 0.5 美元以触发 3d 安全身份验证过程。 How it works is that it first checks what is the PaymentIntent status, and if its "action_required" then it redirects to this HTML where I've implemented in JS the following:它的工作原理是,它首先检查 PaymentIntent 状态是什么,如果它是“action_required”,那么它会重定向到这个 HTML,我在 JS 中实现了以下内容:

function _3dsec(stripe_publishable_key, pi_secret) {
    document.addEventListener("DOMContentLoaded", function(event) {
        var stripe = Stripe(stripe_publishable_key);

        stripe.confirmCardPayment(pi_secret).then(function(result) {
            if (result.error) {
                $("#3ds_result").text("Error!");
                $("#3ds_result").addClass("text-danger");
        }   else {
                $("#3ds_result").text("Card succesfully validated");
                $("#3ds_result").addClass("text-success");
        } 

        })

    })



}

And this also works well, it does the 3D secure authentication if the card requires it.这也很好用,如果卡需要,它会进行 3D 安全认证。 I've been testing only with Stripe cards.我只测试过条纹卡。 and then the idea is that i refund the 0.5$ as it was just used to authenticate the card.然后我的想法是我退还 0.5 美元,因为它只是用于验证卡。

However, in my product the charges are done afterwards.但是,在我的产品中,费用是在之后完成的。 There is only a signup page with the user and payment information and then charges occur as the user is using my product.只有一个包含用户和付款信息的注册页面,然后在用户使用我的产品时产生费用。 This works well for cards that dont need the 3D secure authentication, but for the cards that require the authentication I'm not able to create charges later on, and get the "3D secure authentication required" status on the PaymentIntent.这适用于不需要 3D 安全身份验证的卡,但对于需要身份验证的卡,我以后无法创建费用,也无法在 PaymentIntent 上获得“需要 3D 安全身份验证”状态。 And the customer is not able to authenticate it as they are not in the website during that time ("off session").并且客户无法对其进行身份验证,因为他们在那段时间不在网站上(“关闭会话”)。

Is this 3d secure behavior only on the Stripe test cards, or how can I implement future card payments on a card that requires the 3d authentication?这种 3d 安全行为是否仅在 Stripe 测试卡上,或者我如何在需要 3d 身份验证的卡上实现未来的卡支付?

Whether a transaction requires 3D Secure or not is a decision that's entirely up to the cardholder's bank.交易是否需要 3D Secure 完全取决于持卡人的银行。 When 3D Secure is required due to regulations (eg, SCA), Stripe will apply for exemptions whenever possible to limit the likelihood of transactions requiring authentication, but it isn't guaranteed.当 3D 由于法规(例如,SCA)而需要 Secure 时,Stripe 将尽可能申请豁免以限制交易需要身份验证的可能性,但不能保证。 So, yes, when you go to production it is possible (but unlikely) that your customers will require 3D Secure on each transaction.因此,是的,当您 go 投入生产时,您的客户可能(但不太可能)要求 3D 在每笔交易中确保安全。

for the cards that require the authentication I'm not able to create charges later on, and get the "3D secure authentication required" status on the PaymentIntent.对于需要身份验证的卡,我以后无法创建费用,也无法在 PaymentIntent 上获得“需要 3D 安全身份验证”状态。 And the customer is not able to authenticate it as they are not in the website during that time ("off session").并且客户无法对其进行身份验证,因为他们在那段时间不在网站上(“关闭会话”)。

In cases when you make payments off-session, you should set the off_session property to true when creating the payment intent:如果您在会话外付款,则应在创建付款意图时将off_session属性设置为true

https://stripe.com/docs/api/payment_intents/create#create_payment_intent-off_session https://stripe.com/docs/api/payment_intents/create#create_payment_intent-off_session

Doing so tells Stripe to apply for off-session payments exemptions when you're live in production.这样做会告诉 Stripe 在您处于生产状态时申请会话外付款豁免。 You can test how these types of payments would behave by using the first regulatory test card in this table:您可以使用此表中的第一个监管测试卡来测试这些类型的付款方式:

https://stripe.com/docs/testing#regulatory-cards https://stripe.com/docs/testing#regulatory-cards

In most cases the exemptions should be sufficient and the payment shouldn't require authentication, but there is still a chance that the cardholder's bank will request 3D Secure for the transaction.在大多数情况下,豁免应该足够了,付款不需要身份验证,但持卡人的银行仍有可能为交易请求 3D 安全。 For those cases, you will need to write logic on your end to notify your customer of the failed transaction and to bring them back on-session to process the payment.对于这些情况,您将需要在您的一端编写逻辑以通知您的客户交易失败并让他们返回会话以处理付款。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM