title: PayPal JavaScript SDK client side does not post to server
body: <p>How i should post orderID to server using paypal SDK? The example code does not work neither on localhost nor on remote host. Post is empty after i submit PayPal button.</p>
  
  <p>According,
  <a href="https://developer.paypal.com/docs/checkout/integrate/#6-verify-the-transaction" rel="nofollow noreferrer">https://developer.paypal.com/docs/checkout/integrate/#6-verify-the-transaction</a></p>
  
  <p>PayBundle\Resources\actions\ppal\ppalAction_brt_stkovr.php </p>
  
  <pre><code>&lt;?php
  
  use PayBundle\actions\Order;  
  
  echo "&lt;br&gt;&lt;br&gt; POST ="; print_r($_POST);  
  file_put_contents( PHP_EOL . PHP_EOL . __DIR__ .'/out.php', json_encode( $_POST ) .' from '.__FILE__, FILE_APPEND );
  
  include_once ( PATH_ACTIONS_PAY . '/ppal/__init.php' );
  include_once ( PATH_ACTIONS_PAY . '/ppal/__payAInit.php' );
  
  require_once PATH_VENDOR . '/braintree/braintree_php/lib/Braintree.php';
  
  use Sample\PayPalClient; 
  use PayPalCheckoutSdk\Orders\OrdersGetRequest;
  
  Braintree_Configuration::environment( 'sandbox' );
  Braintree_Configuration::merchantId( 'x' );
  Braintree_Configuration::publicKey( 'y' );
  Braintree_Configuration::privateKey( 'z' );
  
  
  if( isset($_POST['payPp'] ) ) {  
  
      include_once ( PATH_ACTIONS_PAY . '/ppal/pay/'.$this-&gt;vdArr['lang'].'/__Bk.php' ); 
      echo "&lt;br&gt; from ppalAction orderID = "; print_r($this-&gt;vdArr['orderID']);
  
      if ( !count(debug_backtrace()) ) {
          $ppalOrder = new GetOrder();
          $ppalOrder-&gt;getOrder( $this-&gt;vdArr['orderID'], true);
      } // if ( !count(debug_backtrace())  
  
  } // if( isset($_POST['paypalA'] ) ) {
  
  else {
      $this-&gt;vdArr['tokenPpal'] = Braintree_ClientToken::generate(); 
  }
  </code></pre>
  
  <p>client side code :</p>
  
  <pre><code>&lt;script type='text/javascript'  &gt;
  
  window.onload = function() {
  
      paypal.Buttons({
  
          createOrder: function(data, actions) {
            return actions.order.create({
              purchase_units: [{
                amount: {
                  value: '0.01'
                }
              }]
            });  
          },
  
          onApprove: function( data, actions ) {
              return actions.order.capture().then( function(details) {
                  //alert('Transaction completed by ' + details.payer.name.given_name);
                  // Call your server to save the transaction
                  //console.log('Transaction completed' ); alert(details); 
                  console.log( 'data.orderID = ' + data.orderID ); 
                  document.getElementById('orderID').value = data.orderID;
                  console.log('data'); console.log(data); 
                  console.log('Transaction completed by ' + details.payer.name.given_name );
                  //return fetch('/paypal-transaction-complete', {
                  return fetch( 'https://typejoy.biz/pay/ppal_1025/EN/pay', {
                      method: 'POST',
                      body: JSON.stringify({
                          orderID: data.orderID,
                          payPp: 1
                      })
                  }); // return fetch( 'https://typejoy.biz/pay/ppal_1025/EN/pay
              }); // return actions.order.capture().then( function(details
          } // onApprove: function(data, actions
  
        }).render('#payPp');  
  
  } // window.onload = function() {
  &lt;/script&gt;
  </code></pre>
  
  <p>In clinet side console i can log orderID, but i do not understand how to pass it to the server side. How fetch function works? shall i use other type of function? How to make this in correct way?</p>