Stripe 拒绝将表单数据发送到“https://hooks.stripe.com/three_d_secure/redirect_complete...”

时间:2021-02-12 12:33:12

标签: javascript stripe-payments

如果卡需要 3D 安全身份验证,我将尝试使用 stripe.confirmCardPayment 来确认卡付款。条带方法正确打开了3D 安全测试支付页面,但是当我点击完成身份验证时,它会关闭模式并在控制台中显示错误:

[Report Only] Refused to send form data to 'https://hooks.stripe.com/three_d_secure/redirect_complete/***' because it violates the following Content Security Policy directive: "form-action 'self'".

我的表单如下所示:

<form onSubmit={handleSubmit}>
    <CardElement />
    <button type="submit">Pay</button>
</form>

我有一个 JavaScript 函数来处理它:

const handleSubmit = (event) => {
    event.preventDefault();

    // Send calls to API to receive a checkoutId

    // Call the API to create the subscription
    const { subscription } = await createSubscription(checkoutId) 
    const { status, client_secret } = subscription.latest_invoice.payment_intent
    
    if (status === "requires_action") {
        const { error: confirmationError } = await stripe.confirmCardPayment(client_secret)

        if (confirmationError) {
            console.error(confirmationError);
            alert('unable to confirm card');
            return;
        }
    }
}

如何将表单数据正确发送到 Stripe 以验证 3D Secure 身份验证?

0 个答案:

没有答案
相关问题