cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction Details API Not Returning LineItems

I'm using the `Transaction Details API` with the `Authorize.Net C# SDK` to get a list of all transactions in the past 30 days using the following code directly from the Authorize.Net website:

 

//open a call to the Gateway
var gate = new ReportingGateway("myAPILogin", "myTransactionKey");

//Get all the batches settled
var batches = gate.GetSettledBatchList();

Console.WriteLine("All Batches in the last 30 days");

//Loop each batch returned
foreach (var item in batches)
{
Console.WriteLine("Batch ID: {0}, Settled On : {1}", item.ID,
item.SettledOn.ToShortDateString());
}

Console.WriteLine("*****************************************************");
Console.WriteLine();

//get all Transactions for the last 30 days
var transactions = gate.GetTransactionList();
foreach (var item in transactions)
{
Console.WriteLine("Transaction {0}: Card: {1} for {2} on {3}",
item.TransactionID, item.CardNumber,
item.SettleAmount.ToString("C"),
item.DateSubmitted.ToShortDateString());
}

 

and it works properly. I am trying to get the list of `LineItems` for each `Transaction` by adding this:

 

...
foreach (var item in transactions)
{
Console.WriteLine("Transaction {0}: Card: {1} for {2} on {3}",
item.TransactionID, item.CardNumber,
item.SettleAmount.ToString("C"),
item.DateSubmitted.ToShortDateString());
foreach (var li in item.LineItems)
{
Console.WriteLine(" LineItem ID: {0} Name: {1} Quantity: {2} Unit Price: {3}",
li.ID, li.Name, li.Quantity, li.UnitPrice);
}
}

 

It doesn't show any `LineItems` though, I even set a break point and saw that it always shows 0 `LineItems` for each transaction, even though I can log into the web interface and view the `LineItems` in the transaction detail reports.

 

 

What am I doing wrong? How do I view `LineItems` of each transaction using the `Authorize.Net C# SDK`?

ghartsho
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Answered on StackOverflow - http://stackoverflow.com/a/10852600/585552

 

var transactions = gate.GetTransactionList();
foreach (var item in transactions)
{
Console.WriteLine("Transaction {0}: Card: {1} for {2} on {3}",
item.TransactionID, item.CardNumber,
item.SettleAmount.ToString("C"),
item.DateSubmitted.ToShortDateString());

var details = gate.GetTransactionDetails(item.TransactionID);

foreach (var li in details.LineItems)
{
Console.WriteLine(" LineItem ID: {0} Name: {1} Quantity: {2} Unit Price: {3}",
li.ID, li.Name, li.Quantity, li.UnitPrice);
}
}

View solution in original post

ghartsho
Member
1 REPLY 1

Answered on StackOverflow - http://stackoverflow.com/a/10852600/585552

 

var transactions = gate.GetTransactionList();
foreach (var item in transactions)
{
Console.WriteLine("Transaction {0}: Card: {1} for {2} on {3}",
item.TransactionID, item.CardNumber,
item.SettleAmount.ToString("C"),
item.DateSubmitted.ToShortDateString());

var details = gate.GetTransactionDetails(item.TransactionID);

foreach (var li in details.LineItems)
{
Console.WriteLine(" LineItem ID: {0} Name: {1} Quantity: {2} Unit Price: {3}",
li.ID, li.Name, li.Quantity, li.UnitPrice);
}
}

ghartsho
Member