This method simulates a customer paying a merchant account without using the Request to Pay timed account number. On success, OneKhusa sends a collection webhook. For payload explanations for both request and response, click here
using OneKhusa.SDK;
using OneKhusa.SDK.Models.FakeData.Collections;
//code omitted for brevity
OneKhusaResponse<SimulateCustomPaymentResponse> response = await client
.FakeData
.Collections
.SimulateCustomPaymentAsync(new SimulateCustomPaymentRequest
{
BeneficiaryAccountNumber = "1500000121",
ConnectorId = 104001,
TransactionAmount = 1000.00M,
CreatedBy = "joe.doe@example.com"
});
if (response is { IsSuccess: true, Data: not null })
{
Console.WriteLine($"""
Beneficiary: {response.Data.Beneficiary};
Source: {response.Data.Source};
Transaction: {response.Data.Transaction}
""");
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.