Skip to main content

Payment Request

After retrieving the bank list via Bank Listing, use the returned FICode and AcqBank values in the Payment request to process the payment.

Step 1 : Library

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

Step 2 : Import

For Payment, the merchant should import the following into their code:

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

Step 3 : Source Code

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

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

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

// Get all the parameter values from the user side and set into PayMaster Entity
paymentRequestEntity.setter("MerchantID", "000010000099939");
paymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL");
paymentRequestEntity.setter("PaymentID", "D01");
paymentRequestEntity.setter("TxnAmt", "1.00");
paymentRequestEntity.setter("ExpTxnAmt", "2");
paymentRequestEntity.setter("CurrCode", "458");
paymentRequestEntity.setter("CountryCode", "MY");
paymentRequestEntity.setter("EcommMerchInd", "2");
paymentRequestEntity.setter("TerminalID", "10002303");

// Get the FICode and AcqBank from the BankListing
paymentRequestEntity.setter("FICode", "RPP");
paymentRequestEntity.setter("AcqBank", "FNXSMYNB");

// Call PaymentRequestMessageBuilder to generate the message
PaymentRequestMessageBuilder messageBuilder = new PaymentRequestMessageBuilder();
String paymentMessage = messageBuilder.buildPaymentRequestMessage(paymentRequestEntity, propertiesReader);

// Redirect the message generated for settlement
response.sendRedirect(<Your_Payment_Screen_URL> + paymentMessage);

Step 4 : Indicate PayMaster Properties File Location

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

Step 5 : Assign Values to the Payment Request Entity

The merchant must assign values to the PayMaster Request Entity using the setter function: setter(parameter name, parameter value).

Obtain FICode and AcqBank from the Bank Listing response. Refer to Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).

Step 6 : Generate the Payment Message

Once all mandatory values are assigned, call the PaymentRequestMessageBuilder to generate the Payment message (paymentMessage).

Step 7 : Send the Payment Message to the PayMaster Gateway

The paymentMessage will be sent to the PayMaster Gateway for settlement.

Refer to Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).