1. Home
  2. Refund Transaction

Refund Transaction

A refund is the process of refunding a previously settled transaction. A refund appears as a credit on the card holder’s credit card statement.
It is possible to do multiple refunds on a transaction, but the sum of the refunded amounts must be equal to or less than the amount of the original transaction.

A Refund can only happen on a CCSale, Capture or Rebill transaction. In the case of a Capture transaction, the transactionID of the Capture (not the initial CCAuthorize) must be passed as a parameter.


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

Refund Request

Field Type Max Length Requirement Description Version
transactionID N 20 M Initial transaction reference to refund
amount N 10 M Number in minor unit, e.g. cents; 100 dollar cent equals to 1 dollar
cancelSubscription B NA O If true (default), also cancel an eventual subscription associated with the refunded transaction >= 0204

Refund 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 : Refund

PHP Methods

Method name Requirement
setReferralInformation M

PHP Example

$client = new GatewayClient();

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

$response = $transaction->send();

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

Java Gateway Client

Java Methods

Connector method doRefundTransaction
Request class RefundRequest
Response class RefundResponse

Java Examples

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

RefundResponse response = null;
RefundRequest request = new RefundRequest();

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

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?