Search all Braintree transactions

I work with Braintree payment gateway integration in my .net azure service. I want all transactions to happen, and then cycle all one by one. I got everything successfully, but when I want to get detailed information about all one by one, this does not allow me, I can access FirstItem from the collection. Below is my code:

ResourceCollection<Transaction> collection = Constants.Gateway.Transaction.Search(new TransactionSearchRequest());

Please help me get all the transactions from the collection. Now I have account = 4 in my collection (this means that four transactions are occurring), but when I want to get everything using a lambda expression or with a foreach loop that does not work only with the collection. FirstIteam works, which can help me see the first item in the collection, but I want everything.

+4
source share
1 answer

I work at Braintree. If you have further questions, please contact our support team .

Take a look at the Braintree.NET search results documentation :

There is a search ResourceCollectionthat implements IEnumerable, so you can iterate over them like other enumerated classes.

var request = new TransactionSearchRequest().
    Status.Is(TransactionStatus.AUTHORIZED);

ResourceCollection<Transaction> collection = gateway.Transaction.Search(request);

foreach (Transaction transaction in collection) {
    Console.WriteLine(transaction.Id);
}

However, keep in mind that finding a large number of transactions can be slow and you are limited to 10,000 results. Instead, we recommend that you save the information that you will need later when you return the transaction after it is created.

+2
source

All Articles