Testing authentication for Authorize.net CIM account

53 views
Skip to first unread message

Tom Hoen

unread,
Nov 12, 2012, 10:34:22 AM11/12/12
to activem...@googlegroups.com
Our site uses several authorize.net accounts and we regularly update the api password. Thus, i would like a way to easily verify that a valid connection has been obtained with the authorize.net production server.

I was hoping that activemerchant would provide a method that would test authorize.net CIM authentication without having to make a specific CIM related request (get_customer_profile, create_customer_profile, etc), or that initialization of the gateway (ActiveMerchant::Billing::AuthorizeNetCimGateway.new()) would fail or return an error code if the login and password were not correct.

Currently, I am using get_customer_profile and passing in an invalid customer profile id: response = gateway.get_customer_profile(:customer_profile_id => 0).

I then check for a specific error code denoting failed authentication: !response.success? and response.params["messages"]["message"]["code"] = "E00007"

I am uncomfortable with this approach because I don't know that the "E00007" code is the only code that will be returned and it just doesn't feel right.

Are there better approaches that you can suggest? Is there some way to force authentication at initialization of the gateway?

Best,
Tom
Reply all
Reply to author
Forward
0 new messages