【问题标题】:SSL error when using Active Merchant and PayPal使用 Active Merchant 和 PayPal 时出现 SSL 错误
【发布时间】:2012-09-28 06:39:08
【问题描述】:

我正在尝试使用 Active Merchant 和 PayPal 在暂存服务器上处理付款。我的一切设置如下。

  1. 设置 PayPal 商家帐户
  2. 将凭据放入活动商家/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 失败的解决方案吗?

【问题讨论】:

    标签: ruby-on-rails ruby ssl paypal activemerchant


    【解决方案1】:

    好吧,我最终放弃了,我没有使用证书验证方法,而是使用了 PayPal 签名。

    所以我删除了 PEM 文件,现在正在使用

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

    而且效果很好。所以...是的,如果其他人在使用 Active Merchant 和 PayPal 时遇到问题,请尝试将您的身份验证方法从证书换成签名。

    【讨论】:

      【解决方案2】:
      猜你喜欢
      • 2012-02-03
      • 2011-03-01
      • 2010-12-05
      • 2021-05-28
      • 1970-01-01
      • 2014-11-04
      • 1970-01-01
      • 2016-08-04
      • 2015-05-19
      相关资源
      最近更新 更多