Reply
Highlighted
Member
Posts: 3
Registered: ‎09-12-2013

Direct Post Method with Php causing problems in test environment

I have using test account in order check my code and transactions.

I am using local server for thos purpose i am using xampp package.

 

I have designed all required files and did whatever the page http://developer.authorize.net/integration/fifteenminutes/#directpost    said...

 

but i got ERROR.

 

I have read out the prevoius posts but got nothing.

 

When i have opened by relay_response.php file it will show: Error. Check your MD5 Setting.

 

but when i opened checkout_form file it give ERROR below:

An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card. 

      This transaction has been approved.

It is advisable for you to contact the merchant to verify that you will receive the product or service.

 

 

i also set my MD5 hash key to and use its value in my file but it doesnot works.

My code is:

[relay_response.php]

<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$redirect_url = "http://localhost/authorize/order_receipt.php"; // Where the user will end up.
$api_login_id = 'x';
$md5_setting = 'y'; // 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.";
}?>

 

.............................................................................

[checkout_form.php]

 

<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$relay_response_url = "http://localhost/authorize/relay_response.php"; // You will create this file in Step 7.
$api_login_id = 'x';
$transaction_key = 'z';
$amount = "400";
$fp_sequence = "1230088"; // Any sequential number like an invoice number.
echo AuthorizeNetDPM::getCreditCardForm($amount, $fp_sequence, $relay_response_url,$api_login_id, $transaction_key);?>

 

.............................................

[order_reciept.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']);
}?>

 .................................

 

please help me out.

Is there need to configure relay_response URL /response URL from merchant account?

If it is so, then how can i give URL ,if i am using xampp.. i dont have any URl

 

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

Re: Direct Post Method with Php causing problems in test environment

Relay Response Basics and Troubleshooting

 

basicially relay response can't response to your localhost.

Highlighted
Member
Posts: 3
Registered: ‎09-12-2013

Re: Direct Post Method with Php causing problems in test environment

This link doesnot describes how to set URL in merchant account.what to write and process to solve the problem.

kindly help me out

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

Re: Direct Post Method with Php causing problems in test environment

[ Edited ]

The problem is that localhost is not internet accessible.

Highlighted
Member
Posts: 3
Registered: ‎09-12-2013

Re: Direct Post Method with Php causing problems in test environment

 So what can i do?

It is not possible to configure authorize.net with localhost?

 

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

Re: Direct Post Method with Php causing problems in test environment

Nope. Not unless you have a domain name where authorize.net can access.

 

But you can fake it for a test, just like this example.

http://www.johnconde.net/blog/all-about-authorize-nets-silent-post/