Adjust and Void (SOAP)

SOAP API Reference

Adjust and Void (SOAP)

 

Note: In situations where the service configuration does not support Adjust, adjustments can still be made at the time of settlement by setting the new transaction amount on the BankcardCapture object.
 

In the Adjust differenceData object, the Amount parameter either increases or decreases the original authorized amount by the specified value. TipAmount is simply a reporting field and bears no impact on the amount being passed.

 

For example:

 
Incremental Authorization (INCAUTH) Reverse Authorization (REVAUTH)
Authorize Amount = 10.00; Adjust Amount = 2.00; Settled Amount = 12.00 Authorize Amount = 10.00; Adjust Amount = (-2.00); Settled Amount = 8.00
 

Operation

Response Adjust(string sessionToken, Adjust differenceData, string applicationProfileId, string workflowId);
   

Parameters

Parameter Data Type Description
sessionToken String The limited-life token used to authenticate to CWS.
differenceData Adjust The adjusted transaction amount (incremental or reversal).
applicationProfileId String A token representing the PTLS Socket ID unique to each Service Key and configuration data combination. Returned by the SaveApplicationData operation.
workflowId String Identifies the workflow to use for the transaction. If not supporting custom workflows, pass the serviceIdreturned by GetServiceInformation.
 

Return Type

Data Type Description
Response Transaction response data. Note: For Bankcard (BCP) transactions, the response object is BankcardTransactionResponsePro.
 

Exceptions

CWSFault CWSInvalidOperationFault
AuthenticationFault CWSInvalidServiceInformationFault
ExpiredTokenFault CWSOperationNotSupportedFault
InvalidTokenFault CWSTransactionAlreadySettledFault
CWSConnectionFault CWSTransactionFailedFault
CWSExtendedDataNotSupportedFault CWSTransactionServiceUnavailableFault
CWSInvalidMessageFormatFault CWSValidationResultFault
   

Code Snippets

 
public Response Adjust(string sessionToken, Adjust adjust, string applicationProfileId, string workflowId)
{
  using (var client = new CwsTransactionProcessingClient(ConfigurationManager.AppSettings["Bindings.TxnSoap"]))
  {
    try
    {
      return client.Adjust(sessionToken, adjust, applicationProfileId, workflowId);
    }
    catch (FaultException ex)
    {
      SoapFaultHandler.HandleFaultException(ex);
    }
  }
}

Operation

Response Undo(string sessionToken, Undo differenceData, string applicationProfileId, string workflowId);
 

Parameters

Parameter Data Type Description
sessionToken String The limited-life token used to authenticate to CWS.
differenceData Undo The transactionId of the transaction to void. Note: You must send in BankcardUndo for Bankcard transactions.
applicationProfileId String A token representing the PTLS Socket ID unique to each Service Key and configuration data combination. Returned by the SaveApplicationData operation.
serviceId String Conditional. Unique identifier for available services returned in the ServiceInformation object when invoking the GetServiceInformation operation. Required when not supporting workflows.
workflowId String Identifies the workflow to use for the transaction. If not supporting custom workflows, pass the serviceIdreturned by GetServiceInformation.
 

Return Type

Data Type Description
Response Transaction response data. Note: For Bankcard (BCP) transactions, the response object is BankcardTransactionResponsePro.
 

Exceptions

CWSFault CWSInvalidOperationFault
AuthenticationFault CWSInvalidServiceInformationFault
ExpiredTokenFault CWSOperationNotSupportedFault
InvalidTokenFault CWSTransactionAlreadySettledFault
CWSConnectionFault CWSTransactionFailedFault
CWSExtendedDataNotSupportedFault CWSTransactionServiceUnavailableFault
CWSInvalidMessageFormatFault CWSValidationResultFault
For additional details about each fault, refer to Transaction Processing Faults in the CWS Developer API Reference.
   

Code Snippets

public Response Undo(string sessionToken, Undo undo, string applicationProfileId, string workflowId)
{
  using (var client = new CwsTransactionProcessingClient(ConfigurationManager.AppSettings["Bindings.TxnSoap"]))
  {
    try
    {
      return client.Undo(sessionToken, undo, applicationProfileId, workflowId);
    }
    catch (FaultException ex)
    {
      SoapFaultHandler.HandleFaultException(ex);
    }
  }
}
/* NOTE: Use this function to void an authorized transaction
 * $transactionID is the known transaction ID of a previous transaction*/

public function undo($transactionID, $creds = null, $txnType = null)
{
  if (! $this->signOn ())
    return false;

  if ($this->svc instanceof BankcardService || $txnType == "BCP")
  {
    $differenceData = new BankcardUndo();
  }
  if ($this->svc instanceof ElectronicCheckingService || $txnType == "ECK")
  {
    $differenceData = new UndoDifferenceData();
  }
    $differenceData->TransactionId = $transactionID;
  if ($creds != null)
  {
    $differenceData->Addendum = new Addendum ();
    $differenceData->Addendum->Unmanaged = new Unmanaged ();
    $differenceData->Addendum->Unmanaged->Any = new Any ();
    $differenceData->Addendum->Unmanaged->Any->string = $creds;
  }

  // Build Undo
  $trans = new Undo ();
  $trans->sessionToken = $this->session_token;
  $trans->differenceData = $differenceData;
  $trans->workflowId = $this->workflowId;
  $trans->applicationProfileId = $this->appProfileID;
  //var_dump($trans);

  try
  {
    $response = $this->bankCard->Undo ( $trans )->UndoResult;
    //echo ($this->bankCard->__getLastRequest ());
    return $response;
  }
  catch ( SoapFault $e )
  {
    echo 'SERVER ERROR: Error trying to Undo.
';
    echo ('
'.$this->bankCard->__getLastRequestHeaders());
    echo ('
' . $this->bankCard->__getLastRequest ());
    echo ('
' . $this->bankCard->__getLastResponse ());
    $xmlFault = $this->bankCard->__getLastResponse ();
    $errors = handleTxnFault ( $e, $xmlFault );
    echo $errors;
    exit ();
  }
}