Search code examples
javascriptpaypal

how to only disable paypal button but enable paylater button?


I am trying to enable only paypal 'paylater' button and nothing else. I am using this code.

I also want to get (in case of payin3 option the breakdowns of total amount) amounts in an array so that I could perform some action on that.

<script src="https://www.paypal.com/sdk/js?client-id=xxxxxxxx&currency=GBP&components=buttons,messages&buyer-country=GB&enable-funding=paylater&disable-funding=card"></script>
<div data-pp-message data-pp-style-layout="text" data-pp-style-logo-type="inline" data-pp-style-text-color="black" data-pp-amount="170"></div>
<div id="paypal-button-container"></div>
paypal.Buttons({
  createOrder: function(data, actions) {
    return actions.order.create({
      purchase_units: [{
        amount: {
          value: '170'
        }
      }]
    });
  },
}).render('#paypal-button-container');
             

enter image description here

enter image description here


Solution

  • Use fundingSource

    paypal.Buttons({
      fundingSource: paypal.FUNDING.PAYLATER,
      style: { color: 'gold' },
      createOrder: function(data, actions) {
        return actions.order.create({
          purchase_units: [{
            amount: {
              value: '170'
            }
          }]
        });
      },
    }).render('#paypal-button-container');