[英]Braintree Payments requestPaymentMethod hangs
I am trying to get the javascript V3 version of Braintree Payments running against sandbox, and am having a problem with the requestPaymentMethod hanging when I provide a valid sandbox cc. 我正在尝试针对沙箱运行javascript V3版本的Braintree Payments,并且在提供有效的沙箱cc时requestPaymentMethod挂起时遇到问题。
The following displays the page and successfully displays the "RequestPaymentMethod Error" alert when I do not provide a cc, but hangs (with fast a green progress "stripe" scrolling across the screen under the Pay with Card header) when the valid 4111-1111-1111-1111 cc is entered. 当我不提供抄送,但在有效4111-1111有效时,挂起(在屏幕上滚动时,绿色进度“条带”快速滚动显示在屏幕上),以下显示页面并成功显示“ RequestPaymentMethod Error”警报。输入-1111-1111 cc。
Note - I am trying to do this by dropping a file into the browser (ie. file://...) instead of http or https - that worked with the script tag dropin. 注意-我正在尝试通过将文件而不是http或https拖放到浏览器中(即file:// ...)来实现此目的-该脚本标签dropin可以使用。
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Braintree Payments Test - JS3</title>
<link rel="stylesheet" type="text/css" href="https://assets.braintreegateway.com/web/dropin/1.9.2/css/dropin.min.css" id="braintree-dropin-stylesheet">
</head>
<body>
<div align="center"> <h1>Braintree Payments Test - JS3</h1></div>
<div id="dropin-container"></div>
<button id="submit-button">Purchase</button>
<script src="https://js.braintreegateway.com/web/dropin/1.9.2/js/dropin.min.js"></script>
<script>
var button = document.querySelector('#submit-button');
braintree.dropin.create({
authorization: <sandbox tokenizationKey>,
container: '#dropin-container'
}).then(function(dropinInstance) {
button.addEventListener('click', function() {
alert("requesting payment method");
dropinInstance.requestPaymentMethod().then(function(payload) {
alert("Recvd nonce: " + payload.nonce);
}).catch(function(requestPaymentMethodError) {
alert("RequestPaymentMethod Error: " + requestPaymentMethodError);
});
});
}).catch(function(createErr) {
alert("Create Error: " + createErr);
});
</script>
</body>
Full disclosure: I work at Braintree. 全面披露:我在Braintree工作。 If you have any further questions, feel free to contact support .
如果您还有其他疑问,请随时与支持小组联系。
Due to how Braintree's JavaScript SDK relies on postMessage()
, you will need to run your application via HTTP or HTTPS in order to avoid the issue you're experiencing. 由于Braintree的JavaScript SDK依赖于
postMessage()
,您将需要通过HTTP或HTTPS运行应用程序,以避免遇到问题。 This is because with postMessage()
file://
cannot be used as a security restriction; 这是因为对于
postMessage()
file://
不能用作安全限制;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.