cancel
Showing results for 
Search instead for 
Did you mean: 

react.js - paypal integration with react-paypal-js

Options
morph192
Contributor
Posted on

Hi,

 

My currently code is :

And on top of file ofc: 

import { PayPalScriptProvider, PayPalButtons } from "@paypal/react-paypal-js";
//paypal
  const createOrder = (data, actions) =>{
      return actions.order.create({
        purchase_units: [
          {
            amount: {
              value: "50",
            },
          },
        ],
      });
  };

  const onApprove = (data, actions) => {
    return actions.order.capture();
  };

return (
<>
                            <PayPalScriptProvider options={{ "client-id": "AdVF2X5TCOL7vsidbWO8mHa5fhZq9HLLUR9C55zFknSclhwFkhKSrDwfhveUCY_ZHNdGPz_6iG3FnaTk" }}>
                <PayPalButtons 
                  createOrder={(data, actions) => createOrder(data, actions)}
                  onApprove={(data, actions) => onApprove(data, actions)}
                />
            </PayPalScriptProvider>
</>
);

In my console.log there are two errors:
A boolean is being passed as a fourth parameter to window.open. This is not used and may cause an exception in a future release.
POST https://www.sandbox.paypal.com/smart/api/order/6BK65346XG818045N/capture 400 (Bad Request)

And theres alot of text underthat with errors....

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.