Same problem I'm afraid.. Here's my PHP curl request if it helps.. function makePayment($accessToken){
$data = '{
"intent":"sale",
"redirect_urls":{
"return_url":"https://www.excellent-way.com/payment-return",
"cancel_url":"https://www.excellent-way.com/payment-return"
},
"payer":{
"payment_method":"paypal"
},
"transactions":[
{
"amount":{
"total":"7.47",
"currency":"USD"
},
"description":"This is the payment transaction description."
}
]
}';
$verbose = fopen('php://temp', 'w+');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_VERBOSE => true,
CURLOPT_STDERR => $verbose,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_URL => "https://api.sandbox.paypal.com/v1/payments/payment",
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Accept-Language: en_US',
'content-type: application/x-www-form-urlencoded',
'Authorization: Bearer ' . $accessToken
),
CURLOPT_POSTFIELDS => $data,
));
$response = curl_exec($curl);
if ($response === FALSE) {
printf("cUrl error (#%d): %s<br>\n", curl_errno($curl),
htmlspecialchars(curl_error($curl)));
}
rewind($verbose);
$verboseLog = stream_get_contents($verbose);
echo "<pre>", htmlspecialchars($verboseLog), "</pre>\n";
curl_close($curl);
return json_decode($response,true);
} Thanks
... View more