This method simulates reversing a previously successful disbursement in the sandbox environment. For payload explanations for both request and response, click here
using OneKhusa.SDK;
using OneKhusa.SDK.Models.FakeData.Shared;
//code omitted for brevity
OneKhusaResponse<SimulateReversalResponse> response = await client
.FakeData
.Disbursements
.SimulateSingleDisbursementReversalAsync(new SimulateReversalRequest
{
MerchantAccountNumber = 12345678,
CapturedBy = "joe.doe@example.com",
TransactionReferenceNumber = "D250713MGGGY"
});
if (response is { IsSuccess: true, Data: not null })
{
Console.WriteLine($"Message: {response.Data.Message}");
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.