Search code examples
javascriptreactjspaypalpayment-gateway

How to disable a payment with react-paypal-js


I switched from react-paypal-button-v2 to react-paypal-js.

Before i could disable payments inside my options with disableFunding: 'card' but it no longer working with react-paypal-js

So I'm kinda confused where to set it up. Inside my initialOptions or in my PayPalButton as a props?

const initialOptions = {
  'client-id': 'test',
  currency: 'EUR',
  intent: 'capture',
};

<PayPalScriptProvider options={initialOptions}>
    <PayPalButtons/>
</PayPalScriptProvider>

Edit:

const initialOptions = {
  'client-id': 'test',
  currency: 'EUR',
  intent: 'capture',
  'disable-funding': 'card',
};

It's not working for me and without single quotes it's not working bcs I can't use that for an opject with hyphen


Solution

  • react-paypal-js supports all the script config options the JS SDK itself does.

    Add disable-funding: 'card' in the options to PayPalScriptProvider.