I set it up basically just like the demo on the AM front page:
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(:login =>
login, :password => password)
Where password is my transaction key. The login and key are current
and functional (we are using them in other non-ruby apps), but when I
do:
response = gateway.authorize(1000, creditcard)
I get back:
#<ActiveMerchant::Billing::AuthorizeNetGateway:0x37d66a4
@ssl_strict=false,
@response={:transaction_id=>"0", :avs_message=>"Address verification
not applicable for this
transaction", :response_reason_code=>"13", :response_reason_text=>"The
merchant login ID or password is invalid or the account is
inactive.", :avs_result_code=>"P", :response_code=>3, :card_code=>nil},
@options={:login=>"xxxxxx", :password=>"XXXXXXX"}>
I'm just running this in a console for testing. Any ideas?
You have to make sure that the account you're using matches the
environment, and thus URL endpoint, that ActiveMerchant uses.
For example, if you have a test Authorize.net account you would want
to make sure that ActiveMerchant is running in the test mode. It runs
in production mode by default.
# Test mode
ActiveMerchant::Billing::Base.gateway_mode = :test
# Production mode (default if no mode is set)
ActiveMerchant::Billing::Base.gateway_mode = :production
--
Cody Fauser
http://shopify.com - e-commerce done right
http://www.codyfauser.com - blog
http://www.oreilly.com/catalog/rjsrails - RJS Templates for Rails
ActiveMerchant::Billing::Base.gateway_mode = :test
To set it to test mode on a per-transaction basis, but maybe that's
not how it works? I believe our other apps use the X_TEST_REQUEST
field to process test transactions with a live account.
Are test accounts totally isolated from regular accounts (ie. regular
account can't use the test server)? In the integration guide I also
noticed a third subdomain https://certification.authorize.net/.
On May 3, 11:23 am, "Cody Fauser" <codyfau...@gmail.com> wrote:
> Is the account you're trying to use a test Authorize.net account?
>
> You have to make sure that the account you're using matches the
> environment, and thus URL endpoint, that ActiveMerchant uses.
>
> For example, if you have a test Authorize.net account you would want
> to make sure that ActiveMerchant is running in the test mode. It runs
> in production mode by default.
>
> # Test mode
> ActiveMerchant::Billing::Base.gateway_mode = :test
>
> # Production mode (default if no mode is set)
> ActiveMerchant::Billing::Base.gateway_mode = :production
>
post[:test_request] = @options[:test] ? "TRUE" : "FALSE"
In the post_data method so you can do per-connection testing of live
accounts and it worked like a charm. Not sure if you'd like to
include it.
If you want to set x_test_request to true for any request with a live
or test account then you construct the gateway with the :test => true
option.
In summary, :test => true sets x_test_request and the
Base.gateway_mode changes the endpoint URL. You can actually set
x_test_request to true on requests going to the test server.
On 5/3/07, dasil003 <gabr...@gmail.com> wrote:
>
On May 3, 12:10 pm, "Cody Fauser" <codyfau...@gmail.com> wrote:
> That code is already there. Basically, the way it works is if you are
> using a test account then you set
> ActiveMerchant::Billing::Base.gateway_mode = :test so that you're
> using the TEST_URL.
>
> If you want to set x_test_request to true for any request with a live
> or test account then you construct the gateway with the :test => true
> option.
>
> In summary, :test => true sets x_test_request and the
> Base.gateway_mode changes the endpoint URL. You can actually set
> x_test_request to true on requests going to the test server.
>
> On 5/3/07, dasil003 <gabrie...@gmail.com> wrote:
>
>
>
> > Okay, I added the line:
>
> > post[:test_request] = @options[:test] ? "TRUE" : "FALSE"
>
> > In the post_data method so you can do per-connection testing of live
> > accounts and it worked like a charm. Not sure if you'd like to
> > include it.
>
> --