javascript - Stripe 拒绝将表单数据发送到“https://hooks.stripe.com/three_d_secure/redirect_complete...”
问题描述
stripe.confirmCardPayment
如果卡需要 3D 安全身份验证,我正在尝试使用它来确认卡付款。stripe 方法正确打开3D Secure Test Payment Page,但是当我单击Complete Authentication时,它会关闭模式并在控制台中显示错误:
[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 安全身份验证?
解决方案
推荐阅读
- rust - 为什么不将指向 u8 的原始指针转换为指向 8 个布尔数组的原始指针打印正确的结果?
- javascript - 当我有 2 个可滑动的反应按钮时。当我滑动按钮 1 和按钮 2 正在移动时
- dokku - Dokku - 持久卷?
- flutter - 我创建了一种使用相机捕获图像的方法,但它不起作用我得到了以下两个错误,
- google-data-studio - 当我没有在下拉控件过滤器中选择任何内容时,如何更改 DataStudio 在图表中的默认显示?
- string - 具有后缀树的最短不可重复子串
- javascript - 单通道中的强模糊效果着色器?
- javascript - 为什么在单击事件侦听器中触发 click() 不会导致无限循环?
- python - Django Formset:从现有产品目录中添加行?
- android - 如何将数据(图像)从 RecyclerView 传递到 Kotlin 中的单独 Activity?