skip to Main Content

I’m developing a payment system with PayPal API. Everything works except that the transaction is in USD and not SGD (like how I want it to be).

PayPal Button from react-paypal-button-v2

<PayPalButton
  currency='SGD'
  amount={parcel.basePrice}
  onSuccess={successPaymentHandler}
/>

Script to add PayPal button

 const addPayPalScript = () => {
    const script = document.createElement("script");
    script.type = "text/javascript";
    script.src =
      "https://www.paypal.com/sdk/js?client-id=CLIENT_ID&currency=SGD";
    script.async = true;
    script.onload = () => {
      setSdkReady(true);
    };
    document.body.appendChild(script);
  };

I followed the documentation here. https://developer.paypal.com/docs/checkout/reference/customize-sdk/

2

Answers


  1. SGD is a PayPal supported currency, and your code’s usage appears correct according to the documentation for that unofficial react-paypal-button-v2 component, so I’m not sure what’s going wrong here.

    Try the newer official @paypal/react-paypal-js instead.

    Login or Signup to reply.
  2. You can use the currency inside options rather than as a props in component code will be like

      <PayPalButton
                    amount={100}
                    options={{            
                        currency:"SGD"
                    }}
                
                />
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search