This method simulates as if the customer is paying through a bank or MNO digital platform using the request-to-pay feature to accept the payment. This requires that the transaction was already initiated through the request-to-pay feature otherwise, you will get an error indicating that the transaction does not exist. For payload explanations for both request and response, click here
using OneKhusa.SDK;
using OneKhusa.SDK.Models.FakeData.Collections;
//code omitted for brevity
OneKhusaResponse<MockAcceptRequestToPayResponse> response = await client
.FakeData
.Collections
.MockAcceptRequestToPayAsync(new MockAcceptRequestToPayRequest
{
ConnectorId = 221300,
MerchantAccountNumber = 12345678,
TransactionAmount = 785000.00M,
CurrencyCode = "MWK",
TimedAccountNumber = "11002233",
CapturedBy = "joe.doe@example.com"
});
if (response is { IsSuccess: true, Data: not null })
{
Console.WriteLine($"""
Message: {response.Data.Message}
""");
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();
Note: This method accepts custom idempotency key generated by your system. By default, if not specified, it will create one on your behalf.