Payment Response
This guideline explains how to apply the corresponding source code on a merchant's website or application to retrieve payment response parameters from the response message returned by PayMaster.
- 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, the merchant should import the following into their 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/", "QRPayment.properties");
// Declare variable for Payment Master Entity
PayMasterEntity qrPaymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into Payment Master Entity
qrPaymentResponseEntity.setter("ResponseMessage", responseMessage);
// Call Payment Master Payment Response Message Builder to set value
PaymentResponseMessageBuilder paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
paymentResponseMessageBuilder.buildQRPaymentResponseMessage(qrPaymentResponseEntity, propertiesReader);
String MerchantID = qrPaymentResponseEntity.getter("MerchantID");
String MerchRefNo = qrPaymentResponseEntity.getter("MerchRefNo");
String TxnStatus = qrPaymentResponseEntity.getter("TxnStatus");
String SHAlgorithmType = qrPaymentResponseEntity.getter("SHAlgorithmType");
String SHValue = qrPaymentResponseEntity.getter("SHValue");
Step 4 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using PropertiesReader
.
Step 5 : Indicate PayMaster Properties File Location Using Setter
The merchant must indicate the location of the PayMaster Properties File using the setter method: setter(“ResponseMessage”,”<response message returned by PayMaster Gateway>”)
.
Step 6 : Assign Values to the PayMaster Response Entity
The merchant should call the QR Payment Response Message Builder to process the response message and assign the values to the PayMaster Response Entity.
Refer to QR Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve the values from the PayMaster Response Entity. Use the getter function to retrieve a value; this function accepts only one parameter: getter(parameter name)
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
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, the merchant shall include the following namespaces in the merchant code:
using com.PayMaster.Entities
using com.PayMaster.Properties
using com.PayMaster.MessageResponseBuilder
Step 3 : Source Code
using com.PayMaster.Entities;
using com.PayMaster.Properties;
using com.PayMaster.MessageResponseBuilder;
// 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 qrPaymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into Payment Master Entity
qrPaymentResponseEntity.setter("ResponseMessage", responseMessage);
// Call Payment Master Payment Response Message Builder to set value
PaymentResponseMessageBuilder qrPaymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
qrPaymentResponseMessageBuilder.buildQRPaymentResponseMessage(qrPaymentResponseEntity, propertiesReader);
string MerchantID = qrPaymentResponseEntity.getter("MerchantID");
string MerchRefNo = qrPaymentResponseEntity.getter("MerchRefNo");
string TxnStatus = qrPaymentResponseEntity.getter("TxnStatus");
string SHAlgorithmType = qrPaymentResponseEntity.getter("SHAlgorithmType");
string SHValue = qrPaymentResponseEntity.getter("SHValue");
Step 4 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 5 : Assign Response Message into Payment Response Entity
The merchant must assign the response message received from PayMaster into the PayMaster Response Entity using the setter method: setter(“ResponseMessage”,”<response message returned by PayMaster Gateway>”)
.
Step 6 : Assign Values into PayMaster Response Entity
The merchant should call the QR Payment Response Message Builder to process the response message and assign the values to the PayMaster Response Entity.
Refer to QR Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve the values from the PayMaster Response Entity. Use the getter function to retrieve a value; this function accepts only one parameter: getter(parameter name)
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
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, 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.PaymentResponseMessageBuilder
– to generate the PayMaster QR payment response message.
Step 3 : Source Code
<?php
use com\PayMaster\Entities\PayMasterEntity;
use com\PayMaster\PropertiesReader\PropertiesReader;
use com\PayMaster\MessageResponseBuilder\PaymentResponseMessageBuilder;
use com\PayMaster\Import\ImportFile;
// Merchant should 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 - 1st Parameter = File Path, 2nd Parameter = File name
$propertiesReader = new PropertiesReader();
$propertiesReader->PropertiesReader("./PayMasterProperties/", "QRPayment.ini");
// Declare variable for Payment Master Entity
$paymentResponseEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set them into Payment Master Entity
$paymentResponseEntity->setter("ResponseMessage", $responseMessage);
// Call Payment Master Payment Response Message Builder to set value
$paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
$paymentResponseMessageBuilder->buildQRPaymentResponseMessage($paymentResponseEntity, $propertiesReader);
$MerchantID = $paymentResponseEntity->getter("MerchantID");
$MerchRefNo = $paymentResponseEntity->getter("MerchRefNo");
$TxnStatus = $paymentResponseEntity->getter("TxnStatus");
$SHAlgorithmType = $paymentResponseEntity->getter("SHAlgorithmType");
$SHValue = $paymentResponseEntity->getter("SHValue");
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 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 6 : Assign Response Message into Payment Response Entity
The merchant should assign the response message received from PayMaster into the PayMaster Response Entity using the setter(“ResponseMessage”,<response message returned by PayMaster Gateway>”)
function.
Step 7 : Assign Values into PayMaster Response Entity
The merchant should call the QR Payment Response Message Builder to process the response message and assign the values to the PayMaster Response Entity.
Refer to QR Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 8 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve the values from the PayMaster Response Entity. Use the getter function to retrieve a value; this function accepts only one parameter: getter(parameter name)
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
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, 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.PaymentResponseMessageBuilder
– to generate the PayMaster QR payment response message.
Step 3 : Source Code
from com.PayMaster.Entities.PayMasterEntity import PayMasterEntity
from com.PayMaster.PropertiesReader.PropertiesReader import PropertiesReader
from com.PayMaster.MessageResponseBuilder.PaymentResponseMessageBuilder import PaymentResponseMessageBuilder
# Declare variable for Payment Master Properties - 1st Parameter = File Path, 2nd Parameter = File name
propertiesReader = PropertiesReader("PayMasterProperties/", "QRPayment.properties")
# Declare variable for Payment Master Entity
qrPaymentResponseEntity = PayMasterEntity()
# Get response message from PayMaster and set it into Payment Master Entity
qrPaymentResponseEntity.setter("ResponseMessage", responseMessage)
# Call Payment Master Payment Response Message Builder to set value
paymentResponseMessageBuilder = PaymentResponseMessageBuilder()
paymentResponseMessageBuilder.buildQRPaymentResponseMessage(qrPaymentResponseEntity, propertiesReader)
MerchantID = qrPaymentResponseEntity.getter("MerchantID")
MerchRefNo = qrPaymentResponseEntity.getter("MerchRefNo")
TxnStatus = qrPaymentResponseEntity.getter("TxnStatus")
SHAlgorithmType = qrPaymentResponseEntity.getter("SHAlgorithmType")
SHValue = qrPaymentResponseEntity.getter("SHValue")
Step 4 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 5 : Assign Response Message into Payment Response Entity
The merchant should assign the response message received from PayMaster into the PayMaster Response Entity using the setter(“ResponseMessage”,<response message returned by PayMaster Gateway>”)
function.
Step 6 : Assign Values into PayMaster Response Entity
The merchant should call the QR Payment Response Message Builder to process the response message and assign the values to the PayMaster Response Entity.
Refer to QR Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve the values from the PayMaster Response Entity. Use the getter function to retrieve a value; this function accepts only one parameter: getter(parameter name)
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
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 : Functions
MERCH_QRPaymentResponse()
- This function should run on the merchant’s response page for QR payments.
- It processes the response parameters returned from PayMaster Gateway and returns the result required by the merchant.
Step 3 : Source Code
var paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.get('/QRPayment', (req, res) => {
paymaster.PropertiesReader('./properties/', 'QRPayment.properties');
payment.MERCH_QRPaymentResponse(req, paymaster.propDetails, function (err, response, result) {
if (err) {
throw err;
}
if (response) {
var MerchantID = paymaster.getter('MerchantID');
var MerchRefNo = paymaster.getter('MerchRefNo');
var TxnStatus = paymaster.getter('TxnStatus');
var QRPayload = paymaster.getter('QRPayload');
var SHAlgorithmType = paymaster.getter('SHAlgorithmType');
var SHValue = paymaster.getter('SHValue');
// Handle the extracted values as needed
}
});
// Additional code as needed
});
}
Step 4 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 5 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve values from the PayMaster Response Entity. Use the getter function to retrieve a value; this function accepts only one parameter: getter(parameter name)
.
Refer to QR Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.