Reply
Highlighted
Member
Posts: 4
Registered: ‎01-07-2014
Accepted Solution

MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

$api_login_id = AUTHORIZENET_API_LOGIN_ID;                                         <-- Authorize.net supplied login
$md5_setting = AUTHORIZENET_MD5_SETTING;                                        <-- Value I set in SandBox   Account>MD5-Hash


$response = new AuthorizeNetSIM($api_login_id, $md5_setting);                          <-- Create the response

 


$log->LogDebug("RESPONSE.PHP MD5_Hash=".$response->MD5_Hash);                 <-- Response MD5_Hash
$log->LogDebug("RESPONSE.PHP generateHash=". $response->generateHash());  <--Generated MD5_Hash

 

================log======================================================================
RESPONSE.PHP MD5_Hash=9E6FC24E4880D966623FB51901AF4587                            <-- Response MD5_Hash
RESPONSE.PHP generateHash=0DE5637226CB8FDFE396E27983F83A9D                     <--Generated MD5_Hash

 

What am I missing?   


Accepted Solutions
Highlighted
Solution
Accepted by RichardH (Administrator)
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎01-07-2014

Re: MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

That was it!!!!    

 

I changes

AuthorizeNewSIM.php

function generateHash()

               $amount = ($this->amount ? $this->amount : "0.00");                   //   Added this line

                return strtoupper(md5($this->md5_setting . $this->api_login_id . $this->transaction_id . $amount));

}

 

Maybe I deleted the line early in the process.   However it works.

I could never have found this without you.

Thanks.

View solution in original post


All Replies
Highlighted
Member
Posts: 4
Registered: ‎01-07-2014

Re: MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

$api_login_id = AUTHORIZENET_API_LOGIN_ID;      <-- Authorize.net supplied login
$md5_setting = AUTHORIZENET_MD5_SETTING;     <-- Value in SandBox   Account>MD5-Hash

                                                                                                       Verified.  and No Spaces.


$response = new AuthorizeNetSIM($api_login_id, $md5_setting);        <-- Create the response

                  


$log("MD5_Hash=".$response->MD5_Hash);                 <-- Response MD5_Hash
$log(" generateHash=". $response->generateHash());  <--Generated MD5_Hash

 

================log===================================================
MD5_Hash=9E6FC24E4880D966623FB51901AF4587              <-- Response MD5_Hash
generateHash=0DE5637226CB8FDFE396E27983F83A9D       <--Generated MD5_Hash

 

What am I missing?   

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

The only thing I remember is that the MD5 setting on your account can be too large. And it will get truncate when authorize.net is generating the response->MD5_Hash

Highlighted
Member
Posts: 4
Registered: ‎01-07-2014

Re: MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

Thanks mine is 12 characters.

 

The MD5 that is sent in the original post is fine.  No errors.

 

I just can not get the generatehash function to provide the same value returned by AuthenicateSIM.

 

Any ideas how I can debug or test? 

 

I have copy N pasted my ID and MD5 setting from SandBox Account.     What else can I do.

The ResponseCode 99 Tool   is not appropriate.    I think it is for the sending to Authenticate Hash.

Thanks for your response  :-)

Highlighted
Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

public function generateHash()
{
        $amount = ($this->amount ? $this->amount : "0.00");
        return strtoupper(md5($this->md5_setting . $this->api_login_id . $this->transaction_id . $amount));
}

 That the source, see if the transaction id and amount look ok.

 

Highlighted
Solution
Accepted by RichardH (Administrator)
‎08-21-2015 01:58 AM
Member
Posts: 4
Registered: ‎01-07-2014

Re: MD5 AuthorizeNetSIM.GenerateHash does not match $response->MD%_Hash

That was it!!!!    

 

I changes

AuthorizeNewSIM.php

function generateHash()

               $amount = ($this->amount ? $this->amount : "0.00");                   //   Added this line

                return strtoupper(md5($this->md5_setting . $this->api_login_id . $this->transaction_id . $amount));

}

 

Maybe I deleted the line early in the process.   However it works.

I could never have found this without you.

Thanks.