I have the following cenario: On my website are different payment-options. First you choose the method, where by clicking on the paypal-button shout happens nothing. Only if you click then the order-and-pay-button it shout run the behavior of the paypal-button, with opening the paypal-dialog. var wasLoaded = false;
function loadScript() {
if(wasLoaded) return;
wasLoaded = true;
var script = document.createElement('script');
script.type = 'text/javascript';
document.body.appendChild(script);
script.onload = function() {
paypal.Buttons({
// Set up the transaction
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '88.44'
}
}]
});
}, ...
load it to a hidden div.
}
script.src='https://www.paypal.com/sdk/js?client-id=SD&intent=capture&vault=false&commit=true';
} by loading it to an hidden div. By clicking on order-and-pay I make button.click() to execute the paypal-stuff. But unfortunately the papypal-stuff is in a iframe, so I do not have access to it. I could not find any hint in the paypal-specs. They wont always to use there button. How can I achieve this approach?
... View more