Skip to main content

Payment Response

take note

The reversal function for QR Payment is available for Duitnow and Alipay+ .

Step 1 : Library

Merchant shall include PayMaster Merchant Plug-In (MPI) Java library – PayMaster.jar into merchant application.

Step 2 : Import

For reversal payment, merchant shall import below into 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/","CardPayment.properties");

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

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

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

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 using PropertiesReader

Merchant must indicate where the PayMaster Properties File located using PropertiesReader.

Step 5 : Indicate PayMaster Properties File location using setter

Merchant must indicate where the PayMaster Properties File located using setter(“ResponseMessage”,”<response message returned by PayMaster Gateway>”).

Step 6 : Assign value into PayMaster Response Entity

Merchant call to Card Payment Response Message Builder to message the response message and assign the values into PayMaster Response Entity.

info

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

Step 7 : Retrieve value from PayMaster Response Entity

Merchant can retrieve the values from PayMaster Response Entity.

  • The getter function is used to retrieve value and the function only accepts one parameter – getter(parameter name).
note

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