Capistrano and ActiveMerchant Paypal will not Deploy due to ArgumentError: An API Certificate or API Signature is required to make requests to PayPal

Capistrano and ActiveMerchant Paypal will not Deploy due to ArgumentError: An API Certificate or API Signature is required to make requests to PayPal

我有一个电子商务网站,我通过 ActiveMechant 使用贝宝。在开发中一切正常,但是当我部署时它给我这个错误...

ArgumentError: An API Certificate or API Signature is required to make requests to PayPal
/var/www/ross_store/shared/bundle/ruby/2.2.0/gems/activemerchant-1.48.0/lib/active_merchant/billing/gateways/paypal/paypal_common_api.rb:78:in `initialize'

我的 production.rb 配置看起来像...

config.after_initialize do
ActiveMerchant::Billing::Base.mode = :production
paypal_options = {
:login => ENV["PAYPAL_USER"],
:password => ENV["PAYPAL_PASS"],
:signature => ENV["PAYPAL_SIGNATURE"]
}
    ::EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options)
end

主机上的所有 ENV 变量都可用。

类似于 API Signature is required to make requests to PayPal error, I have an API signature set already,但在 Heroku 上不同。

有人有什么想法吗?

非常感谢。

亚历克斯

是的,我确定这不是一个好方法,但我将 ActiveMerchant initilizer 移到了它自己的模块中并移出了 production.rb,一切看起来都很好。如果有人知道为什么这是一个 想法的任何充分理由,请告诉我,但现在它起作用了!

干杯