Search code examples
ruby-on-rails-3.2authorize.netactivemerchant

Authorize.net CIM Active Merchant -- User authentication failed due to invalid authentication values


I have deployed my live app with working payment gateway but I still need somewhere to test so created a account with sandbox.authorize.net and got a new api key.

Now when I try these details in development/staging I get -

User authentication failed due to invalid authentication values

When accessing authorize.net

Does active merchant work with sandbox.authorize.net? testing seems to work fine with a gateway set in test mode but not with a sandbox account.


Solution

  • I managed to get this working with the following code:

    ActiveMerchant::Billing::Base.mode = :test
    ActiveMerchant::Billing::AuthorizeNetCimGateway.new( 
      :login => login, 
      :password => password
    )
    

    Orginally my connector looked like this(as the api shows it):

    ActiveMerchant::Billing::AuthorizeNetCimGateway.new( 
      :login =>    login, 
      :password => password,
      :test        true
    )