In-Context Checkout: Uncaught SecurityError: Blocked a frame with origin: checkout.js:4734 throws error

前端 未结 1 1981
天命终不由人
天命终不由人 2020-12-20 01:50

I\'m implementing PayPal\'s In-Context Checkout and am using Advanced In-Context JavaScript settings (https://developer.paypal.com/docs/classic/express-checkout/in-context/j

相关标签:
1条回答
  • 2020-12-20 02:32

    UPD: No, below is not a solution for the problem. Occasionally Paypal's checkout.js script throws the error.

    However, it solves this issue

    Apparently,

    1) there was no this:

    window.paypalCheckoutReady = function() {
        // wrong this is here
    }
    

    I changed to:

    window.paypalCheckoutReady = () => {
        // correct this is here now
    }
    

    I don't like .bind(this).

    2) I removed <form /> tag and set plain <div> instead:

    // before
    <form id="checkoutBtnContainer" method="post" action="/checkout"></form>
    
    // after
    <div id="checkoutBtnContainer"></div>
    

    I don't know why and how, but all works fine now.

    0 讨论(0)
提交回复
热议问题