簡體   English   中英

使用Active Merchant和PayPal時出現SSL錯誤

[英]SSL error when using Active Merchant and PayPal

我正在嘗試使用Active Merchant和PayPal來處理臨時服務器上的付款。 我有如下設置的一切。

  1. 設置PayPal商家帳戶
  2. 將憑據放入Active Merchant / PayPal配置中
  3. 下載PayPal PEM並將其放在我的服務器上
  4. 從PositiveSSL購買並上傳了SSL證書

但是,當我運行代碼(下面)時,我收到此錯誤:

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

這是我正在使用的代碼

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")

任何人遇到此問題或知道SSL失敗的解決方案?

好吧,我最終放棄了,而不是使用驗證的證書方法,我使用了PayPal簽名。

所以我刪除了PEM文件,現在正在使用

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

它很棒。 所以...是的,如果有其他人如果遇到Active Merchant和PayPal的問題,請嘗試將您的身份驗證方法從證書交換到簽名。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM