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.
Solved! Go to Solution.
โ02-16-2010 08:29 AM
Try using this URL instead: https://apitest.authorize.net/xml/v1/request.api
โ02-16-2010 09:17 AM
Are you using your live account credentials? They won't work with the test server. You'll need a developer test account.
โ02-16-2010 08:47 AM
These are my developer test account credentials.
โ02-16-2010 09:04 AM
Try using this URL instead: https://apitest.authorize.net/xml/v1/request.api
โ02-16-2010 09:17 AM
Wow, I don't know what is going on with documentation on the internet.
Totally outdated information everywhere.
Thanx Stymiee.
โ02-16-2010 09:37 AM
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))
โ08-26-2013 02:10 PM