title: Paypal API v2 response The specified resource does not exist
body: <p>I'm trying to <strong>/capture</strong> the funds in server side but I got the error message "The specified resource does not exist".</p>
  
  <p>I have placed Paypal script configured for sandbox nad EUR currency:</p>
  
  <pre><code>&lt;script src='https://www.paypal.com/sdk/js?client-id=sb&amp;currency=EUR&amp;commit=true&amp;disable-funding=card,credit' &gt;&lt;/script&gt;
  </code></pre>
  
  <p>Then, configured the button as described below</p>
  
  <pre><code>paypal.Buttons( {
         createOrder : function( data, actions ) {
                       return actions.order.create( {
                              "intent"         : "CAPTURE",
                              "purchase_units" : [ { amount : { "value" : cart-total-amount,
                                                                "currency_code" : "EUR",
                                                                } } ] } );
                              },
         onApprove: function( data, actions ) {
                     /*
                     MY SERVER API
                     */
                     _this.api( "my-server-api-url/cart/submit/",
                                 { "items" : _this.cart.items,
                                   "invoice" : _this.cart.invoice,
                                   "paymentmethod" : "paypal",
                                   "orderid"  : data.orderID,
                                   "payerid" : data.payerID,
                                    }, function( data ) {
                                   alert( data.message );
                                   } );
                       },
         style: { "layout" : "horizontal",
                             "color" : "blue",
                             "shape" : "rect",
                             "label" : "paypal",
                             "tagline" : false,
                              "height" : 40,
                             },
                    } ).render( "#paypal-button-id" );
  </code></pre>
  
  <p>Just to explain the code:</p>
  
  <p>_this = reference to my class/library</p>
  
  <p>_this.cart.items = ITEMS ON INVOCE</p>
  
  <p>_this.cart.invoice = INVOICE DETAILS</p>
  
  <p>$orderid = data.orderID (from js above)</p>
  
  <p>Then, on server side I get correctly the token from Paypal (variable $accesstoken) but I got an error when I try to capture the funds.</p>
  
  <pre><code>  $curl = curl_init( "https://api.sandbox.paypal.com/v2/checkout/orders/" . $orderid . "/capture" );
    curl_setopt( $curl, CURLOPT_POST, true );
    curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, false );
    curl_setopt( $curl, CURLOPT_HEADER, false );
    curl_setopt( $curl, CURLINFO_HEADER_OUT, true );
    curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $curl, CURLOPT_HTTPHEADER, [ "Content-Type: application/json",
                                              "Authorization: Bearer " . $accesstoken,
                                              "Accept: application/json",
                                               ] );
    $result = curl_exec( $curl );
    curl_close( $ch );
    curl_close( $curl );
  </code></pre>
  
  <p>Error (json_decoded and then print_r):</p>
  
  <pre><code>stdClass Object
  (
  [name] =&gt; RESOURCE_NOT_FOUND
  [details] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [location] =&gt; path
                  [issue] =&gt; INVALID_RESOURCE_ID
                  [description] =&gt; Specified resource ID does not exist. Please check the resource ID and try again.
              )
  
      )
  
  [message] =&gt; The specified resource does not exist.
  [debug_id] =&gt; cb446322c3a2c
  [links] =&gt; Array
      (
          [0] =&gt; stdClass Object
              (
                  [href] =&gt; https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID
                  [rel] =&gt; information_link
                  [method] =&gt; GET
              )
      )
  )
  </code></pre>
  
  <p>Basically I create an order on client side (using Paypal API via Js) and then I capture it on server side.</p>
  
  <p>What I'm missing in this process? </p>