The https URL is, so you need to enable SSL on your Net :: HTTP.
require 'openssl' paypal_uri = URI.parse('https://www.sandbox.paypal.com/cgi-bin/webscr') req = Net::HTTP::Post.new(paypal_uri.path) req.set_form_data({:tx => @subscription.tx, :at => IDENTITY_TOKEN, :cmd => "_notify-sync"}) sock = Net::HTTP.new(paypal_uri.host, 443) sock.use_ssl = true store = OpenSSL::X509::Store.new store.add_cert OpenSSL::X509::Certificate.new(File.new('paypal.pem')) store.add_cert OpenSSL::X509::Certificate.new(File.new('paypal2.pem')) sock.cert_store = store sock.start do |http| response = http.request(req) end
To get the CA certificates paypal.pem and paypal2.pem, just go to the PayPal URL manually, I will describe it for FireFox. Click the green icon to the left of your address bar, open a dialog box, see the certificate, details, and then export the two VeriSign certificates as paypal.pem and paypal2.pem. Put them in the same folder as your script. That should cure your problems!
source share