Copy
using OneKhusa.SDK;
using OneKhusa.SDK.Models.Transactions.Collections;
//code omitted for brevity
OneKhusaResponse<List<GetPaymentsResponse>> response = await client
.Transactions
.Collections
.GetPaymentsAsync(new GetPaymentsRequest
{
MerchantAccountNumber = 12345678,
TransactionDate = new DateTime(2026, 2, 1),
IsIncremental = false,
PageNumber = 1,
NumberOfReturnedRows = 20,
SearchBy = SearchFields.TransactionReferenceNumber,
SearchText = string.Empty
});
if (response is { IsSuccess: true, Data: not null })
{
foreach (var payment in response.Data)
{
Console.WriteLine($"""
SourceCustomerName: {payment.SourceCustomerName};
ConnectorName: {payment.ConnectorName};
CurrencyCode: {payment.CurrencyCode};
TransactionReferenceNumber: {payment.TransactionReferenceNumber};
TransactionAmount: {payment.TransactionAmount};
TransactionFee: {payment.TransactionFee};
TransactionDate: {payment.TransactionDate};
TransactionStatusCode: {payment.TransactionStatusCode};
TransactionStatusName: {payment.TransactionStatusName}
""");
}
return;
}
//it means an error has occurred: RFC7807 compliant error object
Console.WriteLine($"""
Type: {response.Error?.Type};
Title: {response.Error?.Title};
Detail: {response.Error?.Detail};
ErrorCode: {response.Error?.ErrorCode};
Status: {response.Error?.Status};
Instance: {response.Error?.Instance};
Errors: {string.Join(";", response.Error?.Errors ?? [])}
""");
Console.ReadLine();