交易搜索始终为空

dor*_*dor 1 c# paypal braintree

我尝试搜索所有交易,我总是空集合.在我的paypal帐户中我收到了很多交易.

我尝试了任何其他请求,并且我从所有请求中都是空的

BraintreeGateway gw = new BraintreeGateway("access_token$...");
var request = new TransactionSearchRequest().Status.IncludedIn(TransactionStatus.ALL);
var collection = gw.Transaction.Search(request);

foreach (Braintree.Transaction transaction in collection)
{
    Console.WriteLine(transaction.Id);
}
Run Code Online (Sandbox Code Playgroud)

小智 5

由于ALL不是有效的交易状态,因此您没有收到任何结果.可能的状态在这里链接.要搜索所有事务,您需要迭代每个事务状态.这是一个例子:

request = new TransactionSearchRequest().
      Status.IncludedIn(TransactionStatus.AUTHORIZED,
                        TransactionStatus.SUBMITTED_FOR_SETTLEMENT
                        ...);  // add other statuses
collection = gateway.Transaction.Search(request);
Run Code Online (Sandbox Code Playgroud)

完全披露:我在Braintree工作.如果您有任何其他问题,请随时联系 支持.