【发布时间】:2019-02-09 11:38:27
【问题描述】:
我有一个 react 应用程序,我想在其中设置 adyen(支付处理 API)。我想使用结帐 SDK (https://docs.adyen.com/developers/checkout/web-sdk) 非常简单,
我已将 js 逻辑移至 componentDidMount,但加载 sdk 时遇到问题,
<script type="text/javascript" src="https://checkoutshopper-test.adyen.com/checkoutshopper/assets/js/sdk/checkoutSDK.1.6.3.min.js"></script>
所以我可以使用 SDK 中的以下功能:
chckt.hooks.beforeComplete = function(node, paymentData) {
return false; // Indicates that you want to replace the default handling.
};
我尝试在我的 React 组件中使用 react-script-tag:
render() {
return (
<div className='checkout-warpper'>
<ScriptTag type="text/javascript" src="https://checkoutshopper-test.adyen.com/checkoutshopper/assets/js/sdk/checkoutSDK.1.9.2.min.js" />
<div className="checkout" id="adyen-checkout">
{/* The checkout interface will be rendered here */}
</div>
</div>
);
}
但还是报错:
Uncaught ReferenceError: chckt is not defined.
【问题讨论】:
标签: javascript reactjs web adyen