SOAP API Reference
Capture (SOAP)
Capture
The Capture
operation is used to capture a single transaction for settlement after it has been successfully authorized by the Authorize
operation.
Capture differenceData
object is required when capturing a single transaction with a settlement amount different from the original authorization amount, or when ship date is required in MOTO transactions.
In the Capture differenceData
object, the Amount
parameter should be equal to the new amount being captured.
For example:
Authorize Amount = 10.00; Capture Amount = 10.00; Settled Amount = 10.00 | Authorize Amount = 10.00; Capture Amount = 14.00 (result of +$4.00 INCAUTH); Settled Amount = 14.00 | Authorize Amount = 10.00; Capture Amount = 8.00 (result of -$2.00 REVAUTH); Settled Amount = 8.00 |
Operation
Response Capture(string sessionToken, Capture differenceData, string applicationProfileId, string workflowId);
Parameters
Parameter | Data Type | Description |
---|---|---|
sessionToken |
String | The limited-life token used to authenticate to CWS. |
differenceData |
Capture |
The capture details for a single transaction. Note: You must send in BankcardCapture 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. |
workflowId |
String | Identifies the workflow to use for the transaction. If not supporting custom workflows, pass the serviceId returned byGetServiceInformation . |
Return Type
Data Type | Description |
---|---|
Response |
Capture response data. Note: For Bankcard (BCP) transactions, the response object is BankcardCaptureResponse . |
Exceptions
CWSFault |
CWSInvalidOperationFault |
AuthenticationFault |
CWSInvalidServiceInformationFault |
ExpiredTokenFault |
CWSOperationNotSupportedFault |
InvalidTokenFault |
CWSTransactionAlreadySettledFault |
CWSConnectionFault |
CWSTransactionFailedFault |
CWSExtendedDataNotSupportedFault |
CWSTransactionServiceUnavailableFault |
CWSInvalidMessageFormatFault |
CWSValidationResultFault |
Code Snippets
public Response Capture(string sessionToken, Capture capture, string applicationProfileId, string workflowId) { using (var client = new CwsTransactionProcessingClient(ConfigurationManager.AppSettings["Bindings.TxnSoap"])) { try { return client.Capture(sessionToken, capture, applicationProfileId, workflowId); } catch (FaultException ex) { SoapFaultHandler.HandleFaultException(ex); } } }
/* $transactionID is the known transaction ID of a previous transaction * $amount is the amount of money to charge, leave it empty to charge existing amount * $tip_amount is the amount of tip money to charge, leave it empty to charge existing amount*/ public function capture($transactionID, $creds = null, $amount = null, $tip_amount = null) { if (! $this->signOn ()) return false; $cap = new BankcardCapture (); $cap->TransactionId = $transactionID; $cap->Amount = $amount; $cap->TipAmount = $tip_amount; if ($creds != null) { $cap->Addendum = new Addendum (); $cap->Addendum->Unmanaged = new Unmanaged (); $cap->Addendum->Unmanaged->Any = new Any (); $cap->Addendum->Unmanaged->Any->string = $creds; } // Build Capture $trans = new CaptureAuth (); $trans->sessionToken = $this->session_token; $trans->differenceData = $cap; $trans->merchantProfileId = $this->merchantProfileID; $trans->workflowId = $this->workflowId; $trans->applicationProfileId = $this->appProfileID; try { $capResponse = $this->bankCard->Capture ( $trans )->CaptureResult; //echo (' '.$this->bankCard->__getLastRequestHeaders()); //echo (' '.$this->bankCard->__getLastRequest()); /*echo (' '.$this->bankCard->__getLastResponseHeaders()); echo (' '.$this->bankCard->__getLastResponse());*/ return $capResponse; } catch ( SoapFault $e ) { echo " REQUEST:\n" . $this->bankCard->__getLastRequest() . "\n "; process_soap_error ( $e ); echo 'SERVER ERROR: Error trying to Capture. '; $xmlFault = $this->bankCard->__getLastResponse (); $errors = handleTxnFault ( $e, $xmlFault ); echo $errors; exit (); } }
CaptureAll
The CaptureAll operation is used to flag all transactions for settlement that have been successfully authorized using the Authorize
operation. Merchants may wish to invoke this operation to ensure all transactions are included in the batch that is sent for settlement processing by the cut-off times established by the service provider or to transmit smaller batches to the service provider for settlement.
In addition, when performing CaptureAll
on terminal capture hosts, settlement times of up to 5 minutes or more are not uncommon depending on the number of transactions in the batch. Client applications need to anticipate and account for longer settlement processing times in their time-out management schemes.
Capture differenceData
object is required when capturing a single transaction with a settlement amount different from the original authorization amount or when ship date is required in MOTO transactions.
In the Capture differenceData
object, the Amount
parameter should be equal to the new amount being captured.
For example:
Authorize Amount = 10.00; Capture Amount = 10.00; Settled Amount = 10.00 | Authorize Amount = 10.00; Capture Amount = 14.00 (result of +$4.00 INCAUTH); Settled Amount = 14.00 | Authorize Amount = 10.00; Capture Amount = 8.00 (result of -$2.00 REVAUTH); Settled Amount = 8.00 |
Operation
List<Response> CaptureAll(string sessionToken, List<Capture> differenceData, List<String> batchIds, string applicationProfileId, <em>MerchantProfile merchantProfile</em>, string merchantProfileId, string workflowId);
Parameters
Parameter | Data Type | Description |
---|---|---|
sessionToken |
String | The limited-life token used to authenticate to CWS. |
differenceData |
List<Capture > |
A list of one or more transactions to capture. Note: You must send in BankcardCapture for Bankcard transactions. |
batchIds |
List<String> | A list of one or more batch Ids to capture. |
applicationProfileId |
String | A token representing the PTLS Socket ID unique to each Service Key and configuration data combination. Returned by the SaveApplicationData operation. |
merchantProfileId |
String | The specific Merchant Profile Identifier to use. |
workflowId |
String | Identifies the workflow to use for the transaction. If not supporting custom workflows, pass the serviceId returned by GetServiceInformation . |
Return Type
Data Type | Description |
---|---|
List<Response > |
A collection of capture response data. Note: For Bankcard (BCP) transactions, the response object is BankcardCaptureResponse . |
Exceptions
CWSFault |
CWSInvalidOperationFault |
AuthenticationFault |
CWSInvalidServiceInformationFault |
ExpiredTokenFault |
CWSOperationNotSupportedFault |
InvalidTokenFault |
CWSTransactionAlreadySettledFault |
CWSConnectionFault |
CWSTransactionFailedFault |
CWSExtendedDataNotSupportedFault |
CWSTransactionServiceUnavailableFault |
CWSInvalidMessageFormatFault |
CWSValidationResultFault |
Code Snippets
public List CaptureAll(string sessionToken, List captures, string applicationProfileId, string merchantProfileId, string workflowId, List batchIds = null) { Type type = typeof(T); if (_msgFormat == MessageFormat.SOAP.ToString()) { var bankcardCaptures = new List(); var regularCaptures = new List(); if (type == typeof(BankcardCapture)) { foreach (var capture in captures) { bankcardCaptures.Add(capture as BankcardCapture); } } else { foreach (var capture in captures) { regularCaptures.Add(capture as Capture); } } using (var client = new CwsTransactionProcessingClient(ConfigurationManager.AppSettings["Bindings.TxnSoap"])) { try { if(bankcardCaptures.Count &gt; 0 &amp;&amp; batchIds != null) return client.CaptureAll(sessionToken, bankcardCaptures.ToArray(), batchIds.ToArray(), applicationProfileId, merchantProfileId, workflowId).ToList(); if(bankcardCaptures.Count &gt; 0) return client.CaptureAll(sessionToken, bankcardCaptures.ToArray(), null, applicationProfileId, merchantProfileId, workflowId).ToList(); if(batchIds != null) return client.CaptureAll(sessionToken, regularCaptures.ToArray(), batchIds.ToArray(), applicationProfileId, merchantProfileId, workflowId).ToList(); return client.CaptureAll(sessionToken, regularCaptures.ToArray(), null, applicationProfileId, merchantProfileId, workflowId).ToList(); } catch (FaultException ex) { SoapFaultHandler.HandleFaultException(ex); } } }
/* $differenceData is an object that contains any data to adjust at the time of settlement */ public function captureAll($differenceData, $creds = null) { if (! $this-&gt;signOn ()) return false; if ($this-&gt;svc instanceof BankcardService) { $diffDataArray = array (); $caDiffData = new CaptureDifferenceData (); if ($differenceData != null) { $i = 0; if (is_array ( $differenceData )) { foreach ( $diffData as $differenceData ) { $caDiffData-&gt;TransactionId = $diffData-&gt;transactionID; $caDiffData-&gt;Amount = $diffData-&gt;amount; $caDiffData-&amp;gt;TipAmount = $diffData-&gt;tip_amount; $caDiffData-&gt;ShipDate = $diffData-&gt;shipDate; $diffDataArray [] = $caDiffData; } } else { $caDiffData-&gt;TransactionId = $diffData-&gt;transactionID; $caDiffData-&gt;Amount = $diffData-&gt;amount; $caDiffData-&gt;TipAmount = $diffData-&gt;tip_amount; $caDiffData-&gt;ShipDate = $diffData-&gt;shipDate; $diffDataArray [] = $caDiffData; } if ($creds != null) { $diffDataArray [0]-&gt;Addendum = new Addendum (); $diffDataArray [0]-&gt;Addendum-&gt;Unmanaged = new Unmanaged (); $diffDataArray [0]-&gt;Addendum-&gt;Unmanaged-&gt;Any = new Any (); $diffDataArray [0]-&gt;Addendum-&gt;Unmanaged-&gt;Any-&gt;string = $creds; } } } if ($creds != null) { $diffDataArray = array (); $caDiffData = new CaptureDifferenceData (); $caDiffData-&gt;TransactionId = '-1'; $diffDataArray [] = $caDiffData; $diffDataArray [0]-&gt;Addendum = new Addendum (); $diffDataArray [0]-&gt;Addendum-&gt;Unmanaged = new Unmanaged (); $diffDataArray [0]-&gt;Addendum-&gt;Unmanaged-&gt;Any = new Any (); $diffDataArray [0]-&gt;Addendum-&gt;Unmanaged-&gt;Any-&gt;string = $creds; } // Build Capture $trans = new CaptureAll (); $trans-&gt;sessionToken = $this-&gt;session_token; $trans-&gt;differenceData = $diffDataArray; $trans-&gt;merchantProfileId = $this-&gt;merchantProfileID; $trans-&gt;workflowId = $this-&gt;workflowId; $trans-&gt;applicationProfileId = $this-&gt;appProfileID; try { $capAllResponse = $this-&gt;bankCard-&gt;CaptureAll ( $trans )-&gt;CaptureAllResult; //echo (' '.$this-&gt;bankCard-&gt;__getLastRequestHeaders()); //echo (' '.$this-&gt;bankCard-&gt;__getLastRequest()); //echo (' '.$this-&gt;bankCard-&gt;__getLastResponseHeaders()); //echo (' \n'.$this-&gt;bankCard-&gt;__getLastResponse().'\n'); return $capAllResponse; } catch ( SoapFault $e ) { /*echo " REQUEST:\n" . $this-&gt;bankCard-&gt;__getLastRequest() . "\n ";*/ //process_soap_error ( $e ); echo 'SERVER ERROR: Error trying to Capture. '; echo (' '.$this-&gt;bankCard-&gt;__getLastRequest()); $xmlFault = $this-&gt;bankCard-&gt;__getLastResponse (); $errors = handleTxnFault ( $e, $xmlFault ); echo $errors; exit (); } }