I try to set up a Paypal payment method on a website I'm working on.
However when I send a cUrl request in PHP to the sandbox I get this cUrl error :
Error 77 : Problem with the SSL CA cert (path? access rights?)
Here is my code :
$request = "&USER=myUser".
"&PWD=myPwd".
"&SIGNATURE=mySignature".
"&METHOD=SetExpressCheckout".
"&CANCELURL=myCancelUrl".
"&RETURNURL=myReturnUrl".
"&PAYMENTREQUEST_0_AMT=myPaymentAmount".
"&PAYMENTREQUEST_0_CURRENCYCODE=EUR".
"&PAYMENTREQUEST_0_PAYMENTACTION=SALE".
"&LOCALECODE=countryCode".
"&VERSION=122";
$ch = curl_init("https://api-3t.sandbox.paypal.com/nvp");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
$result_paypal = curl_exec($ch);
if(!$result_paypal)
echo 'Error '.curl_errno($ch).' : '.curl_error($ch);
Paypal sandbox url, credentials, url parameters are fine as when I click my express checkout button I get the token in the opened page :
TOKEN=EC%2d7NT30345MB*******&TIMESTAMP=2015%2d05%2d28T11%3a36%3a57Z&CORRELATIONID=b539dd0******&ACK=Success&VERSION=122&BUILD=16837281
Facts :
- request is fine, obviously (I get back the token),
- As I use a
signature
in the call I shouldn't need a certificate, - Tried with and without the
?
at the end of the URL (and did modify accordingly my call) - Changed
CURLOPT_SSL_VERIFYPEER
to 1 and 0, didn't change anything - Tried http_build_query() with an array of parameters, same result
I don't know what I could have missed.
Did anyone encounter this ?