1. Home
  2. Capture Transaction

Capture Transaction

Capture transaction is basically a process that flags an already authorized transaction to be settled in the next settlement period. Depending on the acquirer, multiple captures are permitted on a transaction, but the sum of captured amounts must be equal to or less than the initial authorize amount. It is possible to capture amounts larger than the initial authorized amount, however the capture operation may fail due to e.g. insufficient funds or like.

A Capture can only happen on a non-captured, non-canceled CCAuthorize transaction.

API Url

Environment Url Method Version
Production https://api.payxpert.com/transaction/{transactionID}/capture POST >= 0200

Capture Request

Mandatory fields
Field Type Max Length Requirement Description Version
transactionID N 20 M Initial transaction reference to capture
amount N 10 M Number in minor unit, e.g. cents; 100 dollar cent equals to 1 dollar

Capture Response

Field Type Max Length Requirement Description Version
transactionID N 20 M Transaction reference returned by the system
errorCode D 3 M See Messages and error codes
errorMessage S 100 M See Messages and error codes

PHP Gateway Client

Transaction name : Capture

PHP Methods

Method name Requirement
setReferralInformation M

PHP Example

<?php
$client = new GatewayClient();

$transaction = $client->newTransaction('Capture', 'testMerchant', 'testPassword');
$transaction->setReferralInformation($authorizeTransactionID, 200);

$response = $transaction->send();

if ('000' === $response->errorCode) {
    $captureTransactionID  = $response->transactionID;
} else {
    echo "Error {$response->errorCode} with message {$response->errorMessage}";
}
?>

Java Gateway Client

Java Methods

Connector method doCaptureTransaction
Request class CaptureRequest
Response class CaptureResponse

Java Examples

PaymentGatewayConnector connector = new PaymentGatewayConnector(API_URL, ORIGINATOR, PASSWORD);

CaptureResponse response = null;
CaptureRequest request = new CaptureRequest();
request.setTransactionId(1234567L);
request.setAmount(2500);

try {
  response = connector.doCaptureTransaction(request);
} catch (Exception e) {
  e.printStackTrace();
}

if (response != null) {
  if (TransactionResultCode.TRANSACTION_SUCCESSFULLY.equals(response.getErrorCode()) {
    System.out.println("Success: " + response.getErrorMessage());
  } else {
    System.out.println("Failure: " + response.getErrorMessage());
  }
}

Was this article helpful?