1. Home
  2. Query Transaction Status

Query Transaction Status

This function allows merchant to query the current status of a previous transaction based on a transactionID.

API Url

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

Query Request

No fields are needed in the request. The transaction reference is in the URI.

Query Response

Field Type Max Length Requirement Description Version
errorCode D 3 M See Messages and error codes
errorMessage S 100 M See Messages and error codes
transaction O M Transaction object if found. (see Common Data Structures)

PHP Gateway Client

Transaction name : Status

PHP Methods

Method name Requirement
setTransactionID M

PHP Example

<?php
$client = new GatewayClient();

$transaction = $client->newTransaction('StatusTransaction', 'testMerchant', 'testPassword');
$transaction->setTransactionID($transactionID);

$response = $transaction->send();

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

Java Gateway Client

Java Methods

Connector method getTransactionStatus
Request class TransactionStatusRequest
Response class TransactionStatusResponse

Java Examples

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

TransactionStatusResponse response = null;
TransactionStatusRequest request = new TransactionStatusRequest();
request.setTransactionId(1234567L);

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

if (response != null) {
  if (TransactionResultCode.TRANSACTION_SUCCESSFULLY.equals(response.getErrorCode()) {
    // Just examples, careful to NPE
    System.out.println("Success: " + response.getErrorMessage());
    System.out.println("Transaction order ID: " + response.getTransaction().getOrderId());
    // If account is allowed to access payment mean info
    if (TransactionType.CREDIT_CARD.equals(response.getTransaction().getPaymentType())) {
      CreditCardPaymentMeanInfo pmInfo = response.getTransaction().getPaymentMeanInfo(CreditCardPaymentMeanInfo.class);
      System.out.println("Credit card is a " + pmInfo.getCardBrand().getFormattedMessage(Locale.ENGLISH));
    }
  } else {
    System.out.println("Failure: " + response.getErrorMessage());
  }
}
Still any doubt?

Open a support ticket

Was this article helpful?