Broadleaf Microservices
  • v1.0.0-latest-prod

Tabby Reverse Authorization Transaction

Prerequisites

Set up your environment as described in the Environment Setup Guide

Executing a Reverse Authorization Transaction

Note
The reverse authorized transaction closes the Tabby payment and Closed is the final status of the payment. This transaction should be executed when an order is fully canceled. If only a part of the order is delivered, this part should be captured and Reverse Authorization should be executed as the last step to close the payment.

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

@RequiredArgsConstructor
public class ReverseAuthorization {

 private final TabbyTransactionService tabbyTransactionService;

 public void performReverseAuthorization() {

		 PaymentRequest paymentRequest = new PaymentRequest()
		        .additionalField("payment_id", paymentId); // The Tabby payment id gathered from the Authorize transaction.

	 	PaymentResponse paymentResponse = tabbyTransactionService.reverseAuthorize(paymentRequest);

		paymentResponse.isSuccessful();
		paymentResponse.getFailureType(); // Failure type in case the transaction was not successful
	   	paymentResponse.getRawResponse(); // Tabby raw response stored as a String
		paymentResponse.getGatewayTransactionId(); // the gateway transaction id
		paymentResponse.getResponseMap().get("payment_id"); // Tabby payment id
	   	paymentResponse.getResponseMap().get("payment_status"); // Tabby payment status
	}
}