Reversals
A reversal (0400 message) cancels a previous authorization. See parameter usages matrix table for mandatory and mandatory parameters to be echoed from the original authorization (0100 message) and it's response (0110 message).
When initiating a reversal, include these parameters (some only if available):
- MsgType = 0400
- The same MsgID as in the original transaction (the 0110 message)
- if available, also send these parameters from the original transaction:
- TransactionLinkID (Mastercard only)
- TransLCID
- TransID
- AuthCode
Full Reversal
To fully reverse an authorization a 0400 message is sent with the full amount of the authorization.
Example
An authorization is sent with TransAmount = 200 USD. But now the merchant wants to reverse the authorization. The merchant sends a reversal with TransAmount = 200 USD.
// code is compatible with .net8 console app
using System.Web;
using Microsoft.Extensions.DependencyInjection;
var service = new ServiceCollection();
service.AddHttpClient();
var client = service.BuildServiceProvider()
.GetService<IHttpClientFactory>()!
.CreateClient();
var parameters = new Dictionary<string, string>
{
{ "MsgType", "0400" },
{ "MsgSenderID", "[insert your username]" },
{ "MsgSenderAP", "[insert your password]" },
{ "MsgID", "123456" },
{ "MerchantXID", "2995652ABCDEFGH" },
{ "TerminalID", "18101001" },
{ "CardType", "V" },
{ "CardNumber", "4761739001010010" },
{ "TransAmount", "200" },
{ "TransCurrency", "826" },
{ "TransLCID", "917345001804486" },
{ "TransID", "729410123456" },
{ "AuthCode", "ABC123" }
};
var request = new HttpRequestMessage(HttpMethod.Post, "https://authorization.acquiring.uat.valitor.com/process")
{
Content = new FormUrlEncodedContent(parameters)
};
HttpResponseMessage response = await client.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var responseParameters = System.Web.HttpUtility.ParseQueryString(content);
// Process responseParameters here
}
else
{
// Handle error
}
Partial Reversal
Attention
Partial reversals are only supported by Visa and MasterCard.
The same rules apply to a partial reversal as to a full reversal except for the additional parameter ReplacementAmount. The corrected amount must be sent in the ReplacementAmount.
- ReplacementAmount in the 0400 message must be lower than the current TransAmount on the 0100 message.
Example
An authorization is sent with TransAmount = 100 USD. The merchant now only wants the cardholder to be billed for 70 USD. The merchant sends a partial reversal with TransAmount = 100 USD and ReplacementAmount = 70 USD. The amount of the authorization is now 70 USD after the partial reversal.
In case the merchant would now want to correct the amount again and only bill the cardholder for 50 USD, he would then need to send TransAmount = 70 USD and ReplacementAmount = 50 USD.
If the merchant would then want to fully reverse what is left over, he would need to send TransAmount = 50 USD and skip ReplacementAmount parameter. See Full Reversal
// code is compatible with .net8 console app
using System.Web;
using Microsoft.Extensions.DependencyInjection;
var service = new ServiceCollection();
service.AddHttpClient();
var client = service.BuildServiceProvider()
.GetService<IHttpClientFactory>()!
.CreateClient();
var parameters = new Dictionary<string, string>
{
{ "MsgType", "0400" },
{ "MsgSenderID", "[insert your username]" },
{ "MsgSenderAP", "[insert your password]" },
{ "MsgID", "123456" },
{ "MerchantXID", "2995652ABCDEFGH" },
{ "TerminalID", "18101001" },
{ "CardType", "V" },
{ "CardNumber", "4761739001010010" },
{ "TransAmount", "100" },
{ "TransCurrency", "826" },
{ "TransLCID", "917345001804486" },
{ "TransID", "729410123456" },
{ "AuthCode", "ABC123" },
{ "ReplacementAmount", "70" }
};
var request = new HttpRequestMessage(HttpMethod.Post, "https://authorization.acquiring.uat.valitor.com/process")
{
Content = new FormUrlEncodedContent(parameters)
};
HttpResponseMessage response = await client.SendAsync(request);
if (response.IsSuccessStatusCode)
{
var content = await response.Content.ReadAsStringAsync();
var responseParameters = System.Web.HttpUtility.ParseQueryString(content);
// Process responseParameters here
}
else
{
// Handle error
}