SSL error when using Active Merchant and PayPal

I am trying to use Active Merchant and PayPal to process payments on an intermediate server. I have all the settings as follows.

  • Set up a PayPal merchant account
  • Put credentials in Active Merchant / PayPal configuration
  • We downloaded PayPal PEM and posted it on my server
  • Bought and uploaded SSL certificate from PositiveSSL

However, when I run the code (below), I get this error:

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read finished A: sslv3 alert handshake failure 

This is the code I'm using.

 ActiveMerchant::Billing::PaypalGateway.pem_file = File.read("#{Rails.root}/config/cert_key_pem.pem") @credit_card ||= ActiveMerchant::Billing::CreditCard.new(:brand => "Visa", :number => "4242424242424242", :verification_value => "123", :month => "11", :year => "2016", :first_name => "John", :last_name => "Doe") gateway = ActiveMerchant::Billing::PaypalGateway.new(:login => "sales_api1.example.com", :password => "password") response = gateway.authorize(150, @credit_card, :ip=>"123.123.123.1") 

Does anyone experience this problem or know that the SSL solution is not working?

+4
source share
2 answers

Well, in the end I gave up and instead of using the certificate verification method, I used the PayPal signature.

So, I deleted the PEM file and now use

 gateway = ActiveMerchant::Billing::PaypalGateway.new(:login => "sales_api1.example.com", :password => "password", :signature => "fake_signature") 

and it works great. So ... yes, if someone else, if you have problems with Active Merchant and PayPal, try replacing your authentication methods from the certificate with a signature.

+2
source

Source: https://habr.com/ru/post/1438320/


All Articles