cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing DPM using PHP. Get "Error. Check your MD5 Setting."

In my very simple relay_response.php page it seems I am failing at the line:

 if ($response->isAuthorizeNet())

 

No matter what I try I always get directed to the MD5 error.

The test transaction sends me an email as though it succeeded.

I searched this forum and the web and fixed several errors in the PDF

doc but still fail. 

 

I'm using a test account and assume MD5 Hash is not turned on.

 

This is so simple I hate to ask for help...but...

 

My code:

 

<?php require_once 'anet_php_sdk/AuthorizeNet.php';
$api_login_id = 'my test API Login ID';
$md5_setting = "";   (also tried with " ")
$response = new AuthorizeNetSIM($api_login_id, $md5_setting);
if ($response->isAuthorizeNet())
{
if ($response->approved)
{
// Do your processing here.
$redirect_url .= '?response_code=1&transaction_id=' .
$response->transaction_id();
}
else
{
$redirect_url .= '?response_code='.$response->response_code . 
'&response_reason_text=' . $response->response_reason_text;
}
echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
}
else
{
echo "Error. Check your MD5 Setting.";
}?>

 

 

Thanks for any advice.

davewosborn
Member
8 REPLIES 8

Hi,  I was wondering if you found a resolution to this.  I have not been able to locate and I've been getting the same error.

 The funny thing is that the error "check MD5 hash settings" displays but the transaction still goes through in test mode and I get 

the receipt in addition to the whole processing cycle up to the batch settlement.  I'm hoping you were able to resolve. thanks.

blackssah9
Member

MD5 hash validation is enabled by deafult in the SDK. You would need to edit the code if you do not wish to perform this validation.  It is best practice to validate the MD5 hash response to confirm that the response returned was sent from Authorize.Net, however during testing you may not want to do this. The code is set to use your $api_login_id as the MD5 value so you should try that if you haven’t already.

 

 

Thank you,

 

Elaine

Elaine
Trusted Contributor
Trusted Contributor

I seem to be having the same problem that davewosborn is/was having. I'm following the instructions on this page:

https://developer.authorize.net/guides/DPM/php.htm

 

I set up my three pages (replacing the details with my information), and when I submit the order on the checkout_form.php page, it submits correctly, but gives me the same error that davewosborn mentioned:

Your script timed out while we were trying to post transaction results to it.

 Transaction ID: 0

 

Note that I don't think it's really a time out issue, since the transaction (and error) happens instantly (there's not a 10 second delay). I tried calling the relay_response.php page directly, but it gives me this error:

Error. Check your MD5 Setting.

 

Should I be able to call this relay_response.php page directly, or does this page only work when called by the authorize.net server? (in response to the checkout_form.php page) Is the fact that the relay_response.php is displaying an error causing authorize.net to think that there's a timeout error? I never changed my md5_setting value, so in the relay_response.php code it's set as the same as my api_login_id. Although I've tried having it blank and it gives same error.

 

If it helps, here are my three pages (these are for a testing account I set up- so feel free to submit an order):

http://cctest.fsmdev.com/checkout_form.php

http://cctest.fsmdev.com/relay_response.php

http://cctest.fsmdev.com/order_receipt.php

 

And here's a phpinfo page:

http://cctest.fsmdev.com/phpinfo_20110322.php

 

Thanks for any guidance you can provide.

One more thing I tested that seems strange- Since the error that I'm getting on the relay_response.php page seems to be related to this if() evaluating to false:
if ($response->isAuthorizeNet())

I tried just commenting out that section (so that it doesn't get caught on that). When I do, I then get this error:
Fatal error: Call to undefined method AuthorizeNetSIM::Approved()

Why am I getting this error. Are the PHP instructions that are provide on this page just wrong?:
http://developer.authorize.net/guides/DPM/php.htm

or is there something wrong with my impelmenation?

I'm having exactly the same problem using the DPM PHP Integration sample code.

If I leave the MD5 var blank, as it suggests, I get the 'Check your MD5 Setting' error.

If I put in my API_LOGIN_ID as the MD5, then I get the:

 

Fatal error: Call to undefined method AuthorizeNetSIM::Approved()

 

error. Is there an error in the sample relay_response.php code, or a different issue?

 

EDIT: *found it*!! Error in the sample relay_response code line should be:

if ($response->approved){

not

if ($response->Approved())

I had the same issue, and worked on it almost a week.

Eventually I found the way to get rid of this error. I don't know why but it started work when I changed the hosting server.

I'm having the same problem, I followed the documentation provided by Authorize.net and it worked perfect for over a month and then all of sudden I get this error. "Error. Check your MD5 Setting."

 

I have got no help from authorize.net support and it doesn't seem that this question was ever answered unless we are supposed to change our hosting. That seems like a ridiculous solution.

 

I would appreciate help from any one on this, Thank you.

JNsites
Member

If no MD5 setting is specified, it will default to AUTHORIZENET_MD5_SETTING, so you might want to check and make sure that's also undefined. This is what goes into the overall 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));
    }