【问题标题】:How do I disable advanced fraud detection of stripe in react-stripe-js?如何在 react-stripe-js 中禁用条带的高级欺诈检测?
【发布时间】:2021-10-07 09:21:51
【问题描述】:

我终于找到了一种方法,可以在 react 网站的每个页面上禁用条带加载,从而减慢网站速度并降低网站性能。我只需要支付页面上的条带,遇到了一个解决方案,那就是禁用条带的高级欺诈检测

https://stripe.com/docs/disputes/prevention/advanced-fraud-detection#disabling-advanced-fraud-detection

HTML 是这样完成的

<script src="https://js.stripe.com/v3/?advancedFraudSignals=false"></script>

但是我在我的 react 应用中使用 react-stripe-js

https://stripe.com/docs/stripe-js/react#elements-provider

https://www.npmjs.com/package/@stripe/react-stripe-js

任何人都知道我如何使用react-stripe-js 来应用禁用功能吗?

【问题讨论】:

    标签: javascript reactjs stripe-payments


    【解决方案1】:

    您应该能够在加载 React 组件之前 configure the stripe API 模块:

    import {loadStripe} from '@stripe/stripe-js/pure';
    loadStripe.setLoadParameters({advancedFraudSignals: false});
    
    import { /*...*/ } from "@stripe/react-stripe-js";
    

    【讨论】:

    • 好的,刚刚看到github.com/stripe/… The loadStripe.setLoadParameters function is only available when importing loadStripe from @stripe/stripe-js/pure 那么我该怎么办,因为我的代码中已经有这行了??? import {loadStripe} from '@stripe/stripe-js';?我是把它添加到另一行还是什么?
    • 可以通过删除此行 import {loadStripe} from '@stripe/stripe-js'; 并按照文档 import {loadStripe} from '@stripe/stripe-js/pure'; 的指示使用此行来解决。谢谢
    • 经过测试并摆脱了每个网页上令人讨厌的条纹无意义......现在知道我的背上有条纹了..字面意思
    猜你喜欢
    • 2018-12-21
    • 2018-04-18
    • 1970-01-01
    • 2011-04-04
    • 1970-01-01
    • 1970-01-01
    • 2014-06-15
    • 2021-10-30
    • 2020-07-18
    相关资源
    最近更新 更多