Skip to main content

Payment Response

The following guideline provides an explanation on how to integrate and utilize the corresponding source code in the merchant's application to retrieve payment response parameters from the response message returned by PayMaster.

Step 1 : Library

The merchant shall include the PayMaster Merchant Plug-In (MPI) Java library, PayMaster.jar, in the merchant application.

Step 2 : Import

For reversal payments, the merchant should import the following into their code:

  • com.PayMaster.Entities.PayMasterEntity
  • com.PayMaster.PropertiesReader.PropertiesReader
  • com.PayMaster.MessageResponseBuilder.PaymentResponseMessageBuilder

Step 3 : Source Code

import com.PayMaster.Entities.PayMasterEntity;
import com.PayMaster.PropertiesReader.PropertiesReader;
import com.PayMaster.MessageResponseBuilder.PaymentResponseMessageBuilder;

// Declare a variable for PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File Name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "CardPayment.properties");

// Declare a variable for PayMaster Entity
PayMasterEntity paymentResponseEntity = new PayMasterEntity();

// Get the response message from PayMaster and set it into PayMaster Entity
paymentResponseEntity.setter("ResponseMessage", responseMessage);

// Call PaymentResponseMessageBuilder to parse the response message
PaymentResponseMessageBuilder paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
paymentResponseMessageBuilder.buildCardPaymentResponseMessage(paymentResponseEntity, propertiesReader);

// Retrieve values from PayMaster Response Entity
String MerchantID = paymentResponseEntity.getter("MerchantID");
String MerchRefNo = paymentResponseEntity.getter("MerchRefNo");
String TxnStatus = paymentResponseEntity.getter("TxnStatus");
String SHAlgorithmType = paymentResponseEntity.getter("SHAlgorithmType");
String SHValue = paymentResponseEntity.getter("SHValue");

Step 4 : Indicate PayMaster Properties File Location

The merchant must specify the location of the PayMaster Properties File using PropertiesReader.

Step 5 : Set Response Message Using Setter

The merchant must set the response message returned by PayMaster Gateway using the setter method: paymentResponseEntity.setter("ResponseMessage", "<response message returned by PayMaster Gateway>");

Step 6 : Parse and Assign Values into PayMaster Response Entity

The merchant should call the CardPaymentResponseMessageBuilder to parse the response message and assign the values to the PayMaster Response Entity.

Refer to Reversal Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).

Step 7 : Retrieve Values from PayMaster Response Entity

The merchant can retrieve values from the PayMaster Response Entity.

  • The getter function is used to retrieve values and accepts one parameter: getter(parameter name).

Ensure that the value of TxnStatDetCde is not equal to 5015, as this represents an invalid secure hash value.