title: Making Paypal payment using REST API in PHP
body: <p>I'm not clear how to put this code example into PHP's CURL structure, specifically, the -d handle.</p>
  
  <pre><code>curl -v https://api.sandbox.paypal.com/v1/payments/payment \
  -H 'Content-Type:application/json' \
  -H 'Authorization:Bearer EOjEJigcsRhdOgD7_76lPfrr45UfuI43zzNzTktUk1MK' \
  -d '{
    "intent":"sale",
    "redirect_urls":{
      "return_url":"http://&lt;return URL here&gt;",
      "cancel_url":"http://&lt;cancel URL here&gt;"
    },
    "payer":{
      "payment_method":"paypal"
    },
    "transactions":[
      {
        "amount":{
          "total":"7.47",
          "currency":"USD"
        },
        "description":"This is the payment transaction description."
      }
    ]
  }'
  </code></pre>
  
  <p>I've used the following test call ok, but don't know how to extend that to the example above.</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token");
  curl_setopt($ch, CURLOPT_HEADER, false);
  curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
  curl_setopt($ch, CURLOPT_USERPWD, $clientId.":".$secret);
  curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
  
  $result = curl_exec($ch);
  
  if(empty($result))die("Error: No response.");
  else
  {
      $json = json_decode($result);
      print_r($json-&gt;access_token);
  }
  </code></pre>