Skip to content

Instantly share code, notes, and snippets.

@rkellermeyer
Created November 16, 2012 20:44
Show Gist options
  • Save rkellermeyer/4090747 to your computer and use it in GitHub Desktop.
Save rkellermeyer/4090747 to your computer and use it in GitHub Desktop.
Auth.net PHP samples
<?php
require_once '../anet_php_sdk/AuthorizeNet.php'; // The SDK
$url = "http://YOURSITE.tld/post_result.php";
$api_login_id = '######';
$transaction_key = '#############';
$md5_setting = '######'; // Your MD5 Setting
$amount = "5.99";
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);
define("AUTHORIZENET_API_LOGIN_ID", $api_login_id);
define("AUTHORIZENET_TRANSACTION_KEY", $transaction_key);
// Get Settled Batch List
$request = new AuthorizeNetTD;
$response = $request->getSettledBatchList();
echo count($response->xml->batchList->batch) . " batches\n";
foreach ($response->xml->batchList->batch as $batch) {
echo "Batch ID: " . $batch->batchId . "\n";
}
// Get Transaction Details
$transactionId = "12345";
$response = $request->getTransactionDetails($transactionId);
echo $response->xml->transaction->transactionStatus;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment