Question

I am trying to make a simple payment through my paypal sandbox from my local machine. I am using the Omnipay library in Codeigniter.

I setup a sandbox account at developer.paypal.com and a test application. This is the code I am using:

$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername([username]);
$gateway->setPassword([password]);
$gateway->setSignature([signature]);
$gateway->setTestMode(true);

$params = array(
    'amount' => '1.00',
    'currency' => 'USD',
    'description' => 'test purchase',
    'transactionId' => '123',
    'transactionReference' => '123ref',
    'returnUrl' => [returnUrl],
    'cancelUrl' => [cancelUrl],
);

$response = $gateway->purchase($params);

I am getting the following error:

Fatal error: Uncaught exception 'Buzz\Exception\ClientException' with message 'SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed' in...

I installed omnipay using composer with something called BUZZ. I am pretty new to doing paypal transactions online and not sure If I need to setup a local ssl certificate. If I do, can someone point me in the direction for setting that up?

Thanks.

Was it helpful?

Solution

That sounds pretty dodgy. Omnipay uses Guzzle to make the HTTPS requests to PayPal, and Guzzle bundles the latest root SSL certificates for you. So you should not see any HTTPS warnings.

Does this work locally for you? Have you tried different servers? If you are on shared hosting it is possible that your web host is trying to proxy your requests, which means they are essentially performing a man in the middle attack, potentially making your website insecure.

EDIT: Just noticed that error is actually coming from Buzz, not Guzzle. How did you install that? What does your composer.json file look like? Which version of Omnipay are you running? If you upgrade to the latest version of Omnipay (2.0) it will use Guzzle internally and this should fix the SSL error.

OTHER TIPS

I found an answer on omnipay's issues page (at least for testing): https://github.com/omnipay/omnipay/issues/13

For Local Testing Only:

Add these lines to the file /buzz/lib/Buzz/Client/Curl.php, just before curl_exec method...

curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top