title: RESOURCE_NOT_FOUND in Paypal
body: <p>I have to setup paypal for payment in my ReactJs Project. Inorder to that i create paypal button and Call PayPal to get the transaction details. It seems it works well and i got success message with transaction details also.And the problem arise here is when i try to Validate the transaction details are as expected in my server side ie, nodejs (as mention here: "<a href="https://developer.paypal.com/docs/checkout/reference/server-integration/capture-transaction/" rel="nofollow noreferrer">https://developer.paypal.com/docs/checkout/reference/server-integration/capture-transaction/</a>")i got this Error. In my nodjs project i am using "<strong>@paypal/checkout-server-sdk</strong>".</p>
  
  <p>My code is:</p>
  
  <p>in ReactJs:
  PaypalButton.js</p>
  
  <pre><code>import React, { useState, useEffect } from "react";
  import ReactDOM from "react-dom";
  
  const PaypalButton = props =&gt; {
  const [sdkReady, setSdkReady] = useState(false);
  
  const addPaypalSdk = () =&gt; {
  const clientID ="**********CLIENT_ID**************";
  const script = document.createElement("script");
  script.type = "text/javascript";
  script.src = `https://www.paypal.com/sdk/js?client-id=${clientID}`;
  script.async = true;
  script.onload = () =&gt; {
    setSdkReady(true);
  };
  script.onerror = () =&gt; {
    throw new Error("Paypal SDK could not be loaded.");
  };
  
  document.body.appendChild(script);
  };
  
  useEffect(() =&gt; {
  if (window !== undefined &amp;&amp; window.paypal === undefined) {
    addPaypalSdk();
  } else if (
    window !== undefined &amp;&amp;
    window.paypal !== undefined &amp;&amp;
    props.onButtonReady
  ) {
    props.onButtonReady();
  }
  }, []);
  
  //amount goes in the value field we will use props of the button for this
  const createOrder = (data, actions) =&gt; {
  console.log("createOrder", data);
  return actions.order.create({
    purchase_units: [
      {
        amount: {
          currency_code: "USD",
          value: props.amount
        }
      }
    ]
  });
  };
  
  const onApprove = (data, actions) =&gt; {
  return actions.order
    .capture()
    .then(details =&gt; {
      if (props.onSuccess) {
        window.alert("Payment Sucessfull...");
        return props.onSuccess(data, details);
      }
    })
    .catch(err =&gt; {
      console.log(err);
    });
    };
  
   const clickPaypal = flag =&gt; {
      return props.onClick(flag);
   };
  
  if (!sdkReady &amp;&amp; window.paypal === undefined) {
    return &lt;div&gt;Loading...&lt;/div&gt;;
  }
  
  const Button = window.paypal.Buttons.driver("react", {
  React,
  ReactDOM
  });
  
  return (
    &lt;div style={{ width: 200 }}&gt;
    &lt;Button
      {...props}
      createOrder={
        props.amount &amp;&amp; !createOrder
          ? (data, actions) =&gt; createOrder(data, actions)
          : (data, actions) =&gt; createOrder(data, actions)
      }
      onApprove={
        props.onSuccess
          ? (data, actions) =&gt; onApprove(data, actions)
          : (data, actions) =&gt; onApprove(data, actions)
      }
      style={{
        layout: "horizontal",
        color: "gold",
        shape: "pill",
        label: "pay",
        size: "responsive",
        tagline: true
      }}
      onClick={props.onClick ? clickPaypal : clickPaypal}
    /&gt;
  &lt;/div&gt;
  );
  };
  export default PaypalButton;
  
  Pay.js
  
  onSuccess = (payment, details) =&gt; {
  const {
    processInvoicePaypalPayment
  } = this.props;
  
  this.paypalSucesssDetails = { ...details };
  
  processInvoicePaypalPayment( .     //call to server
    {
      invoice: invoice.data._id,
      orderId: this.paypalSucesssDetails.id // This order id is from sucess transaction details
    },
    this.paypalCapture
  );
  };
  
  render=()=&gt;{
     &lt;PaypalButton
      amount={invoiceData.amount}
      onSuccess={this.onSuccess}
      env={"sandbox"}
      onClick={this.clickPaypal}
     /&gt;
  }
  </code></pre>
  
  <p>and in my nodejs</p>
  
  <pre><code> import paypal from "@paypal/checkout-server-sdk";
        const clientId = "CLIENTID";
        const clientSecret = "SECRET";
        const environment = new paypal.core.SandboxEnvironment(clientId, clientSecret);
        const client = new paypal.core.PayPalHttpClient(environment);
  
        try{
        export const processInvoicePaypalPayment = async (user, data) =&gt; {
               const customerId = user.customer,
               { invoice: invoiceId, orderId: orderID } = data;
  
               let request = new paypal.orders.OrdersGetRequest(orderID);
         const createOrder = async () =&gt; {
         const response = await client.execute(request);
  
         return { ok: true, data: { _id: invoiceId, payment: response.result } };
  
         };
  
         const result = await createOrder();
  
         }
         }catch (err) {
           console.log(err);
         }
  </code></pre>
  
  <p>And the result is:</p>
  
  <pre><code>  { Error: {"name":"RESOURCE_NOT_FOUND","details": 
    [{"location":"path","issue":"INVALID_RESOURCE_ID","description":"Specified resource ID does not exist. Please check the resource ID and try again."}],"message":"The specified resource does not exist.","debug_id":"c3b5026d6dd74","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID","rel":"information_link","method":"GET"}]}
  </code></pre>
  
  <p>How can i solve this issue? Any help and Suggestion will be greatly appreciated.</p>