I'm brand new to using Auth.net (literally; I signed the paperwork today), and am working on implementing the code. To start, I'm using the test code here:
https://developer.authorize.net/integration/fifteenminutes (click on AIM)
I created a test account (about and have plugged in my test API login ID and transaction key, downloaded and uploaded the SDK, and double checked that the "require_once" path is correct. But when I run aim_test.php, I'm just getting a blank screen.
I added a few "echo" statements to see where it's failing, and it seems to fail at:
$response = $transaction->authorizeAndCapture();
I'm not getting an error message at all, though.
Since this is really step 1 (getting the sample test provided to run), I'm at a loss on how to go further. Any advice on what's going wrong?
Solved! Go to Solution.
09-01-2011 11:39 PM
I just got CurlSSL installed (which turned out to be a huge pain, but not related to Auth.net), and now the test script is working.
If the admins for Auth.net are reading this, they might want to consider making a statement somewhere that it's required! I just found it by searching old Google topics.
Thanks for your help, though, TJPride (Fenton?).
09-03-2011 01:16 AM - edited 09-03-2011 01:17 AM
That's the "live" version of the code. To make it work with a test account, change as follows:
$transaction = new AuthorizeNetAIM('YOUR_API_LOGIN_ID', 'YOUR_TRANSACTION_KEY'); $transaction->setSandbox(true);
For that matter, even on a live account you have to specify setSandbox(false) to get it to work (at least in my experience), so the sample code is less than helpful.
09-02-2011 06:30 AM
LOL How would anyone have ever known to do that? That line really should be added to the "15-minute integration" page.
Unfortunately, though, I'm still not getting anything. Here is the exact file that I'm using:
<?php
// I made sure that this is included correctly, using
// get_included_files();
require_once 'anet_php_sdk/AuthorizeNet.php';
// of course, I'm using my actual key and ID, not the placeholders here
$transaction = new AuthorizeNetAIM('MY_ID', 'MY_KEY');
$transaction->setSandbox(true);
$transaction->amount = '9.99';
$transaction->card_num = '4007000000027';
$transaction->exp_date = '10/16';
echo "1 ";
$response = $transaction->authorizeAndCapture();
echo "2 ";
if ($response->approved) {
echo "<h1>Success! The test credit card has been charged!</h1>";
echo "Transaction ID: " . $response->transaction_id;
}
else echo $response->error_message;
?>
I'm getting the "1" from the first echo, but that's it, so apparently it's dying on the "$response=..." line.
09-02-2011 06:43 PM
I should also mention that I've checked that my firewall does allow port 443 and port 80 tcp, and I do have cURL installed.
Wait, I might have spoken too soon. I have Curl, but not CurlSSL. Let me recompile later tonight with CurlSSL, and come back to this.
I do wish that the "test integration" had included a bit more information. This 15-minute integration has turned in to 72 hours.
09-02-2011 07:05 PM - edited 09-02-2011 07:16 PM
I just got CurlSSL installed (which turned out to be a huge pain, but not related to Auth.net), and now the test script is working.
If the admins for Auth.net are reading this, they might want to consider making a statement somewhere that it's required! I just found it by searching old Google topics.
Thanks for your help, though, TJPride (Fenton?).
09-03-2011 01:16 AM - edited 09-03-2011 01:17 AM
No problem. Fenton, MO is where I live, incidently.
09-03-2011 06:27 AM