Skip to main content

Payment Request

The following guideline is to provide explanation on how to apply the corresponding source code in merchant website and application in order to form the payment request parameters which the merchant can have in the redirect link and send to PayMaster for QR payment processing.

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 QR payment, the merchant should import the following into their code:

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

Step 3 : Source Code

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

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

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

// Set parameter values into Payment Master Entity
paymentRequestEntity.set("PaymentID", "Q03");
paymentRequestEntity.set("MerchRefNo", "merchant-refNo-0001");
paymentRequestEntity.set("CurrCode", "458");
paymentRequestEntity.set("TxnAmt", "1.00");
paymentRequestEntity.set("ExpTxnAmt", "2");
paymentRequestEntity.set("TerminalID", "200039XX");
paymentRequestEntity.set("PayloadInd", "12");
paymentRequestEntity.set("PANInd", "26");
paymentRequestEntity.set("CountryCode", "MY");
paymentRequestEntity.set("TxnFlag", "CP");
paymentRequestEntity.set("SndrIDType", "2");
paymentRequestEntity.set("QRPayload", "00020201021226470014A00...");

// Generate the payment request message
PaymentRequestMessageBuilder messageBuilder = new PaymentRequestMessageBuilder();
String paymentMessage = messageBuilder.buildPaymentRequestMessage(paymentRequestEntity, propertiesReader);

// POST request to Payment Master Gateway for QR Payload
String initialUrl = "https://xxx.finexusgroup.com/upp/faces/qrPushPayment.xhtml?" + paymentMessage;
HttpURLConnection connection = null;
URL url = new URL(initialUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
in.close();
String finalUrl = connection.getURL().toString();

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

Assign values to the PayMaster Request Entity. Ensure all fields as shown in the sample code are included, as they are mandatory. Use the setter function to assign values, the function accepts two parameters: setter(parameter name, parameter value).

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

Step 6 : Generate Consumer Presented QR Payment

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

Step 7 : Send the Payment Message to the PayMaster Gateway

Send the paymentMessage to the PayMaster Gateway for the QR Payload.

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