Transaction Query

The transactions API client allows searching of transactions in the system, transactions can be searched on a variety of information. See Querying Transactions for more in-depth information about this feature.

The API reference docs can be found here Transactions Search.

Configure a new transactions API client

var config = new Configuration("{api-token}", Environment.Staging);
ITransactionsApiClient txClient = new TransactionsApiClient(config);

Retrieve single transaction

// the GetAsync method accepts either a GUID or a string
TransactionResponse = await txClient.GetAsync("{transactionId}")

As described in the Querying Transactions document it is possible to search on a wide variety of transaction properties such as send amount, merchant and status. On top of this it is possible to search against deeper data such as route destination currency or recipient name for example.

Below are examples of showing this in action as well as the capability to combine search criteria, search with exact value or even use search by value range.

A TransactionSearchRequest instance is required to use the transactions API client and allows the search values of transaction properties to be set, only certain properties are eligible for range searches such as date properties and decimal properties.

Search transactions with exact values on non-searchable properties

// specify status, send currency and recipient country
var query = new TransactionSearchRequest();
query.Status = TransactionStatus.Failed;
query.SendCurrency = Currency.GBP;
query.Recipient_Country = Country.SK;

// SearchAsync returns a pageable type explained further below
IPage<TransactionResponse, string> page = await txClient.SearchAsync(request);

Search transactions with exact values on searchable properties

// specify exact created time of transaction and route destination value
var query = new TransactionSearchRequest();
query.TransactionCreatedUTC.WithExactValue(new DateTime(2019, 04, 16));
query.Route_DestinationCurrency_Value.WithExactValue(100);

// SearchAsync returns a pageable type explained further below
IPage<TransactionResponse, string> page = await txClient.SearchAsync(request);

Search transactions with range values on searchable properties

// specify min and max decimal range of the route destination value
var query = new TransactionSearchRequest();
query.Route_DestinationCurrency_Value.WithValueInRange(8m, 8.5m);

var dateMin = new DateTime(2001, 01, 01);
var dateMax = new DateTime(2008, 01, 01);

// also specify min and max date range for recipient birthday
query.Recipient_Birthdate.WithValueInRange(dateMin, dateMax);

// SearchAsync returns a pageable type explained further below
IPage<TransactionResponse, string> page = await txClient.SearchAsync(request);

Working with the pageable results

Transactions are returned in a pageable manner to cater for many transactions meeting the search criteria, meaning you can retrieve the next set of results, get access to the continuation token as well as check if there are more results.

// Pageable results
IPage<TransactionResponse, string> page = await txClient.SearchAsync(request);

// get next page of transactions
IPage<TransactionResponse, string> nextPage = await firstPage.GetNextPageAsync();

// get transactions of the current page
IEnumerable<TransactionResponse> currentEntries = firstPage.CurrentItem;

// check if there are more transactions
bool moreResults = firstPage.HasMoreResults;

// get the token to use for getting the next page of transactions
Uri token = firstPage.NextPageToken;