What I did was to put a div over the Paypal button, then disable the div when needed:
NORMAL PAYPAL BUTTON RENDERING:
paypal.Button.render({
// Set your environment
env: 'production', // sandbox | production
// Specify the style of the button
style: {
label: 'pay', // paypal | checkout | pay
size: 'small', // small | medium | large | responsive
shape: 'pill', // pill | rect
color: 'gold', // gold | blue | silver | black
tagline: 'true'
},
// PayPal Client IDs - replace with your own
// Create a PayPal app: https://developer.paypal.com/developer/applications/create
client: {
sandbox: 'XXX',
production: 'YYY'
},
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: totalAmount, currency: 'USD' }
}
]
}
});
},
onAuthorize: function(data, actions) {
return actions.payment.execute().then(function() {
window.alert('Payment Complete!');
});
}
}, '#paypal-button-container');
ADDITIONAL STUFF POST BUTTON RENDER:
$("<div id='paypal-fake-cover' onclick='removeCover();' />").css({
cursor:"pointer",
position: "absolute",
width: "100%",
height: "100%",
left: 0,
top: 0,
zIndex: 1000000, // to be on the safe side
}).appendTo($("#paypal-button-container").css("position", "relative"));
REMOVE COVER:
function removeCover(){
$('#paypal-fake-cover').remove();
}