[英]Stripe checkout - IE popup is blocked on second payment
操作系统:BrowserStack Live
浏览器:IE11
我在用户单击按钮时使用带有js sdk的Stripe checkout来显示弹出窗口。 代码如下:
Payment.prototype = {
pay: function (options, callback) {
let tokenTriggered = false;
_handler = StripeCheckout.configure({
key: Constants[Constants.ENV].STRIPE_KEY,
image: 'image.jpg',
locale: 'auto',
token: function token(token) {
tokenTriggered = true;
const data = {
stripeToken: token.id,
stripeEmail: token.email,
amount: options.amount,
currency: CURRENCY,
capture: options.capture
};
$.ajax({
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
url: '/api/stripe',
success: function success(charge) {
callback(null, charge);
},
error: function error(error) {
callback(error.responseText);
}
});
},
closed: function () {
if (!tokenTriggered) {
// close button click behavior goes here
callback(1);
}
}
});
},
open: function (amount, name, description) {
// Open Checkout with further options:
_handler.open({
name: name,
description: description,
zipCode: true,
currency: 'aud',
amount: amount
});
}
};
调用“支付”功能,然后调用“开放”功能。 我的应用程序的工作流程要求用户在一个会话中支付两次费用。 在IE11中,第二笔付款没有显示“条带化”弹出窗口。 有任何想法吗?
以下网址https://stripe.com/docs/checkout解释了“ handler.open”代码不应包含在回调中,而应该不在其中。
控制台错误是:“ SCRIPT70:权限被拒绝”。
**编辑07/03/2017 **
仅在以下情况下发生此错误:付款后,导航到另一个页面,然后尝试另一次付款。
我通过在加载站点时仅初始化一次StripeCheckout来解决此问题。 然后,我将功能从“ StripeCheckout.configure”移至“ handler.open”功能,并在需要付款时调用该功能。
init: function () {
_handler = StripeCheckout.configure({
key: Constants[Constants.ENV].STRIPE_KEY,
image: 'image.jpg',
locale: 'auto'
});
},
open: function (options, callback) {
let tokenTriggered = false;
// Open Checkout with further options:
_handler.open({
name: 'An app',
description: options.description,
zipCode: true,
currency: CURRENCY,
amount: options.amount,
token: function token(token) {
tokenTriggered = true;
const data = {
stripeToken: token.id,
stripeEmail: token.email,
amount: options.amount,
currency: CURRENCY,
capture: options.capture
};
$.ajax({
type: 'POST',
data: JSON.stringify(data),
contentType: 'application/json',
url: '/api/stripe',
success: function success(charge) {
// _instantiated = true;
callback(null, charge);
},
error: function error(error) {
callback(error.responseText);
}
});
},
closed: function () {
if (!tokenTriggered) {
// close button click behavior goes here
callback(1);
}
}
});
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.