Search code examples
ruby-on-railsrubyauthorize.netactivemerchant

Authorize.net in Rails - User Authentication failed due to invalid authentication values


I am building a client's ecommerce website. I'm at the latest stages, where I have to integrate the payment system. I signed up for a developer account for Authorize.net in order to test the system. I've ran into a roadblock here

I submitted my payment form, and found the following in my Development Logs

User authentication failed due to invalid authentication values

I set up my gateway as followed, based on my login information to Authorize.net

gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(
  :login => "mylogin",
  :password => "mypassword",
  :test => false

)

Apparently, I'm missing something, but I'm not sure what it is. I watched the RailsCasts videos 144 and 145. I just substituted the gateway to AuthorizeNetGateWay.

Where am I going wrong here?

Here is my development.rb file

config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::AuthorizeNetGateway.new(
  :login => "mylogin",
  :password => "mypassword",
  #:signature => "AGjv6SW.mTiKxtkm6L9DcSUCUgePAUDQ3L-kTdszkPG8mRfjaRZDYtSu"
        :test_requests => false
)
end

Could the problem be ActiveMerchant::Billing::Base.mode = :test considering this is my Development Environment file?


Solution

  • If you're using a developer account set test to true to use the developer server:

    :test => true