Payment Query
This guideline provides an explanation of how to apply the corresponding source code in the merchant's website or application to generate the mandatory payment request parameters. These parameters should be included in the redirect link and sent to PayMaster for QR payment query processing.
- Java
- .Net
- PHP
- Python
- Node.js
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 query, the merchant should import the following into their code:
com.PayMaster.Entities.PayMasterEntity
com.PayMaster.PropertiesReader.PropertiesReader
com.PayMaster.MessageRequestBuilder.WebservicePaymentRequestMessageBuilder
Step 3 : Source Code
import com.PayMaster.Entities.PayMasterEntity;
import com.PayMaster.PropertiesReader.PropertiesReader;
import com.PayMaster.MessageRequestBuilder.WebservicePaymentRequestMessageBuilder;
// Declare variable for Payment Master Properties
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "UPPPayment.properties");
// Declare variable for Payment Master Entity
PayMasterEntity paymentRequestEntity = new PayMasterEntity();
// Set parameters in Payment Master Entity
paymentRequestEntity.setter("PaymentID", "U02");
paymentRequestEntity.setter("MerchantID", "000010000099939");
paymentRequestEntity.setter("ServiceID", "FNX");
paymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL");
paymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");
// Call Payment Master Payment Request Message Builder to generate the message
WebservicePaymentRequestMessageBuilder messageBuilder = new WebservicePaymentRequestMessageBuilder();
messageBuilder.buildUPPQueryRequestMessage(paymentRequestEntity, propertiesReader);
// Retrieve values from Payment Master Entity
String MerchantID = paymentRequestEntity.getter("MerchantID");
String CardNo = paymentRequestEntity.getter("CardNo");
String TxnDtTm = paymentRequestEntity.getter("TxnDtTm");
String TxnAmt = paymentRequestEntity.getter("TxnAmt");
String TxnStatus = paymentRequestEntity.getter("TxnStatus");
String CurrCode = paymentRequestEntity.getter("CurrCode");
String AuthIDRespCode = paymentRequestEntity.getter("AuthIDRespCode");
String ExpTxnAmt = paymentRequestEntity.getter("ExpTxnAmt");
String RetrievalRefNo = paymentRequestEntity.getter("RetrievalRefNo");
String OrgRespCode = paymentRequestEntity.getter("OrgRespCode");
String OrigTxnAmt = paymentRequestEntity.getter("OrigTxnAmt");
String OrigCurrCode = paymentRequestEntity.getter("OrigCurrCode");
String TxnChannel = paymentRequestEntity.getter("TxnChannel");
String FICode = paymentRequestEntity.getter("FICode");
String PymtGwRefNo = paymentRequestEntity.getter("PymtGwRefNo");
String TxnStatDetCde = paymentRequestEntity.getter("TxnStatDetCde");
String TxnStatMsg = paymentRequestEntity.getter("TxnStatMsg");
String ServiceID = paymentRequestEntity.getter("ServiceID");
String MerchHostID = paymentRequestEntity.getter("MerchHostID");
String MerchSessionID = paymentRequestEntity.getter("MerchSessionID");
String MerchRefNo = paymentRequestEntity.getter("MerchRefNo");
String OrderRefNo = paymentRequestEntity.getter("OrderRefNo");
String QueryStatus = paymentRequestEntity.getter("QueryStatus");
String FPXRefNo = paymentRequestEntity.getter("FPXRefNo");
String UppPymtMode = paymentRequestEntity.getter("UppPymtMode");
String OrigRespCode = paymentRequestEntity.getter("OrigRespCode");
String ExporigTxnAmt = paymentRequestEntity.getter("ExporigTxnAmt");
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 PayMaster Request Entity
The merchant should assign values to the PayMaster Request Entity. The merchant's code must include all the fields as stated in the sample code, as they are mandatory.
- Use the setter function to assign values, it takes two parameters:
setter(parameter name, parameter value)
.
Step 6 : Call the Web Service Payment Request Message Builder
After assigning all mandatory values, call the WebservicePaymentRequestMessageBuilder
with the buildUPPQueryRequestMessage
function.
- This will generate and submit the Payment Query Request message to the PayMaster Gateway.
- The query response from PayMaster Gateway will be processed and assigned back to the PayMaster Request Entity.
Step 7 : Retrieve Values from PayMaster Request Entity
You can use the same PayMaster Request Entity to retrieve the query response information.
- Use the getter function to retrieve values; it takes one parameter:
getter(parameter name)
.
Refer to Query Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant must include the PayMaster Merchant Plug-In (MPI) .NET library, PayMaster.dll, in the merchant application.
Step 2 : Namespace
For QR Payment Query, the merchant shall include the following namespaces in the merchant code:
using com.PayMaster.Entities
using com.PayMaster.Properties
using com.PayMaster.MessageRequestBuilder
Step 3 : Source Code
using com.PayMaster.Entities;
using com.PayMaster.Properties;
using com.PayMaster.MessageRequestBuilder;
// Declare variable for Payment Master Properties
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "UPPPayment.properties");
// Declare variable for Payment Master Entity
PayMasterEntity qrPaymentRequestEntity = new PayMasterEntity();
// Set parameters in Payment Master Entity
qrPaymentRequestEntity.setter("PaymentID", "U02");
qrPaymentRequestEntity.setter("MerchantID", "000010000099939");
qrPaymentRequestEntity.setter("ServiceID", "FNX");
qrPaymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL");
qrPaymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");
// Call Payment Master Web Service Payment Request Message Builder for QR query request
WebServicePaymentRequestMessageBuilder qrMessageBuilder = new WebServicePaymentRequestMessageBuilder();
qrMessageBuilder.builderUPPPaymentQueryRequest(qrPaymentRequestEntity, propertiesReader);
// Retrieve values from Payment Master Entity
string MerchantID = qrPaymentRequestEntity.getter("MerchantID");
string CardNo = qrPaymentRequestEntity.getter("CardNo");
string TxnDtTm = qrPaymentRequestEntity.getter("TxnDtTm");
string TxnAmt = qrPaymentRequestEntity.getter("TxnAmt");
string TxnStatus = qrPaymentRequestEntity.getter("TxnStatus");
string CurrCode = qrPaymentRequestEntity.getter("CurrCode");
string AuthIDRespCode = qrPaymentRequestEntity.getter("AuthIDRespCode");
string ExpTxnAmt = qrPaymentRequestEntity.getter("ExpTxnAmt");
string RetrievalRefNo = qrPaymentRequestEntity.getter("RetrievalRefNo");
string OrgRespCode = qrPaymentRequestEntity.getter("OrgRespCode");
string OrigTxnAmt = qrPaymentRequestEntity.getter("OrigTxnAmt");
string OrigCurrCode = qrPaymentRequestEntity.getter("OrigCurrCode");
string TxnChannel = qrPaymentRequestEntity.getter("TxnChannel");
string FICode = qrPaymentRequestEntity.getter("FICode");
string PymtGwRefNo = qrPaymentRequestEntity.getter("PymtGwRefNo");
string TxnStatDetCde = qrPaymentRequestEntity.getter("TxnStatDetCde");
string TxnStatMsg = qrPaymentRequestEntity.getter("TxnStatMsg");
string ServiceID = qrPaymentRequestEntity.getter("ServiceID");
string MerchHostID = qrPaymentRequestEntity.getter("MerchHostID");
string MerchSessionID = qrPaymentRequestEntity.getter("MerchSessionID");
string MerchRefNo = qrPaymentRequestEntity.getter("MerchRefNo");
string OrderRefNo = qrPaymentRequestEntity.getter("OrderRefNo");
string QueryStatus = qrPaymentRequestEntity.getter("QueryStatus");
string FPXRefNo = qrPaymentRequestEntity.getter("FPXRefNo");
string UppPymtMode = qrPaymentRequestEntity.getter("UppPymtMode");
string OrigRespCode = qrPaymentRequestEntity.getter("OrigRespCode");
string ExporigTxnAmt = qrPaymentRequestEntity.getter("ExporigTxnAmt");
Step 4 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 5 : Assign Values to the Payment Request Entity
The merchant should assign values to the PayMaster Request Entity. The merchant's code must include all the fields as stated in the sample code, as they are mandatory.
- Use the setter function to assign values, it accepts two parameters:
setter(parameter name, parameter value)
.
Step 6 : Call the Web Service Payment Request
After assigning all mandatory values, call the WebServicePaymentRequestMessageBuilder
with the builderUPPPaymentQueryRequest
function.
- This will generate and submit the Payment Query Request message to the PayMaster Gateway.
- The query response received from the PayMaster Gateway will be processed and assigned back to the PayMaster Request Entity.
Step 7 : Retrieve Values from PayMaster Request Entity
Use the same PayMaster Request Entity to retrieve the query response information.
- Use the getter function to retrieve values; it accepts one parameter:
getter(parameter name)
.
Refer to Query Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant must include the PayMaster Merchant Plug-In (MPI) PHP library, PayMaster.phar, in the merchant application.
Step 2 : Merchant Code
For QR payment query, the merchant should import the following into their code:
PropertiesReader
- to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster QR payment query.WebServicePaymentRequestMessageBuilder
– to generate the PayMaster QR payment query request message.
Step 3 : Source Code
<?php
use com\PayMaster\Entities\PayMasterEntity;
use com\PayMaster\PropertiesReader\PropertiesReader;
use com\PayMaster\MessageRequestBuilder\WebServicePaymentRequestMessageBuilder;
use com\PayMaster\Import\ImportFile;
// Locate the absolute path of PayMaster.phar
$basePath = 'phar://<PayMaster.phar path>/';
include_once $basePath.'com/PayMaster/Import/ImportFile.php';
$import = new ImportFile();
$import->includeFile($basePath);
// Declare variable for Payment Master Properties
$propertiesReader = new PropertiesReader();
$propertiesReader->PropertiesReader("./PayMasterProperties/", "UPPPayment.ini");
// Declare variable for Payment Master Entity
$paymentRequestEntity = new PayMasterEntity();
// Set parameters in Payment Master Entity
$paymentRequestEntity->setter("PaymentID", "U02");
$paymentRequestEntity->setter("MerchantID", "000010000099939");
$paymentRequestEntity->setter("ServiceID", "FNX");
$paymentRequestEntity->setter("MerchRefNo", "MYB2023030315435025LL");
$paymentRequestEntity->setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");
// Call Payment Master Payment Response Message Builder to set value
$webServicePaymentRequestMessageBuilder = new WebServicePaymentRequestMessageBuilder();
$webServicePaymentRequestMessageBuilder->buildUPPQueryRequestMessage($paymentRequestEntity, $propertiesReader);
// Retrieve values from Payment Master Entity
$MerchantID = $paymentRequestEntity->getter("MerchantID");
$CardNo = $paymentRequestEntity->getter("CardNo");
$TxnDtTm = $paymentRequestEntity->getter("TxnDtTm");
$TxnAmt = $paymentRequestEntity->getter("TxnAmt");
$TxnStatus = $paymentRequestEntity->getter("TxnStatus");
$CurrCode = $paymentRequestEntity->getter("CurrCode");
$AuthIDRespCode = $paymentRequestEntity->getter("AuthIDRespCode");
$ExpTxnAmt = $paymentRequestEntity->getter("ExpTxnAmt");
$RetrievalRefNo = $paymentRequestEntity->getter("RetrievalRefNo");
$OrgRespCode = $paymentRequestEntity->getter("OrgRespCode");
$OrigTxnAmt = $paymentRequestEntity->getter("OrigTxnAmt");
$OrigCurrCode = $paymentRequestEntity->getter("OrigCurrCode");
$TxnChannel = $paymentRequestEntity->getter("TxnChannel");
$FICode = $paymentRequestEntity->getter("FICode");
$PymtGwRefNo = $paymentRequestEntity->getter("PymtGwRefNo");
$TxnStatDetCde = $paymentRequestEntity->getter("TxnStatDetCde");
$TxnStatMsg = $paymentRequestEntity->getter("TxnStatMsg");
$ServiceID = $paymentRequestEntity->getter("ServiceID");
$MerchHostID = $paymentRequestEntity->getter("MerchHostID");
$MerchSessionID = $paymentRequestEntity->getter("MerchSessionID");
$MerchRefNo = $paymentRequestEntity->getter("MerchRefNo");
$OrderRefNo = $paymentRequestEntity->getter("OrderRefNo");
$QueryStatus = $paymentRequestEntity->getter("QueryStatus");
$FPXRefNo = $paymentRequestEntity->getter("FPXRefNo");
$UppPymtMode = $paymentRequestEntity->getter("UppPymtMode");
$OrigRespCode = $paymentRequestEntity->getter("OrigRespCode");
$ExporigTxnAmt = $paymentRequestEntity->getter("ExporigTxnAmt");
?>
Step 4: Locate Absolute Path of PayMaster.phar
The merchant must locate the absolute path of PayMaster.phar and set it as the $basePath
in the merchant source code (line 7 in the example above).
Example:$basePath=’phar://<absolute path of PayMaster.phar>/'
Step 5 : Assign Values into PayMaster Request Entity
The merchant should assign values to the PayMaster Request Entity. The merchant's code must include all the fields as stated in the sample code, as they are mandatory.
- Use the setter function to assign values, it accepts two parameters:
setter(parameter name, parameter value)
.
Step 6 : Call the Web Service Payment Request
After assigning all mandatory values, call the WebServicePaymentRequestMessageBuilder
with the buildUPPQueryRequestMessage
function.
- This will generate and submit the Payment Query Request message to the PayMaster Gateway.
- The query response from the PayMaster Gateway will be processed and assigned back to the PayMaster Request Entity.
Step 7 : Retrieve Values from PayMaster Request Entity
Use the same PayMaster Request Entity to retrieve the query response information.
- Use the getter function to retrieve values; it accepts one parameter:
getter(parameter name)
.
Refer to Query Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Packages
The merchant must set up and include the PayMaster Merchant Plug-In (MPI) Python packages in the merchant application.
Step 2 : Import
For QR payment query, the merchant shall include the following in their code:
PropertiesReader
– to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster QR payment query.WebServicePaymentRequestMessageBuilder
– to generate the PayMaster QR payment query request message.
Step 3 : Source Code
from com.PayMaster.Entities.PayMasterEntity import PayMasterEntity
from com.PayMaster.PropertiesReader.PropertiesReader import PropertiesReader
from com.PayMaster.MessageRequestBuilder.WebServicePaymentRequestMessageBuilder import WebServicePaymentRequestMessageBuilder
# Declare variable for Payment Master Properties
propertiesReader = PropertiesReader("PayMasterProperties/", "UPPPayment.properties")
# Declare variable for Payment Master Entity
qrPaymentRequestEntity = PayMasterEntity()
# Set parameters in Payment Master Entity
qrPaymentRequestEntity.setter("PaymentID", "U02")
qrPaymentRequestEntity.setter("MerchantID", "000010000099939")
qrPaymentRequestEntity.setter("ServiceID", "FNX")
qrPaymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL")
qrPaymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp")
# Call Payment Master Web Service Payment Request Message Builder for QR query request
qrMessageBuilder = WebServicePaymentRequestMessageBuilder()
qrMessageBuilder.buildUPPQueryRequestMessage(qrPaymentRequestEntity, propertiesReader)
# Retrieve values from Payment Master Entity
MerchantID = qrPaymentRequestEntity.getter("MerchantID")
CardNo = qrPaymentRequestEntity.getter("CardNo")
TxnDtTm = qrPaymentRequestEntity.getter("TxnDtTm")
TxnAmt = qrPaymentRequestEntity.getter("TxnAmt")
TxnStatus = qrPaymentRequestEntity.getter("TxnStatus")
CurrCode = qrPaymentRequestEntity.getter("CurrCode")
AuthIDRespCode = qrPaymentRequestEntity.getter("AuthIDRespCode")
ExpTxnAmt = qrPaymentRequestEntity.getter("ExpTxnAmt")
RetrievalRefNo = qrPaymentRequestEntity.getter("RetrievalRefNo")
OrgRespCode = qrPaymentRequestEntity.getter("OrgRespCode")
OrigTxnAmt = qrPaymentRequestEntity.getter("OrigTxnAmt")
OrigCurrCode = qrPaymentRequestEntity.getter("OrigCurrCode")
TxnChannel = qrPaymentRequestEntity.getter("TxnChannel")
FICode = qrPaymentRequestEntity.getter("FICode")
PymtGwRefNo = qrPaymentRequestEntity.getter("PymtGwRefNo")
TxnStatDetCde = qrPaymentRequestEntity.getter("TxnStatDetCde")
TxnStatMsg = qrPaymentRequestEntity.getter("TxnStatMsg")
ServiceID = qrPaymentRequestEntity.getter("ServiceID")
MerchHostID = qrPaymentRequestEntity.getter("MerchHostID")
MerchSessionID = qrPaymentRequestEntity.getter("MerchSessionID")
MerchRefNo = qrPaymentRequestEntity.getter("MerchRefNo")
OrderRefNo = qrPaymentRequestEntity.getter("OrderRefNo")
QueryStatus = qrPaymentRequestEntity.getter("QueryStatus")
FPXRefNo = qrPaymentRequestEntity.getter("FPXRefNo")
UppPymtMode = qrPaymentRequestEntity.getter("UppPymtMode")
OrigRespCode = qrPaymentRequestEntity.getter("OrigRespCode")
ExporigTxnAmt = qrPaymentRequestEntity.getter("ExporigTxnAmt")
Step 4 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 5 : Assign Values into PayMaster Request Entity
The merchant should assign values to the PayMaster Request Entity. The merchant's code must include all the fields as stated in the sample code, as they are mandatory.
- Use the setter function to assign values, it accepts two parameters:
setter(parameter name, parameter value)
.
Step 6 : Call the Web Service Payment Request
After assigning all mandatory values, call the WebServicePaymentRequestMessageBuilder
with the buildUPPQueryRequestMessage
function.
- This will generate and submit the Payment Query Request message to the PayMaster Gateway.
- The query response from the PayMaster Gateway will be processed and assigned back to the PayMaster Request Entity.
Step 7 : Retrieve Values from PayMaster Request Entity
Use the same PayMaster Request Entity to retrieve the query response information.
- Use the getter function to retrieve values; it accepts one parameter:
getter(parameter name)
.
Refer to Query Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant shall set up and include the PayMaster Merchant Plug-In (MPI) Node.js library into the merchant application.
Step 2 : Source Code
var paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.get('/QRQuery', (req, res) => {
// Set parameters for QR Payment Query
paymaster.setter('PaymentID', 'U02');
paymaster.setter('MerchantID', '000010000099939');
paymaster.setter('ServiceID', 'FNX');
paymaster.setter('MerchRefNo', 'MYB2023030315435025LL');
paymaster.setter('QueryRespURL', 'https://XXX.XXXXX.XXX/query.jsp');
// Submit the payment request
paymaster.MERCH_QRPaymentQueryRequest(paymaster.PaymasterRequestEntity, paymaster.propDetails, function(err, response, result) {
if (err) {
return res.status(500).send(err);
}
if (response) {
// Retrieve values from the response
var MerchantID = paymaster.getter('MerchantID');
var CardNo = paymaster.getter('CardNo');
var TxnDtTm = paymaster.getter('TxnDtTm');
var TxnAmt = paymaster.getter('TxnAmt');
var TxnStatus = paymaster.getter('TxnStatus');
var CurrCode = paymaster.getter('CurrCode');
var AuthIDRespCode = paymaster.getter('AuthIDRespCode');
var ExpTxnAmt = paymaster.getter('ExpTxnAmt');
var RetrievalRefNo = paymaster.getter('RetrievalRefNo');
var OrgRespCode = paymaster.getter('OrgRespCode');
var OrigTxnAmt = paymaster.getter('OrigTxnAmt');
var OrigCurrCode = paymaster.getter('OrigCurrCode');
var TxnChannel = paymaster.getter('TxnChannel');
var FICode = paymaster.getter('FICode');
var PymtGwRefNo = paymaster.getter('PymtGwRefNo');
var TxnStatDetCde = paymaster.getter('TxnStatDetCde');
var TxnStatMsg = paymaster.getter('TxnStatMsg');
var ServiceID = paymaster.getter('ServiceID');
var MerchHostID = paymaster.getter('MerchHostID');
var MerchSessionID = paymaster.getter('MerchSessionID');
var MerchRefNo = paymaster.getter('MerchRefNo');
var OrderRefNo = paymaster.getter('OrderRefNo');
var QueryStatus = paymaster.getter('QueryStatus');
var FPXRefNo = paymaster.getter('FPXRefNo');
var UppPymtMode = paymaster.getter('UppPymtMode');
var OrigRespCode = paymaster.getter('OrigRespCode');
var ExporigTxnAmt = paymaster.getter('ExporigTxnAmt');
// Send response to the client
res.json({
MerchantID, CardNo, TxnDtTm, TxnAmt, TxnStatus, CurrCode,
AuthIDRespCode, ExpTxnAmt, RetrievalRefNo, OrgRespCode,
OrigTxnAmt, OrigCurrCode, TxnChannel, FICode, PymtGwRefNo,
TxnStatDetCde, TxnStatMsg, ServiceID, MerchHostID,
MerchSessionID, MerchRefNo, OrderRefNo, QueryStatus,
FPXRefNo, UppPymtMode, OrigRespCode, ExporigTxnAmt
});
}
});
});
}
Step 3 : Indicate PayMaster Properties File Location
Merchant to initiate where the PayMaster Properties File is located using the PropertiesReader
.
Step 4 : Assign values to all fields
Merchant code must include and assign value to all the fields as stated in sample code as it’s mandatory.
- Use the setter function to assign values, it accepts two parameters:
setter(parameter name, parameter value)
.
Step 5 : Submit payment request to PayMaster
Use the MERCH_QRPaymentQueryRequest()
function to generate and submit the payment request message to PayMaster.
Step 6 : Handle Response Parameters Returned by PayMaster
Response parameters returned by PayMaster will be messaged by PayMaster MPI NodeJS.
Step 7 : Retrieve Values of Payment Query Response Parameters
Retrieve values from the payment query response using the getter function: getter(parameter name)
.
Refer to Query Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).