Authorize.Net Transaction Details API不返回LineItems

时间:2012-06-01 14:17:22

标签: c# asp.net e-commerce payment-gateway authorize.net

我正在Transaction Details APIAuthorize.Net C# SDK一起使用Authorize.Net website直接使用以下代码获取过去30天内所有交易的列表:

        //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());
        }

它运作正常。我想通过添加以下内容获取每个LineItems的{​​{1}}列表:

Transaction

它没有显示任何 ... 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); } } ,我甚至设置了一个断点,并且看到每个事务总是显示0 LineItems,即使我可以登录到Web界面并查看交易明细报告中的LineItems

enter image description here

我做错了什么?如何使用LineItems查看每个交易的LineItems

答案:(感谢SO用户Josh

Authorize.Net C# SDK

1 个答案:

答案 0 :(得分:3)

GetTransactionList返回有关事务的有限信息。在每个事务上,执行GetTransactionDetails:

GetTransactionList 此函数返回指定批次ID的有限交易详情。

GetTransactionDetails 此函数返回指定交易ID的完整交易详情。

从Authorize.net的XML API库Look towards the bottom on the XML section

中找到