4D Payments SDK 2016 .NET Edition

Questions / Feedback?

Reverse Method

Reverses a credit card transaction.


public void Reverse();
Public Sub Reverse()


Unlike the Timeout Reversals used in the FDMSDebit and FDMSBenefit components, a credit card reversal is used to void a transaction and return funds to the customer. Often this is used in a split-tender situation, where a customer uses a prepaid Visa or MasterCard (or health care FSA card) to make a purchase which is partially authorized for less than the transaction amount. Partially authorized transactions will have an ApprovalCode that beings with "AL" instead of "AP". If the customer does not have an additional source of funds to make up the difference, the authorization must be reversed and the funds immediately returned to the customer's card. To do this, set the AuthorizedAmount to the Response.AuthorizedAmount from the original transaction, and set the SettlementAmount to "0". This is called a full reversal (in this case, of a partially authorized transaction), and the detail record for the original transaction should be discarded - it must not be settled at the end of the day.

Alternatively, a merchant may need to settle a transaction amount for less than was originally authorized. In this case, set the AuthorizedAmount to the original TransactionAmount, and set the SettlementAmount to the new amount you wish to settle for. After a successful reversal, use the FDMSDetailRecord component to update the SettlementAmount of the detail record for the original transaction with the new amount. This is called a partial reversal. You may also submit a full reversal by setting the SettlementAmount to "0". In that case, all of the funds are returned to the customer and the detail record for the original transaction should be discarded.

Note that partial authorizations must be fully reversed. You cannot partially reverse a partial authorization. Normally authorized transactions can be either partially or fully reversed. A normal authorization has a ApprovalCode that begins with "AP" (APproved). A partial authorization has a ApprovalCode that begins with "AL" (Approved for a Lesser amount).

Upon a successful reversal, the ApprovalCode field will contain either "AP888888" or "AP868686" indicating the reversal was accepted. This code does not indicate the original transaction was found and reversed, merely that the reversal was received and properly formatted. First Data does not actually check whether the original transaction occurred or not. If the transaction was declined ApprovalCode will contain one of the response messages listed in the table below:

Response MessageMeaning
CALL CARD CENTER System problem.
DECLINED Decline the transaction.
EXPIRED CARD Card is expired.
HOLD - CALL CTR Problem with card.
INV ACCT NUM Invalid card number or prefix.
INV CREDIT PLAN Private label message only.
INV EXP DATE Invalid expiration date.
INV MER ID Merchant is not set up on Host file.
INV TERM ID Terminal is not set up on Host file.
PLEASE RETRY System time-out or other generic system error.
REFERRAL Referral.
REFERRAL INV TR2 Referral - Invalid Track II Data.
REFERRAL INV TR1 Referral - Invalid Track I Data.
SERV NOT ALLOWED Merchant is not entitled to this card type.
SYS REJECT Transaction was rejected by the system due to "batch in progress indicators" being turned on.
INV AMT Invalid amount.
INV TRAN Transaction not permitted
REV REJECTED Reversal was rejected.
TRAN NOT ALLOWED Transaction not allowed.

The following example starts with a simple $3 manually-keyed retail transaction:

  FDMSRetail1.TransactionNumber = 3;
  FDMSRetail1.TransactionAmount = "300";
  FDMSRetail1.Card.Number = "4111111111111111";
  FDMSRetail1.Card.ExpMonth = 12;
  FDMSRetail1.Card.ExpYear = 13;
  FDMSRetail1.Card.EntryDataSource = edsManuallyEntered;
The above authorization was successful, but for some reason it needs to be voided. You could simply not settle the transaction, and that would clear the block on the cardholder's funds in a few days. However, a reversal allows you to clear that block immediately. To start with, we set the FDMSReversal component with the same merchant setup and basic transaction info used in the original authorization.
  FDMSReversal1.MerchantNumber         = FDMSRetail1.MerchantNumber;
  FDMSReversal1.MerchantTerminalNumber = FDMSRetail1.MerchantTerminalNumber;
  FDMSReversal1.DatawireId             = FDMSRetail1.DatawireId;
  FDMSReversal1.URL                    = FDMSRetail1.URL;
  FDMSReversal1.Card.Number            = FDMSRetail1.Card.Number;
  FDMSReversal1.Card.ExpMonth          = FDMSRetail1.Card.ExpMonth;
  FDMSReversal1.Card.ExpYear           = FDMSRetail1.Card.ExpYear;
  FDMSReversal1.Card.EntryDataSource   = FDMSRetail1.Card.EntryDataSource;
Next, we need to specify the exact transaction we wish to reverse. The properties below are required for First Data to identify and reconcile the reversal. Note that if the original transaction was authorized for an amount less than the original TransactionAmount, AuthorizedAmount should be set with the AuthorizedAmount from the original transaction, instead of the TransactionAmount which was requested.
  FDMSReversal1.ApprovalCode     = FDMSRetail1.Response.ApprovalCode;
  FDMSReversal1.TransactionId    = FDMSRetail1.Response.TransactionId;
  FDMSReversal1.AuthorizedAmount = FDMSRetail1.TransactionAmount;
  FDMSReversal1.ReturnedACI      = FDMSRetail1.Response.ReturnedACI;
  FDMSReversal1.ValidationCode   = FDMSRetail1.Response.ValidationCode;
All that is left is to set the new settlement amount and submit the transaction. To completely reverse the transaction and return all funds to the customer, set the SettlementAmount to zero ("0"). To return a portion of the funds to the customer set the SettlementAmount property with the result of the original authorized amount minus the amount to be unblocked on the customer's card. For instance, this $3 transaction has $2 reversed, for a new settlement amount of $1.
  FDMSReversal1.TransactionNumber = 4;
  FDMSReversal1.SettlementAmount  = "100";
If the reversal is successful the ApprovalCode will contain either "AP868686" or "AP888888", indicating the reversal was accepted.

Note that partially authorized transactions cannot be partially reversed, they must be fully reversed. For instance, say a customer uses a prepaid visa card to buy $100 worth of merchandise, but his card only has a $50 balance. If the customer does not have an additional form of tender, (cash, check, credit, etc), the $50 that was partially authorized must be reversed and returned to the card. First Data does not support any scenario where a partially authorized transaction may be reversed for less than the full amount.

To reiterate, when a transaction is fully reversed, it must be removed from the batch settlement entirely. A partially reversed transaction must update the SettlementAmount of the original detail record, using the FDMSDetailRecord component. Reversal transactions themselves may not be settled, even if the CaptureFlag is True.

Important Note: You must ping your list of service provider URLs and update the URL property to the service provider with the shortest response time every 100 transactions, as well as when your application initially starts. This is not a normal ICMP ping - to determine the fastest transaction URL you must use the special Ping method inside the FDMSRegister component. (You may update your list of service provider URLs with the FDMSRegister component's ServiceDiscovery method).

Copyright (c) 2021 4D Payments Inc. - All rights reserved.
4D Payments SDK 2016 .NET Edition - Version 16.0 [Build 8017]