How can I disable the PayPal Credit button?
I know this is kind of an old question, but I just spent an hour trying to find the answer to this, so hopefully this helps someone someday.
If you're using the new integration method that starts paypal.Buttons
instead of paypal.Button.render
, you have to append disable-funding
to the JS SDK.
<script src="https://paypal.com/sdk/js?client-id=YOUR_CLIENT_ID&disable-funding=credit,card"></script>
card
= Credit or debit cards
credit
= PayPal Credit
sepa
= SEPA-Lastschrift
Source: https://developer.paypal.com/docs/checkout/reference/customize-sdk/#disable-funding
If your the webmaster and you have access to the PayPal account login where the PayPal button was created click on merchant tools and edit your saved PayPal buttons there is an option to remove the credit card area. https://www.paypal.com/buttons/
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();
}