helmutschneider / swish-php

PHP-wrapper for the Swish merchant api
MIT License
40 stars 19 forks source link

Getting cURL error 35 #12

Closed dicktornfeldt closed 5 years ago

dicktornfeldt commented 5 years ago

Really appreciate this repo, their API documentation is somewhat over my head.

However cant really get it to work locally. My implementation:

$pr = new PaymentRequest([
      'callbackUrl' => 'https://localhost/swish',
      'payeePaymentReference' => $order_id,
      'payerAlias' => $customer_phone,
      'payeeAlias' => '1231181189',
      'amount' => 1, //$total
      'currency' => 'SEK',
      'message' => 'Köp'
    ]);

    $rootCert = ABSPATH .'certs/root.pem';
    $clientCert = [ABSPATH . 'certs/swish.pem', ''];

    $client = Client::make($rootCert, $clientCert,  Client::SWISH_TEST_URL);

    $id = $client->createPaymentRequest($pr);

My error:


[11-Jan-2019 10:08:14 UTC] PHP Fatal error:  Uncaught GuzzleHttp\Exception\ConnectException: cURL error 35: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) in /Users/home/www/rfsu/wp-content/themes/rfsu/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:185
Stack trace:
#0 /Users/home/www/rfsu/wp-content/themes/rfsu/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(149): GuzzleHttp\Handler\CurlFactory::createRejection(Object(GuzzleHttp\Handler\EasyHandle), Array)
#1 /Users/home/www/rfsu/wp-content/themes/rfsu/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(102): GuzzleHttp\Handler\CurlFactory::finishError(Object(GuzzleHttp\Handler\CurlHandler), Object(GuzzleHttp\Handler\EasyHandle), Object(GuzzleHttp\Handler\CurlFactory))
#2 /Users/home/www/rfsu/wp-content/themes/rfsu/api/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish(Object(GuzzleHttp\Handler\CurlHandler), Object(Gu in /Users/home/www/rfsu/wp-content/themes/rfsu/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 185```
dicktornfeldt commented 5 years ago

NVM, my bad

helmutschneider commented 5 years ago

For reference - this error usually happens if your cURL defaults to SSLv3 instead of TLS. Most of the time the solution is to just upgrade your PHP and/or cURL.