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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…