Code to generate the checksum.

public string GetRequestChecksum(string secretKey, string merchantID, string transactionType, long amount, string currency, string merchantReference, string userID, string terminalID)
{
    var checksumString = string.Format("{0}|{1}|{2}|{3}|{4}|{5}",secretKey, merchantID, transactionType, amount, currency,  merchantReference);         
    if (!string.IsNullOrWhiteSpace(userID)) checksumString += '|' + userID; 
    if (!string.IsNullOrWhiteSpace(terminalID!= null)) checksumString += '|' + terminalID;   
    SHA256Managed sha = new SHA256Managed();   
    return sha.ComputeHash(Encoding.UTF8.GetBytes(checksumString)).Select(h => h.ToString("X2")).Aggregate((i, j) => i + j);
}

Code to validate the checksum.

public bool ValidateResponse(string secretKey, string TransactionID, string merchantReference, string result, string failureMessage, long amount, string checksum)
{     
var checksumString = string.Format("{0}|{1}|{2}|{3}|{4}|{5}", secretKey, TransactionID, merchantReference, result, failureMessage, amount);  
      SHA256Managed sha = new SHA256Managed();
return string.Equals(sha.ComputeHash(Encoding.UTF8.GetBytes(checksumString)).Select(h => h.ToString("X2")).Aggregate((i, j) => i + j), checksum, StringComparison.InvariantCultureIgnoreCase);
}