Skip to main content

Payment Response

The following guideline explains how to apply the corresponding source code in a merchant's website or application to retrieve the payment response parameters from the response message returned by PayMaster.

Step 1 : Library

Include the PayMaster Merchant Plug-In (MPI) Java library – PayMaster.jar – into your merchant application.

Step 2 : Import

For UPP payments, import the following into your merchant 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 variable for Payment Master Properties - 1st Parameter = File Path , 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "UPPPayment.properties");

// Declare variable for Payment Master Entity
PayMasterEntity paymentResponseEntity = new PayMasterEntity();

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

// Call Payment Master Payment Response Message Builder to set value
PaymentResponseMessageBuilder paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
paymentResponseMessageBuilder.buildUPPPaymentResponseMessage(paymentResponseEntity, propertiesReader);

if (paymentResponseEntity.getter("TxnStatDetCde").equals("0000")) {
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");
// Additional processing...
}

.....

Step 4 : Indicate PayMaster Properties File Location

Indicate the location of the PayMaster Properties File using PropertiesReader.

Step 5 : Set Response Message

Set the response message from the PayMaster Gateway using the setter method: paymentResponseEntity.setter("ResponseMessage", "<response message returned by PayMaster Gateway>");.

Step 6 : Build Payment Response Message

Call the UPP Payment Response Message Builder to parse the response message and assign values to the PayMaster Response Entity.

Step 7 : Retrieve Values from PayMaster Response Entity

Retrieve values from the PayMaster Response Entity using the getter method: String value = paymentResponseEntity.getter("parameter name");.

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

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