I have a live account in Test mode and when using the instructions from the PHP SDK, I keep getting "Error. Check your MD5 Setting". When I remove 'relay_response_url', it goes through fine.
Initially, I had nothing entered for MD5, but when this happened, I entered something simple (abc) and tried again. No luck. As per the PDF insructions, I created these 3 files. Any ideas/thoughts would be appreciated:
CHECKOUT_FORM.PHP
<?php
require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$relay_response_url = "http://DOMAIN/relay_reponse.php";
$api_login_id = 'LOGINID';
$transaction_key = 'TRANSKEY';
$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';
$redirect_url = "http://DOMAIN/order_receipt.php";
$api_login_id = 'LOGINID';
$md5_setting = "abc";
$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']);
}
?>
Thanks you.
05-09-2012 06:55 PM
I have set MD hash value in my account and put the same value in $md5_setting .
this is my response array 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 ( [amt] => 100 [submit_btn] => submit ) [api_login_id] => 4Um2hB2qD2 [md5_setting] => dpm [t] => 100 [bmit_btn] => submit )
still it give me the same error
09-05-2012 03:06 AM
First of all, I'm not a php developer.
But, if you look at the source code AuthorizeNetDPM.php
Method directPostDemo() do two thing,
1)if nothing is post to it, it will display the credit card info entry screen
2)if something is post to it, it will assume it is the relay response. And it do the isAuthorizeNet() check. Error with
echo "Error -- not AuthorizeNet. Check your MD5 Setting.";
So it failing because you are trying to post to it with the amt. in your add_amount.php
The comment on directPostDemo()
Implements all 3 steps of the Direct Post Method for demonstration purposes.
09-05-2012 05:30 AM - edited 09-05-2012 05:37 AM
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); ?>
01-30-2014 09:35 PM - edited 01-30-2014 09:41 PM