Search code examples
ruby-on-railsrubypaypalactivemerchant

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


I have an eCommerce site that I use paypal via ActiveMechant. In Development everything works well, but when I deploy it gives me this error...

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'

My production.rb config looks like...

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

All the ENV vars are available on the Host machine.

Similar to API Signature is required to make requests to PayPal error, I have an API signature set already but not on Heroku.

Anyone any Ideas?

Many Thanks in advance.

Alex


Solution

  • Right, Im sure this is not a good way to do it but I moved the ActiveMerchant initilizer into its own Module and out of the production.rb and all seems well. If anyone knows any good reasons why this is a bad idea, please do let me know, but for now its working!

    Cheers