Reply
Member
JNsites
Posts: 4
Registered: ‎12-15-2011

Error. Check your MD5 Setting.

I'm using the Direct Post integration method, I followed the instructions here https://developer.authorize.net/guides/DPM/ I have followed them exactly. Over a month ago when I set this up orginally it worked fine and then all of a sudden I keep getting the Error. Check your MD5 Setting.  At first I never had md5 setup I just left it blank as the instructions state but after I started getting this error I contact support and they told me to set it up so I did. Still getting the error and now they since I set it up I can't remove it so now I have to have the md5.

 

My code is below and it is identical to the instructions code except the addition of my values.

 

checkout_form.php

 

<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$relay_response_url = "http://extrahealthnetwork.com/test/relay_response.php";
$api_login_id = 'my login';
$transaction_key = 'my key';
$amount = "5.99";
$fp_sequence = "123"; // Any sequential number like an invoice number.
echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $relay_response_url,$api_login_id, $transaction_key);
 ?>

 

relay_response.php

 

<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$redirect_url = "http://extrahealthnetwork.com/test/order_receipt.php"; // Where the user will end up.
$api_login_id = 'mylogin';
$md5_setting = "md5 setting I setup in the account security settings"; // Your MD5 Setting
$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;
}
// Send the Javascript back to AuthorizeNet, which will redirect user back to your site.
echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
}
else
{
echo "Error. Check your MD5 Setting.";
}?>

 

order_receipt.php

 

<?php
if ($_GET['response_code'] == 1)
{
echo "Thank you for your purchase! Transaction id: "
.htmlentities($_GET['transaction_id']);}
else
{
echo "Sorry, an error occurred: " . htmlentities($_GET['response_reason_text']);
}?>

 

That covers the code I had a different setup before but after getting this error I did a test and followed all of the instructions again. I figured if I can't get the test working with the simple code there is no point trying for the more complex.

 

I would really really appreciate any help.

 

Thanks,

 

TJPride
Posts: 1,609
Topics: 15
Kudos: 178
Solutions: 121
Registered: ‎06-23-2011

Re: Error. Check your MD5 Setting.

Well, it -looks- ok. Are you running this on sandbox or production? (can't tell, you could have that set internally) Have you made sure to check that the md5 hash has no spaces or capitalization changes or anything like that? Is the API login ID on your relay response page correct? As you can see below, it goes into the hash, so if you messed that up it wouldn't work either.

 

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

 

---------------------------------------------
I am no longer providing support for Authorize.net, until such time as their policy reverts back to allowing gun sales. Sorry, all.

Like my solution? Give me a kudos by clicking the star at the bottom of my post!

Test accounts are not the same as test mode. Always use Authorize.net accounts in live mode; use a sandbox account if you want to test your code without processing real transactions.
Member
JNsites
Posts: 4
Registered: ‎12-15-2011

Re: Error. Check your MD5 Setting.

Thanks for the thoughts, I will double check the api login id and post back my results.

Member
JNsites
Posts: 4
Registered: ‎12-15-2011

Re: Error. Check your MD5 Setting.

I checked everything you mentioned and setup a new transaction key and I'm still having the same problem. Any help please thanks in advance.

TJPride
Posts: 1,609
Topics: 15
Kudos: 178
Solutions: 121
Registered: ‎06-23-2011

Re: Error. Check your MD5 Setting.

I don't know what to suggest. Everything -appears- to be ok on the coding end of things, but I have no way of verifying what data you're putting in. Can you log print_r($response, true) to a file above the isAuthorizeNet() call and then paste that in here? Preferably in a code box (see the fourth icon from the left in Rich Text mode).

---------------------------------------------
I am no longer providing support for Authorize.net, until such time as their policy reverts back to allowing gun sales. Sorry, all.

Like my solution? Give me a kudos by clicking the star at the bottom of my post!

Test accounts are not the same as test mode. Always use Authorize.net accounts in live mode; use a sandbox account if you want to test your code without processing real transactions.
Member
acjohnson
Posts: 1
Registered: ‎02-26-2012

Re: Error. Check your MD5 Setting.

I just wanted to say that I had the same exact problem and I just figured out what the issue was (it's been driving me nuts for the last several hours!).

 

Apparently there must be a character limit on the md5 hash setting in the merchant settings.

 

I originally was using a md5 hash that was created by using an md5 hash generator. The generator that I used generated a 32 character hash. You'd think this would be perfectly acceptable since the x_MD5_Hash value is 32 characters as well. Once I changed the md5 hash value in the merchant settings to a string much shorter (I am using 16 characters now) and updated my script it worked perfectly.

 

Also I'd like to point out that for some reason the x_MD5_Hash variable coming from AN appears to be case sensitive so when you capture the value during post make sure it looks something like this:

 

if(isset($_POST['x_MD5_Hash']))
{
$x_MD5_Hash = $_POST['x_MD5_Hash'];
}

 

Hope this helps.

Member
pradnya
Posts: 9
Registered: ‎08-08-2012

Error. Check your MD5 Setting.

i also suffered from the same problem ,i got the error "Error -- not AuthorizeNet. Check your MD5 Setting."

AuthorizeNetSIM Object
(
    [subscription_id] => 
    [subscription_paynum] => 
    [approved] => 
    [declined] => 
    [error] => 
    [held] => 
    [response_code] => 
    [response_subcode] => 
    [response_reason_code] => 
    [response_reason_text] => 
    [authorization_code] => 
    [avs_response] => 
    [transaction_id] => 
    [invoice_number] => 
    [description] => 
    [amount] => 
    [method] => 
    [transaction_type] => 
    [customer_id] => 
    [first_name] => 
    [last_name] => 
    [company] => 
    [address] => 
    [city] => 
    [state] => 
    [zip_code] => 
    [country] => 
    [phone] => 
    [fax] => 
    [email_address] => 
    [ship_to_first_name] => 
    [ship_to_last_name] => 
    [ship_to_company] => 
    [ship_to_address] => 
    [ship_to_city] => 
    [ship_to_state] => 
    [ship_to_zip_code] => 
    [ship_to_country] => 
    [tax] => 
    [duty] => 
    [freight] => 
    [tax_exempt] => 
    [purchase_order_number] => 
    [md5_hash] => 
    [card_code_response] => 
    [cavv_response] => 
    [account_number] => 
    [card_type] => 
    [split_tender_id] => 
    [requested_amount] => 
    [balance_on_card] => 
    [response] => Array
        (
            [fund_mount] => 300
            [submitbtn] => Submit
        )

    [api_login_id] => 4Um2hB2qD2
    [md5_setting] => 4Um2hB2qD2
    [nd_mount] => 300
    [bmitbtn] => Submit
)

 this array will print when we print print_r($response)  above $response->isAuthorizeNet() function.Please give me solution ..


Expert
RaynorC1emen7
Posts: 3,722
Registered: ‎03-08-2010

Re: Error. Check your MD5 Setting.

Why is most of the fields blank? md5_hash is blank. transaction_id  is blank?

Member
trueblue727
Posts: 2
Registered: ‎01-30-2014

Re: Error. Check your MD5 Setting.

[ Edited ]

I had the same issue - I was using a blank string "" as my md5_setting variable, and I kept receiving that error. What ended up fixing it for me was I went into the Account Settings and changed the md5 hash to something else -- it can be anything. The script worked fine after that.

 

I'm not sure why this happened even though I never set an md5, so a blank one should have worked. It may be a problem with the API or processing server that they need to fix. The DPM 15 minute tutorial implies that the md5 hash is set as your API Login ID by default so this may be the fix. This was not mentioned anywhere else in the documentation and I can't test if this was the case since I changed mine already.

 

<?php
require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$url = "http://YOUR_DOMAIN.com/direct_post.php";
$api_login_id = 'YOUR_API_LOGIN_ID';
$transaction_key = 'YOUR_TRANSACTION_KEY';
$md5_setting = 'YOUR_API_LOGIN_ID'; // Your MD5 Setting
$amount = "5.99";
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);
?>