Broadleaf Microservices
  • v1.0.0-latest-prod

Verifone Reverse Authorization Transaction

Prerequisites

Set up your environment as described in the Environment Setup Guide

Executing a Reverse Authorization Transaction

Use the following code snippet to perform a Reverse Authorization transaction:

public class ReverseAuthorization {

 @Autowired
 VerifoneTransactionService verifoneTransactionService;

 public void performReverseAuthorization() {

		 PaymentRequest paymentRequest = new PaymentRequest()
		        .additionalField("id", transactionId); // The Verifone id of the original Authorize transaction

	 	PaymentResponse paymentResponse = verifoneTransactionService.reverseAuthorize(paymentRequest);

		paymentResponse.isSuccessful();
		paymentResponse.getGatewayResponseCode(); // Verifone reason_code
        paymentResponse.getGatewayTransactionId(); // Verifone transaction ID
        paymentResponse.getMessage(); // Verifone response message
		paymentResponse.getFailureType(); // Failure type in case the transaction was not successful.
	  	paymentResponse.getResponseMap().get("id"); // Verifone transaction ID
	  	paymentResponse.getResponseMap().get("status"); // Verifone transaction status
	  	paymentResponse.getResponseMap().get("processor_reference"); // Reference identifying the transaction, as provided by the processor.

        // When the payment is authorized successfully, this field holds the authorization code for the payment.
        // When the payment is not authorized, this field is not returned.
	  	paymentResponse.getResponseMap().get("rrn");
        paymentResponse.getResponseMap().get("arn");
	   	paymentResponse.getRawResponse(); // Verifone Raw response stored as a JSON object
	}
}