Integration and Testing

Authorize.Net API questions and help with your payment integration.

Posts: 2
Registered: ‎10-20-2018

activemerchant-- The transaction cannot be found

I am using the activemerchant 1.85.0 Gem (2018-Sep) with Rails 5.2 in order to access an sandbox account. Unfortunately this is proving to be a futile effort. I hereby grovel for clues...


The basic issue is that I attempt to authorize a transaction first, and then capture the payment. Everything's ok up until the capture, which fails because of "The transaction cannot be found"


One clue that I've found so far is to reference a Solution ID, using one of the sandbox solution ids, somewhere in here. Unfortunately, it's not at all clear to me where I would insert this info.


More particularly...


gateway = ActiveMerchant::Billing::Base.gateway(:authorize_net).new(

  :login => 'our sandbox id',

  :password => 'our password' )


amt = calculate the the amount credit_card = a card that is checked to be valid


purchase_options = { customer name, billing address, etc... }


auth_response = gateway.authorize(amt, credit_card, purchase_options )


This produces...


#:authorize, "response_code"=>1, "response_reason_code"=>"1", "response_reason_text"=>"This transaction has been approved", "avs_result_code"=>"Y", "transaction_id"=>"60110267604", "card_code"=>"P", "authorization_code"=>"D", "cardholder_authentication_code"=>"2", "account_number"=>"1111", "test_request"=>"0", "full_response_code"=>"I00001"}, @@message="This transaction has been approved", @success=true, @Test=true, @@authorization="60110267604#1111#authorize", @fraud_review=false, @error_code=nil, @emv_authorization=nil, @avs_result={"code"=>"Y", "message"=>"Street address and 5-digit postal code match.", "street_match"=>"Y", "postal_match"=>"Y"}, @cvv_result={"code"=>"P", "message"=>"CVV not processed"}>


Which looks fairly optimistic.  But then...


capture_response = Order.gateway.capture(amount, auth_response.authorization, purchase_options)




#:capture, "response_code"=>3, "response_reason_code"=>"16", "response_reason_text"=>"The transaction cannot be found", "avs_result_code"=>"P", "transaction_id"=>"0", "card_code"=>nil, "authorization_code"=>nil, "cardholder_authentication_code"=>nil, "account_number"=>nil, "test_request"=>"0", "full_response_code"=>"E00027"}, @message="The transaction cannot be found", @success=false, @Test=true, @authorization="0##capture", @fraud_review=false, @@error_code=nil, @emv_authorization=nil, @avs_result={"code"=>"I", "message"=>"Address not verified.", "street_match"=>nil, "postal_match"=>nil}, @cvv_result={"code"=>nil, "message"=>nil}>


Any clues would be greatly appreciated. Thanks.

Posts: 2
Registered: ‎10-20-2018

Re: activemerchant-- The transaction cannot be found

Answering my own question...


Upon closer examination I realized that the amount of the transaction was 0.  That did not compute.  Making said amount not 0 fixed the problem.  Also, I did this _without_ any reference to the sandbox solution id.