[Ruby] How to solve OpenSSL::SSL::SSLError: SSL_connect which occurs in paypal-sdk-rest gem of Ruby

less than 1 minute read

More details will be added later.


From around the evening of August 11, 2020 (Japan time), the payment using the paypal-sdk-rest gem causes the following error.

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate)

How to respond

Download the latest cacert.pem from https://curl.haxx.se/docs/caextract.html, place it in config/certs/cacert.pem and put it in config/paypal.yml. Add ca_file setting of ssl_options.


development: &default
  mode: sandbox
  client_id: xxx
  client_secret: xxx
    ca_file: config/certs/cacert.pem
  mode: live
  client_id: xxx
  client_secret: xxx

With this setting, we confirmed that both local development environment and production environment work as expected.

Alternative solution