Skip to main content
Vindicia Knowledge Center

Transaction.cancel

Transaction.cancel

Transaction.cancel

The cancel method cancels a batch of previously authorized (but not yet captured) one-time Transaction objects, so that CashBox does not attempt to capture them with your payment processor. See the Transaction.auth and Transaction.capture methods for details.

For certain payment processors, who charge a fee if you do not capture an authorized transaction, Cashbox also reverses the authorization. For other processors, CashBox simply deletes its internal to-be-captured flag so that the Transaction is no longer scheduled for capture. To determine whether CashBox performs authorization reversal with your payment processor as a part of this call, contact your Vindicia Client Services representative.

For the Transaction objects for which this call is successful, CashBox changes their status to Cancelled. For those transactions whose authorization CashBox was able to reverse with the payment processors concerned, the status Void is displayed on the CashBox Portal. However, if you fetch those transactions with a fetch call, the status in the corresponding Transaction objects is Cancelled.

Note You may only cancel transactions that have not yet been captured. You may refund captured transactions but not cancel them. For details on refunds, see the Refund object.

Input

srd: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a method call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the srd. A null srd returns the complete response.

transactions: an array of Transaction objects to cancel.

Output

return: an object of type Return that indicates the success or failure of the call.

qtySuccess: the number of successful cancellations.

qtyFail: the number of failed cancellations.

results: an array of CancelResult objects that contain information on the success or failure of the call on each transaction.

The following table lists and describes the data members for the CancelResult object.

Data Members

Data Type

Description

merchantTransactionId

string

Your unique identifier for the Transaction object you asked to cancel.

returnCode

integer

The reason for the success or failure:

  • 200: cancel() succeeded.
  • 402: The Transaction object has expired and cannot be cancelled.
  • 404: cancel() cannot load the Transaction object, likely because the VID or your transaction ID (merchantTransactionId) is invalid.
  • 405: You did not specify an authorized transaction.

Returns

In addition to those listed in Standard Return Codes, this call returns:

Return Code

Return String

400

One of the following:

  • Must specify transaction.
  • Unable to save transactions: error-description.

Note A return code of 200 does not mean that all input transactions have been successfully cancelled. Be sure to examine the output parameters, such as qtySuccess, qtyFail, and results, to check which transactions were successfully cancelled and which failed to cancel.

Example

// create an empty transaction object to the make the SOAP calls
// against

$soap_tx = new Transaction();

$tx1 = new Transaction();
$tx2 = new Transaction();

// ids of previously authorized transactions

$merchantTxnId1 = '9876-5432';
$merchantTxnId2 = '9876-5437';

$tx1->setMerchantTransactionId($merchantTxnId1);
$tx2->setMerchantTransactionId($merchantTxnId2);
$txnArray = array($tx1, $tx2);

$response = $soap_tx->cancel($txnArray);

if($response['returnCode']==200) {

$cancelResults = $response['results'];
foreach ($cancelResults as $cancelResult) {

if ($cancelResult->returnCode == 200) {
print ("Transaction with id " .

$cancelResult->merchantTransactionId .
" was successfully cancelled");

}

}

}

For Users

Learn More
For Users

Cashbox Features

Learn More
Cashbox Features
Back to Top