cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Very basic setup returning invalid merchant ID or password

I'm starting out by trying to get a successful connection to "https://test.authorize.net/gateway/transact.dll"

 

 

<?
function MerchantAuthenticationBlock()
{
	global $g_loginname, $g_transactionkey;
	return
	"<merchantAuthentication>".
	"<name>" . $g_loginname . "</name>".
	"<transactionKey>" . $g_transactionkey . "</transactionKey>".
	"</merchantAuthentication>";
}

function send_request_via_curl($host,$path,$content)
{
	$posturl = "https://test.authorize.net/gateway/transact.dll";
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $posturl);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
	curl_setopt($ch, CURLOPT_HEADER, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $content);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
	$response = curl_exec($ch);
	return $response;
}

function send_xml_request($content)
{
	global $g_apihost, $g_apipath;
	return send_request_via_curl($g_apihost,$g_apipath,$content);
}

$g_loginname = "5mZ4x3eAU";
$g_transactionkey = "9pSyRY9c46be57FQ";

$content =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
"<createCustomerProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">".
MerchantAuthenticationBlock().
"<profile>".
"<merchantCustomerId>12345</merchantCustomerId>".
"<description></description>".
"<email>test@email.com</email>".
"</profile>".
"</createCustomerProfileRequest>";

echo "Raw request: " . htmlspecialchars($content) . "<br><br>";
$response = send_xml_request($content);

echo '<pre>'; var_dump($response); echo '</pre>';
?>

 

Response:

string(434) "HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.0
Date: Tue, 16 Feb 2010 16:25:21 GMT
X-Powered-By: ASP.NET

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Tue, 16 Feb 2010 16:25:21 GMT
X-Powered-By: ASP.NET
Connection: close
Content-Type: text/html
Content-Length: 151

The following errors have occurred.
(13) The merchant login ID or password is invalid or the account is inactive.

 

 

dvelguru
Contributor
Contributor
1 ACCEPTED SOLUTION

Accepted Solutions

Try using this URL instead: https://apitest.authorize.net/xml/v1/request.api


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

View solution in original post

5 REPLIES 5

Are you using your live account credentials? They won't work with the test server. You'll need a developer test account.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
stymiee
Expert
Expert

These are my developer test account credentials.

Try using this URL instead: https://apitest.authorize.net/xml/v1/request.api


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

Wow, I don't know what is going on with documentation on the internet.

 

Totally outdated information everywhere.

 

Thanx Stymiee.

This is how it should be using the John Conde variables, if having trouble using a test account:

 

    public function __construct($login = '', $transkey = '', $test = true)
    {
        $login    = trim($login);
        $transkey = trim($transkey);
        if (empty($login) || empty($transkey))