Could someone assist us in creating a PHP page that accepts our Login ID and Transaction Key, then produces a csv datafile for import into our database.
We can sucessfully pull the results by passing a single transaction #, but would prefer to use a data range (i.e. yesterday), and results come across in a jumble of XML (which I'm not terribly familiar with).
We can sucessfully pull the results by providing a data range, and results come across in a jumble of XML (which I'm not terribly familiar with).
How do we capture these results into a data file? Also, we'd like to pull some custom fields. Do you happen to have that code handy?
Thanks,
Lance
07-18-2014 09:02 AM - edited 07-18-2014 09:13 AM
If I am approching this wrong, please let me know. We'd be glad to use the easiest method to produce a daily file of transactions.
Here's the code we're using:
error_reporting(E_ALL);
require_once "/anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "669KMkmY9K6U");
define("AUTHORIZENET_TRANSACTION_KEY", "xxxxxxxxxxxx");
define("AUTHORIZENET_SANDBOX", true);
$request = new AuthorizeNetTD;
$includeStatistics = false;
$firstSettlementDate = "2014-07-01T08:15:30";
$lastSettlementDate = "2014-07-15T08:15:30";
$response = $request->getSettledBatchList($includeStatistics,$firstSettlementDate,$lastSettlementDate);
print_r($response);
AND THE RESULTS:
AuthorizeNetTD_Response Object ( [xml] => SimpleXMLElement Object ( [messages] => SimpleXMLElement Object ( [resultCode] => Ok [message] => SimpleXMLElement Object ( [code] => I00001 [text] => Successful. ) ) [batchList] => SimpleXMLElement Object ( [batch] => SimpleXMLElement Object ( [batchId] => 3573899 [settlementTimeUTC] => 2014-07-14T19:25:38Z [settlementTimeLocal] => 2014-07-14T14:25:38 [settlementState] => settledSuccessfully [paymentMethod] => creditCard [marketType] => eCommerce [product] => Card Not Present ) ) ) [response] => OkI00001Successful.35738992014-07-14T19:25:38Z2014-07-14T14:25:38settledSuccessfullycreditCardeCommerceCard Not Present [xpath_xml] => SimpleXMLElement Object ( [messages] => SimpleXMLElement Object ( [resultCode] => Ok [message] => SimpleXMLElement Object ( [code] => I00001 [text] => Successful. ) ) [batchList] => SimpleXMLElement Object ( [batch] => SimpleXMLElement Object ( [batchId] => 3573899 [settlementTimeUTC] => 2014-07-14T19:25:38Z [settlementTimeLocal] => 2014-07-14T14:25:38 [settlementState] => settledSuccessfully [paymentMethod] => creditCard [marketType] => eCommerce [product] => Card Not Present ) ) ) )
07-18-2014 09:05 AM - edited 07-18-2014 09:15 AM
Well.....
I now realize we are simply pulling a list of batches by date, but don't know how to pull the actual transactions in the batch and capture them into a data file.
07-18-2014 09:18 AM
Well now I figured out how to pull transactions by day, but I don't know what to do with all the XML!
require_once "/anet_php_sdk/AuthorizeNet.php";
define("AUTHORIZENET_API_LOGIN_ID", "669KMkmY9K6U");
define("AUTHORIZENET_TRANSACTION_KEY", "xxxxx");
define("AUTHORIZENET_SANDBOX", true);
$request = new AuthorizeNetTD;
$response = $request->getTransactionsForDay(7,14,2014);
print_r($response);
07-18-2014 11:10 AM