cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Code for Transaction Details API for PHP simply doesn't work for me

After reading the manual several times and searching the forums and trying every sample code I can find... Still no joy.

 

Tried this:

  1. Downloaded Transaction Details API  and used sample code from http://developer.authorize.net/api/transaction_details/ 
  2. Set my account settings to allow transaction details via api (Had to remember my pet's name : )
  3. Pasted in my login ID and transaction key from my existing configuration (no spaces etc)
  4. Tucked in a real transaction ID into the transaction ID function.  I at leads a dozen transactions each day.
  5. Executed code under Windows 7 using PHP 5.2.17

 

Code executes.. sits for a while and comes back with 0 batches.

 

So I added in dates for the last 20 days and set details to true.  Still nothing. 

 

So i borrowed other sample code posted here in the forums and from the TD.markdown file as well as from the readme samples.   Blank.. Nada.

 

Obviously I'm missing a major part of the puzzle here. 

 

Is there a way to set debugging to see where the process is breaking down?

 

Perchance is it defaulting to a test account? (I don't have one, I only acces my live account)

 

Any hints or pointers to sample code that really should work?

 

Thanks

 

Frustrated Michael

 

 

MichaelS
Member
1 ACCEPTED SOLUTION

Accepted Solutions

The function you're using must be defaulting to sandbox. Try adding this:

 

define("AUTHORIZENET_SANDBOX", false);

 If that doesn't work, go into the lib files for the API and see if there's a sandbox argument for the function.

View solution in original post

5 REPLIES 5

Can you add this and paste the result (in a code box if it's more than a line or two)?

 

print_r($response);

 It's theoretically possible it defaults to sandbox (test mode is different), and in that case the response should contain an applicable error, since your production account login obviously isn't going to work on the test server.

TJPride
Expert

TJ. 

 

Very useful idea, Thank you..

 

The $response array reports an authentication error (pasted below).  What is odd is that I am using the same API login and Transaction key used in my shopping cart connector to authroize (which works fine)..  API login as 12 characters and  Transaction Key is 16 characters. 

 

I must be missing something. But what?

 

AuthorizeNetTD_Response Object
(
    [xml] => SimpleXMLElement Object
        (
            [messages] => SimpleXMLElement Object
                (
                    [resultCode] => Error
                    [message] => SimpleXMLElement Object
                        (
                            [code] => E00007
                            [text] => User authentication failed due to invalid
authentication values.
                        )

                )

        )

The function you're using must be defaulting to sandbox. Try adding this:

 

define("AUTHORIZENET_SANDBOX", false);

 If that doesn't work, go into the lib files for the API and see if there's a sandbox argument for the function.

And THAT is a solution that should be shared with others.

 

IT works now.  Thanks TJ.

 

Note to Authorize.net - this would be important to mention/add/change in sample code and documentation.

 

Much thanks TJ,,

 

-Michael

Glad to be of help.