首页 文章

条纹签出 - IE弹出窗口在第二次付款时被阻止

提问于
浏览
0

O / S: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
        });
    }
};

调用'pay'函数,然后调用'open'函数 . 我的应用程序的工作流程要求用户在一个会话中支付两次内容 . 在IE11中,第二次付款时不显示条带弹出窗口 . 有任何想法吗?

以下网址https://stripe.com/docs/checkout解释'handler.open'代码不应该't be in a callback which it isn' .

控制台错误是:“SCRIPT70:权限被拒绝” .

**编辑07/03/2017 **

此错误仅在以下情况下发生:付款,导航到另一页,然后尝试另一次付款 .

1 回答

  • 0

    我通过在加载网站时初始化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);
                    }
                }
            });
        },
    

相关问题