title: PayPal Rest API for Payments returns NULL in the sandbox
body: <p>I've a sandbox account with PayPal. I can retrieve the token via the api using curl on PHP, however processing a test card just returns null. Anyone see a problem with the code? Is this a known problem with the PayPal sandbox? The client in the below snippet are fabricated, however, as mentioned before, using my real credentials I can successfully make a call to retrieve the token. </p>
  
  <p>The PHP to generate the request: </p>
  
  <pre><code> &lt;?php
  
      class psPayPal {
  
      private $tokenUrl = 'https://api.sandbox.paypal.com/v1/oauth2/token';
      private $paymentUrl = 'https://api.sandbox.paypal.com/v1/payments/payment';
      private $client = 'dlkjasdfkja;skdjfaksdjfkajsdkfjaejkjefkekjakdjfaksjdfadjf;ja';
      private $secret = 'klj;akjdfjeieiadfaldkjfelkajsdfkjaejeiejisadif;alkdsfj;kjjie';
      private $token;
      private $tokenHandle;
      private $paymentHandle;
  
      public function __construct()
      {
          $this-&gt;tokenHandle = curl_init($this-&gt;tokenUrl);
          $this-&gt;buildTokenRequest();
      }
  
      public function buildTokenRequest()
      {
          $header = array(
              'Accept: application/json',
              'Accept-Language: en_US'
          );
  
          $user = $this-&gt;client . ':' . $this-&gt;secret;
  
          $data = 'grant_type=client_credentials';
  
          curl_setopt($this-&gt;tokenHandle, CURLOPT_HTTPHEADER, $header);
          curl_setopt($this-&gt;tokenHandle, CURLOPT_USERPWD, $user);
          curl_setopt($this-&gt;tokenHandle, CURLOPT_POSTFIELDS, $data);
          curl_setopt($this-&gt;tokenHandle, CURLOPT_RETURNTRANSFER, true);
  
          $this-&gt;commitTokenRequest();
      }
  
      public function commitTokenRequest()
      {
          $response = json_decode(curl_exec($this-&gt;tokenHandle));
  
          $this-&gt;token = $response-&gt;access_token;
  
          curl_close($this-&gt;tokenHandle);
      }
  
      public function buildPaymentRequest($cost = '', $description = '')
      {
          $this-&gt;paymentHandle = curl_init($this-&gt;paymentUrl);
  
          $header = array(
              'Accept: application/json',
              'Accept-Language: en_US',
              'Authorization:Bearer ' . $this-&gt;token
          );
  
          $data = array(
              'intent' =&gt; 'sale',
              'payer' =&gt; array(
                  'payment_method' =&gt; 'credit_card',
                  'funding_instruments' =&gt; array(
                          array(
                              'credit_card' =&gt; array(
                                  'number' =&gt; '5500005555555559',
                                  'type' =&gt; 'mastercard',
                                  'expire_year'=&gt; '2018',
                                  'cvv2'=&gt; '111',
                                  'first_name'=&gt; 'Joe',
                                  'last_name' =&gt; 'Shopper'
                              )
                          )
                  )
              ),
              'transactions' =&gt; array(
                      array(
                          'amount' =&gt; array(
                              'total' =&gt; '39.54',
                              'currency' =&gt; 'USD'
                          ),
                          'description' =&gt; 'This is my descrription for hats'
                      )
              )
          );
          $d = json_encode($data);
  
          curl_setopt($this-&gt;paymentHandle, CURLOPT_HTTPHEADER, $header);
          curl_setopt($this-&gt;paymentHandle, CURLOPT_POSTFIELDS, $d);
          curl_setopt($this-&gt;paymentHandle, CURLOPT_RETURNTRANSFER, true);
  
          $this-&gt;commitPaymentRequest();
      }
  
      public function commitPaymentRequest()
      {
          $response = json_decode(curl_exec($this-&gt;paymentHandle));
  
          var_dump($response);
  
          curl_close($this-&gt;paymentHandle);
      }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>I've tried with a variety of options, although I believe the code above to be complete. I've also validated the jSON I'm sending with JSON Lint. The JSON follows: </p>
  
  <pre><code>{
  "intent": "sale",
  "payer": {
      "payment_method": "credit_card",
      "funding_instruments": [
          {
              "credit_card": {
                  "number": "5500005555555559",
                  "type": "mastercard",
                  "expire_year": "2018",
                  "cvv2": "111",
                  "first_name": "Joe",
                  "last_name": "Shopper"
              }
          }
      ]
  },
  "transactions": [
      {
          "amount": {
              "total": "39.54",
              "currency": "USD"
          },
          "description": "This is my descrription for hats"
      }
  ]
  </code></pre>
  
  <p>}</p>
  
  <p>Any suggestions greatly appreciated! </p>