MCPcopy Create free account
hub / github.com/basir/node-react-ecommerce / addPaypalSdk

Function addPaypalSdk

frontend/src/components/PaypalButton.js:7–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5 const [sdkReady, setSdkReady] = useState(false);
6
7 const addPaypalSdk = async () => {
8 const result = await axios.get("/api/config/paypal");
9 const clientID = result.data;
10 const script = document.createElement('script');
11 script.type = 'text/javascript';
12 script.src = 'https://www.paypal.com/sdk/js?client-id=' + clientID;
13 script.async = true;
14 script.onload = () => {
15 setSdkReady(true);
16 }
17 document.body.appendChild(script);
18 }
19
20 const createOrder = (data, actions) => actions.order.create({
21 purchase_units: [

Callers 1

PaypalButtonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected