This method retrieves the transaction fees defined for the merchant. For payload explanations for both request and response, click here
using OneKhusa.SDK; 
using OneKhusa.SDK.Models.Merchants.Fees; 

//code omitted for brevity

OneKhusaResponse<List<GetTransactionFeesResponse>> response = await client 
    .Merchants 
    .Fees 
    .GetFeesAsync(new GetTransactionFeesRequest 
    { 
        MerchantAccountNumber = 12345678 
    }); 

if (response is { IsSuccess: true, Data: not null }) 
{ 
    foreach (var fee in response.Data) 
    { 
        Console.WriteLine($""" 
            TransactionType: {fee.TransactionType}; 
            CurrencyCode: {fee.CurrencyCode}; 
            ConvenienceFee: {fee.ConvenienceFee}; 
            GovernmentLevyFeeTagCode: {fee.GovernmentLevyFeeTagCode}; 
            GovernmentLevyFee: {fee.GovernmentLevyFee}; 
            TransactionFeeTag: {fee.TransactionFeeTag}; 
            TransactionFee: {fee.TransactionFee}; 
            MerchantFeeTag: {fee.MerchantFeeTag}; 
            MerchantFee: {fee.MerchantFee}; 
            VatPercentage: {fee.VatPercentage} 
        """); 
    } 
    Console.ReadLine(); 
    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(); 

Calculate Transaction Fees

This method calculates the transaction fees for the merchant. For payload explanations for both request and response, click here
using OneKhusa.SDK; 
using OneKhusa.SDK.Models.Merchants.Fees; 
using OneKhusa.SDK.Models.Constants.Analytics; 
using OneKhusa.SDK.Models.Constants.Shared; 

//code omitted for brevity 
OneKhusaResponse<CalculateTransactionFeesResponse> response = await client 
    .Merchants 
    .Fees 
    .CalculateFeesAsync(new CalculateTransactionFeesRequest 
    { 
        MerchantAccountNumber = 12345678, 
        ChannelType = ChannelTypes.BankAccount, 
        FeeType = SummaryTypes.Disbursements, 
        TransactionAmount = 55000.00M
    }); 

if (response is { IsSuccess: true, Data: not null }) 
{ 
    Console.WriteLine($""" 
        TransactionAmount: {response.Data.TransactionAmount};  
        CurrencyCode: {response.Data.CurrencyCode}; 
        ConvenienceFeeAmount: {response.Data.ConvenienceFeeAmount}; 
        TransactionFeeAmount: {response.Data.TransactionFeeAmount};  
        MerchantFeeAmount: {response.Data.MerchantFeeAmount}; 
        TotalFeeBeforeVat: {response.Data.TotalFeeBeforeVat}; 
        VatAmount: {response.Data.VatAmount};  
        GovernmentLevyFeeAmount: {response.Data.GovernmentLevyFeeAmount};  
        NetFeeAmount: {response.Data.NetFeeAmount} 
    """); 
    Console.ReadLine(); 
    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();