This method creates a new single disbursement transaction (payout) from merchant account to a beneficiary. For payload explanations for both request and response, click here
using OneKhusa.SDK;
using OneKhusa.SDK.Models.Transactions.SingleDisbursements;
using OneKhusa.SDK.Models.Constants.TestAccounts;
//code omitted for brevity
OneKhusaResponse<CreatePayoutResponse> response = await client
.Transactions
.SingleDisbursements
.CreatePayoutAsync(new CreatePayoutRequest
{
TransactionAmount = 50000.00M,
BeneficiaryName = "JOE DOE",
SourceReferenceNumber = "QWSFCTXF882",
BeneficiaryAccountNumber = BankAccounts.AccountNumber1,
ConnectorId = 221300,
MerchantAccountNumber = 12345678,
TransactionDescription = "MEETING ALLOWANCE PAYMENT",
CapturedBy = "joe.doe@example.com"
});
if (response is { IsSuccess: true, Data: not null })
{
Console.WriteLine($"""
MerchantAccountNumber: {response.Data.MerchantAccountNumber};
TransactionReferenceNumber: {response.Data.TransactionReferenceNumber};
ResponseCode: {response.Data.ResponseCode}
""");
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();
Note: This method accepts custom idempotency key generated by your system. By default, if not specified, it will create one on your behalf.