Completion Response
The following guidelines explain how to use the source code to retrieve payment completion 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 UPP payments, 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 PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File Name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "CCPayment.properties");
// Declare variable for PayMaster Entity
PayMasterEntity paymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into the PayMaster Entity
paymentResponseEntity.setter("ResponseMessage", responseMessage);
// Call Payment Response Message Builder to set the value
PaymentResponseMessageBuilder paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
paymentResponseMessageBuilder.buildCardPaymentResponseMessage(paymentResponseEntity, propertiesReader);
if (paymentResponseEntity.getter("TxnStatDetCde").equals("0000")) {
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");
// TODO: Add additional processing here
}
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
Merchant must set 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 UPP Payment Response Message Builder to process the response message and assign the values to the PayMaster Response Entity.
Refer to Pre-Auth Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve values from the PayMaster Response Entity. Use the getter function to retrieve values; this function only accepts 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 UPP payments, 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 PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File Name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "CCPayment.properties");
// Declare variable for PayMaster Entity
PayMasterEntity ccPaymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into the PayMaster Entity
ccPaymentResponseEntity.setter("ResponseMessage", responseMessage);
// Call Payment Response Message Builder to set the value
PaymentResponseMessageBuilder cardPaymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
cardPaymentResponseMessageBuilder.buildCardPaymentResponseMessage(ccPaymentResponseEntity, propertiesReader);
if (ccPaymentResponseEntity.getter("TxnStatDetCde").Equals("0000")) {
string merchantID = ccPaymentResponseEntity.getter("MerchantID");
string merchRefNo = ccPaymentResponseEntity.getter("MerchRefNo");
string txnStatus = ccPaymentResponseEntity.getter("TxnStatus");
string shAlgorithmType = ccPaymentResponseEntity.getter("SHAlgorithmType");
string shValue = ccPaymentResponseEntity.getter("SHValue");
// TODO: Add additional processing here
}
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 setter(“ResponseMessage”,”<response message returned by PayMaster Gateway>”)
.
Step 6 : Assign Values into PayMaster Response Entity
The merchant should call the UPP Payment Response Message Builder to process the response message and assign the values into the PayMaster Response Entity.
Refer to Pre-Auth Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve values from the PayMaster Response Entity. The getter function is used to retrieve values and 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 UPP payments, the merchant shall import the following components into the merchant code:
PropertiesReader
- to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster UPP payment.PaymentResponseMessageBuilder
– to generate the PayMaster UPP 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;
// Locate the absolute path of PayMaster.phar
$basePath = 'phar://<absolute path of PayMaster.phar>/paymaster/PayMaster.phar/';
include_once $basePath . 'com/PayMaster/Import/ImportFile.php';
$import = new ImportFile();
$import->includeFile($basePath);
// Declare variable for PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File Name
$propertiesReader = new PropertiesReader();
$propertiesReader->PropertiesReader('<absolute path>/paymaster', 'CCPayment.ini');
// Declare variable for PayMaster Entity
$paymentResponseEntity = new PayMasterEntity();
// Get all parameter values from the user side and set them into the PayMaster Entity
$paymentResponseEntity->setter('ResponseMessage', $responseMessage);
// Call Payment Response Message Builder to set the value
$paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
$paymentResponseMessageBuilder->buildCardPaymentResponseMessage($paymentResponseEntity, $propertiesReader);
if (strncmp($paymentResponseEntity->getter('TxnStatDetCde'), '0000', 4) === 0) {
$merchantID = $paymentResponseEntity->getter('MerchantID');
$merchRefNo = $paymentResponseEntity->getter('MerchRefNo');
$txnStatus = $paymentResponseEntity->getter('TxnStatus');
$shAlgorithmType = $paymentResponseEntity->getter('SHAlgorithmType');
$shValue = $paymentResponseEntity->getter('SHValue');
// TODO: Add additional processing here
}
?>
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 UPP Payment Response Message Builder to process the response message and assign the values into the PayMaster Response Entity.
Refer to Pre-Auth Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 8 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve values from the PayMaster Response Entity. The getter function is used to retrieve values and 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 UPP payments, the merchant shall import the following components into the merchant code:
PropertiesReader
– to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster UPP payment.PaymentResponseMessageBuilder
– to generate the PayMaster UPP payment response message.
Step 3 : Source Code
from com.PayMaster.Entities.PayMasterEntity import PayMasterEntity
from com.PayMaster.PropertiesReader.PropertiseReader import PropertiseReader
from com.PayMaster.MessageResponseBuilder.PaymentResponseMessageBuilder import PaymentResponseMessageBuilder
##Declare variable for Payment Master Properties - 1st Parameter = File Path , 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("CCPayment.properties","PayMasterProperties/")
##Declare variable for Payment Master Entity
ccPaymentResponseEntity = PayMasterEntity()
##Get response message from PayMaster and set into Payment Master Entity
ccPaymentResponseEntity.setter("ResponseMessage", responseMessage)
##Call Payment Master Payment Response Message Builder to set value
cardPaymentResponseMessageBuilder = PaymentResponseMessageBuilder()
cardPaymentResponseMessageBuilder.buildCardPaymentResponseMessage(ccPaymentResponseEntity, propertiesReader)
if(ccPaymentResponseEntity.getter("TxnStatDetCde") == '0000'){
MerchantID = ccPaymentResponseEntity.getter("MerchantID")
MerchRefNo = ccPaymentResponseEntity.getter("MerchRefNo")
TxnStatus = ccPaymentResponseEntity.getter("TxnStatus")
SHAlgorithmType = ccPaymentResponseEntity.getter("SHAlgorithmType")
SHValue = ccPaymentResponseEntity.getter("SHValue")
//to do ....
}
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
Merchant to assign response message received from PayMaster into PayMaster Response Entity using setter(“ResponseMessage”,<response message returned by PayMaster Gateway>”)
function.
Step 6 : Assign Values into PayMaster Response Entity
Merchant call to UPP Payment Response Message Builder to massage the response message and assign the values into PayMaster Response Entity.
Refer to Pre-Auth Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve Values from PayMaster Response Entity
The merchant can retrieve values from the PayMaster Response Entity.
- The getter function is used to retrieve values and accepts 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_CardPaymentResponse()
- This function should be implemented on the merchant's response page for UPP payments.
- It will process the response parameters returned from the PayMaster Gateway and return the result required by the merchant.
Step 3 : Source Code
const paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.get('/CCPayment', (req, res) => {
paymaster.PropertiesReader('./properties/', 'CCPayment.properties');
payment.MERCH_CardPaymentResponse(req, paymaster.propDetails, (err, response, result) => {
if (err) {
throw err;
}
if (response) {
if (paymaster.getter('TxnStatDetCde') === "0000") {
const MerchantID = paymaster.getter('MerchantID');
const MerchRefNo = paymaster.getter('MerchRefNo');
const TxnStatus = paymaster.getter('TxnStatus');
const SHAlgorithmType = paymaster.getter('SHAlgorithmType');
const SHValue = paymaster.getter('SHValue');
// TODO: Add additional processing here
}
}
});
// Other code...
});
}
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. The getter function is used to retrieve values and accepts only one parameter: getter(parameter name)
.
Refer to Pre-Auth Completion 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.