Cancel Transaction

This transaction cancels a transaction prior to authorization and reverts the card reader to the welcome screen.

error_outline
note
  • Canceling a transaction during an EMV authorization reverses the transaction if the gateway returns an approval response.
  • Cancelation of a non-EMV transaction (mag stripe, manual entry, and token) is not allowed during authorization.

Code Samples

CWS

Request

method
string | required
cancelPaymentTransaction
 
requestId
string | required
Transaction Request ID
 
targetType
string | required
paymentGatewayConverge
 
parameters
JSONObject | required
All relevant parameters for canceling transactions.
 
paymentGatewayId
string | required
Payment Gateway ID
Unique identifier of the payment gateway as returned in the openPaymentGateway transaction response.
chanId
boolean | required
Transaction ID
Important: Returned in the startPaymentTransaction response.

Response

requestId
string
Transaction request ID specified in request.
 
statusDetails
string
Status of the request.
 
data
JSONObject
Object holding various responses.
 
paymentGatewayCommand
JSONObject
Payment Gateway Command
 
completed
boolean
Transaction Status
 
eventQueue
array
Event Queue
 
chanId
boolean
Transaction ID
Identifier used to query the status of the transaction until completion.
paymentTransactionData
JSONObject
Payment Transaction Data
 
result
string
Result
 

Example

Request
{
  "method" : "cancelPaymentTransaction",
  "requestId" : "1574338436",
  "targetType" : "paymentGatewayConverge",
  "version" : "1.0",
  "parameters" : {
    "paymentGatewayId" : "4f4912f4-9d24-4c0d-9e0c-dad8de366999",
    "chanId" : "b8428b3c-b84e-42c2-9fc6-39a834ecac27"
  }
}
Response
{
  "requestId" : "1574338436",
  "statusDetails" : "REQUEST_ACCEPTED",
  "data" : {
    "paymentGatewayCommand" : {
      "completed" : true,
      "eventQueue" : [ ],
      "chanId" : "b8428b3c-b84e-42c2-9fc6-39a834ecac27",
      "paymentTransactionData" : {
        "result" : "CANCELED"
      }
    }
  }
}

Java

ECCError error = account.getTransactionProcessor().cancelTransaction(transaction, tender, transactionListener);
if (error != null) {
  // couldn’t cancel transaction
}

Objective-C

NSError *error = [account.transactionProcessor cancelTransaction:transaction using:tender delegate:delegate];
if (error != nil) {
  // couldn’t cancel transaction
}

If the transaction is able to be canceled, ECLTransactionProcessingDelegate::transactionDidCancel will be called.

C#

PaymentTransactionResults tr = m_CWS.CancelPaymentTransaction(m_PaymentGatewayId, chanId, null);