The OneKhusa SDK is a developer toolkit (wrapper) designed to help you integrate your applications with the OneKhusa Payment Gateway. The SDK provides ready-to-use methods, helpers, and abstractions that simplify working with the underlying OneKhusa APIs for disbursements, collections, webhook events etc. It encapsulates best practices for making authenticated API calls, handling responses, and streamlining common payment workflows. At its core, OneKhusa enables organisations such as merchants, payment service providers (PSPs) and FinTechs to send and receive money, manage transactions, and interact with multiple financial networks using a unified interface. The SDK builds on this foundation to make integration faster and less error-prone by encapsulating common patterns and API usage.

Key Features

  • Unified API Integration: Wraps OneKhusa’s RESTful JSON APIs into client libraries or helper functions so developers can interact with features such as payment collections, disbursements, merchant management, and connectors with minimal boilerplate.
  • Automatic Token Refresh: Manages the access token refreshes on behalf of the developers when expires and support multi-tenancy merchant.
  • Authentication Handling: Manages credentials usage such as API keys and secrets required to authenticate requests against the OneKhusa platform.
  • Environment Support: Works seamlessly with both sandbox (testing) and production environments, allowing developers to build, test, and then move to live transactions.
  • Error & Response Management: Includes structured error handling consistent with OneKhusa’s standardized response formats and HTTP status codes.
  • Financial Compliance: Built-in support for mandatory headers like Idempotency-Key to prevent double-billing. If the developers do not specify idempotency-key, the SDK will automatically generate a new one for the API request.
  • Dual-Mode Support: Native support for both Dependency Injection (modern applications) and manual instantiation (legacy systems).
using Microsoft.Extensions.Logging;
using OneKhusa.SDK;
using OneKhusa.SDK.Models.Configurations;
using OneKhusa.SDK.Models.Shared;
using OneKhusa.SDK.Models.Transactions.SingleDisbursements;

using var loggerFactory = LoggerFactory.Create(builder =>
{
    builder.AddConsole().SetMinimumLevel(LogLevel.Debug);
});

OneKhusaClient client = new OneKhusaClient(new OneKhusaOptions
{
    ApiKey = "sandbox_1x6PM1KqFUtTwNo32...",
    ApiSecret = "UhWS5DmJfDUFi0OoJAGLzp3c...",
    MerchantAccountNumber = 12345678,
    OrganisationId = "ORG123456789"
}, loggerFactory);

OneKhusaResponse<CreatePayoutResponse> response = await client
    .Transactions
    .SingleDisbursements
    .CreatePayoutAsync(new CreatePayoutRequest
   {
      TransactionAmount = 50000.00,
      BeneficiaryName = "JOE DOE",
      SourceReferenceNumber = "QWSFCTXF882",
      BeneficiaryAccountNumber = "3333888800",
      ConnectorId = 221300,
      MerchantAccountNumber = 12345678,
      TransactionDescription = "MEEETING ALLOWANCE PAYMENT",
      CapturedBy = "joe.doe@example.com",
   });
Your Visual Studio IDE IntelliSense will automatically discover the services, methods and strongly typed classes of the SDK to minimise and avoid development errors. Our SDK adheres to software design patterns for advanced implementation and code optimized for performance. We will keep on improving the SDK to make developer’s life better. We have just started!