I'm trying to use Active Merchant and PayPal to process payments on a staging server. I have everything setup as follows.
However, when I run the code (below), I receive 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 am 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")
Anyone experience this problem or know of a solution to the SSL failing?
Well, I eventually gave up and instead of using the certificate method of validation, I used the PayPal signature.
So I removed the PEM file and am now using
gateway = ActiveMerchant::Billing::PaypalGateway.new(:login => "sales_api1.example.com", :password => "password", :signature => "fake_signature")
and it works great. So... yeah, if anyone else if having problems with Active Merchant and PayPal, try swapping your authentication methods from certificate to signature.