PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 11, 2022

[FIXED] How to disable a payment with react-paypal-js

 November 11, 2022     javascript, payment-gateway, paypal, reactjs     No comments   

Issue

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.



Answered By - Preston PHX
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing