The /voidTransaction
method is used to cancel Sales/Credits/APM requests/transactions during the short time window between submitting the Sale/Credit/APM request and the moment that the Sale/Credit/APM transmission is passed. For example, in the best-case scenario, voiding may only be possible up to 24 hours after submitting the Sale/Credit request.
When sending a /voidTransaction
request, you must provide the relatedTransactionId
(which is the original Sale/Credit/APM transactionId
) and the authCode
.
Example /voidTransaction
Request
{ "merchantId": "<your merchantId>", "merchantSiteId": "<your merchantSiteId>", "relatedTransactionId": "<transactionId returned from /payment>", "amount": "200", "currency": "USD", "urlDetails": { "notificationUrl": "<notificationURL>" }, "clientRequestId": "<unique request ID in merchant system>", "clientUniqueId": "<unique transaction ID in merchant system>", "timeStamp": "<YYYYMMDDHHmmss>", "checksum": "<calculated checksum>" }
//Initialize the SDK (see https://docs.nuvei.com/?p=53233) <?php //voidTransaction $voidResponse = $safeCharge->getPaymentService()->voidTransaction([ 'clientUniqueId' => '<unique transaction ID in merchant system>', 'amount' => '200', 'currency' => 'USD', 'relatedTransactionId' => '<transactionId returned from /payment>', ]); ?>
//Initialize the SDK (see https://docs.nuvei.com/?p=29433) { String clientUniqueId = "<unique transaction ID in merchant system>"; String clientRequestId = "<unique request ID in merchant system>"; String currency = "USD"; String amount = "200"; String relatedTransactionId = "<transactionId returned from /payment>"; Safecharge safecharge = new Safecharge(); SafechargeResponse response = safecharge.voidTransaction(clientRequestId, relatedTransactionId, amount, currency, null, clientUniqueId, null, null, null, null, null, null); }
//Initialize the SDK (see https://docs.nuvei.com/?p=48413) var response = safecharge.VoidTransaction( "US", "200", relatedTransactionId: "<transactionId returned from /payment>", clientRequestId: "<unique request ID in merchant system>", clientUniqueId: "<unique transaction ID in merchant system>");
//Initialize the SDK (see https://docs.nuvei.com/?p=53443) safecharge.paymentService.voidTransaction({ clientRequestId : "<unique request ID in merchant system>", clientUniqueId : "<unique transaction ID in merchant system>, amount : "200", currency : "USD", relatedTransactionId: "<transactionId returned from /payment>", }, function (stlErr, stlRes, reqData) { console.log(stlErr, stlRes); });
Example /voidTransaction
Response
{ "transactionId": "1110000000004320759", "externalTransactionId": "", "gwErrorCode": 0, "gwExtendedErrorCode": 0, "transactionStatus": "APPROVED", "authCode": "111454", "clientUniqueId": "20200307173638", "CVV2Reply": "", "AVSCode": "", "transactionType": "VoidCredit", "customData": "", "acquirerId": "19", "bin": "400002", "last4Digits": "8694", "ccCardNumber": "4****8694", "ccExpMonth": "09", "ccExpYear": "21", "cardType": "Credit", "cardBrand": "VISA", "v2supported": "false", "internalRequestId": 178720058, "status": "SUCCESS", "errCode": 0, "reason": "", "merchantId": "4960497427404081578", "merchantSiteId": "197846", "version": "1.0", "clientRequestId": "20200307173638" }