0

Im trying to get up and running with installing express checkout using nvp. I have set up the business account in sandbox and generated the api access signature credentials.

$this->NVPCredentials   =   'USER=' . credentials['username'];
$this->NVPCredentials   .=  '&PWD=' . credentials['password']; 
$this->NVPCredentials   .=  '&VERSION=108.0';
$this->NVPCredentials   .=  '&SIGNATURE=' . credentials['signature'];

wrapped the credentials as shown above + all the details required for the payment details to create the nvp string and below is the curl call

$curl = curl_init('https://api-3t.sandbox.paypal.com/nvp');
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $Request);

$Request holds the nvp string passed.

I made sure that all the required fields are set but i'm always getting a 10002 | Authentication/Authorization Failed | You do not have permissions to make this API call

I thought it was a problem with the signature so I removed the signature and instead created a certificate file, downloaded it from the sandbox account and used that instead, but still the same error. No matter what I change, its always throwing the same error.

curl_setopt($curl, CURLOPT_SSLCERT, $pathtocertpem);

I'm running out of ideas of stuff to try. Please do not hesitate to ask for more details and If anyone has any idea what I might be doing wrong please do not hesitate. It would be greatly appreciated.

Regards,

Devo

devopashak
  • 29
  • 2

1 Answers1

0

I was able to solve the problem by passing an array instead of the nvpstring to curl and then using http_build_query function to format all the params

curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($Request))

this seems to have done the trick.

devopashak
  • 29
  • 2