Completion Response
The following guideline is to explain how to apply the corresponding source codes to retrieve the payment completion response parameters from the response message returned by PayMaster.
- Java
- .Net
- PHP
- Python
- Node.js
Step 1 : Library
Merchant shall include PayMaster Merchant Plug-In (MPI) Java library – PayMaster.jar into merchant application.
Step 2 : Import
For UPP payment, merchant shall import below into merchant 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.PropertiseReader;
import com.PayMaster.MessageResponseBuilder.PaymentResponseMessageBuilder;
.....
//Declare variable for Payment Master Properties - 1st Parameter = File Path , 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/","CCPayment.properties");
//Declare variable for Payment Master Entity
PayMasterEntity paymentResponseEntity = new PayMasterEntity();
//Get response message from PayMaster and set into Payment Master Entity
paymentResponseEntity.setter("ResponseMessage", responseMessage);
//Call Payment Master Payment Response Message Builder to set 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");
//to do ...
}
.....
Step 4 : Indicate PayMaster Properties File location using PropertiesReader
Merchant must indicate where the PayMaster Properties File located using PropertiesReader
.
Step 5 : Indicate PayMaster Properties File location using setter
Merchant must indicate where the PayMaster Properties File located using setter(“ResponseMessage”,”<response message returned by PayMaster Gateway>”)
.
Step 6 : Assign value into PayMaster Response Entity
Merchant call to UPP Payment Response Message Builder to message the response message and assign the values into PayMaster Response Entity.
Refer to Pre-Auth Completion Parameters for fields supported by PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve value from PayMaster Response Entity
Merchant can retrieve the values from PayMaster Response Entity.
- The getter function is used to retrieve value and the function only accepts one parameter –
getter(parameter name)
.
Make sure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Step 1 : Library
Merchant shall include PayMaster Merchant Plug-In (MPI) .Net library – PayMaster.dll into merchant application.
Step 2 : Namespace
For UPP Payment, merchant shall use the namespace below 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/","CCPayment.properties");
//Declare variable for Payment Master Entity
PayMasterEntity ccPaymentResponseEntity = new 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
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");
//to do ...
}
.....
Step 4 : Indicate Properties File location
The merchant must indicate where the PayMaster Properties File is located 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>”)
.
Step 6 : Assign the values into PayMaster Response Entity
Merchant call to UPP Payment Response Message Builder to message the response message and assign the values into PayMaster Response Entity.
Refer to Pre-Auth Completion Parameters for fields supported by PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve values from PayMaster Response Entity
Merchant can retrieve the values from PayMaster Response Entity.
- The getter function is used to retrieve value and the function only accepts one parameter –
getter(parameter name)
.
Make sure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Step 1 : Library
Merchant shall include PayMaster Merchant Plug-In (MPI) PHP library – PayMaster.phar into merchant application.
Step 2 : Merchant Code
For UPP payment, merchant shall import below into merchant code:
PropertiesReader
- to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster UPP payment.PaymentResponseMessageBuilder
– to generate 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;
//Merchant to 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 Payment Master Properties - 1st Parameter = File Path , 2nd Parameter = File name
$propertiesReader = new PropertiesReader();
$propertiesReader->PropertiesReader(<absolute path> . "/paymaster","CCPayment.ini");
//Declare variable for Payment Master Entity
$paymentResponseEntity = new PayMasterEntity();
//Get all the parameter values from the user side and set into Payment Master Entity
$paymentResponseEntity->setter("ResponseMessage", $responseMessage);
//Call Payment Master Payment Response Message Builder to set value
$paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
$paymentResponseMessageBuilder->buildCardPaymentResponseMessage($paymentResponseEntity, $propertiesReader);
if(strncmp($paymentResponseEntity->getter("TxnStatDetCde"),"0000") == 0 ){
$MerchantID = $paymentResponseEntity->getter("MerchantID");
$MerchRefNo = $paymentResponseEntity->getter("MerchRefNo");
$TxnStatus = $paymentResponseEntity->getter("TxnStatus");
$SHAlgorithmType = $paymentResponseEntity->getter("SHAlgorithmType");
$SHValue = $paymentResponseEntity->getter("SHValue");
//to do ...
}
.....
Step 4 : Locate absolute path
Merchant to locate the absolute path of PayMaster.phar as the basePath in Merchant source code (line 7 in the example above).
Example:$basePath=’phar://<absolute path of PayMaster.phar>/’
Step 5 : Indicate PayMaster Properties File
The merchant must indicate where the PayMaster Properties File is located using the PropertiesReader
.
Step 6 : 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 7 : 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 fields supported by PayMaster Merchant Plug-In (MPI).
Step 8 : Retrieve value from PayMaster Response Entity
Merchant can retrieve the values from PayMaster Response Entity.
- The getter function is used to retrieve value and the function only accepts one parameter
getter(parameter name)
.
Make sure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Step 1 : Packages
Merchant shall setup and include PayMaster Merchant Plug-In (MPI) Python packages into merchant application.
Step 2 : Import
For UPP payment, merchant shall include below into merchant code:
PropertiesReader
– to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster UPP payment.PaymentResponseMessageBuilder
– to generate 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 indicate where the PayMaster Properties File is located 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 fields supported by PayMaster Merchant Plug-In (MPI).
Step 7 : Retrieve values from PayMaster Response Entity
Merchant can retrieve the values from PayMaster Response Entity.
- The getter function is used to retrieve value and the function only accepts one parameter –
getter(parameter name)
.
Make sure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Step 1 : Library
Merchant shall setup and include PayMaster Merchant Plug-In (MPI) NodeJS library into merchant application.
Step 2 : Functions
MERCH_CardPaymentResponse()
- Function that shall run in merchant response page for UPP payment.
- This function will message the response parameters returned from PayMaster Gateway, and return the result required by merchant.
Step 3 : Source Code
var 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, function(err, response, result){
if(err){
throw err;
}
if(response){
if(paymaster.getter('TxnStatDetCde') === "0000"){
var MerchantID = paymaster.getter('MerchantID');
var MerchRefNo = paymaster.getter('MerchRefNo');
var TxnStatus = paymaster.getter('TxnStatus');
var SHAlgorithmType = paymaster.getter('SHAlgorithmType');
var SHValue = paymaster.getter('SHValue');
//to do ...
}
}
});
.....
});
}
Step 4 : Indicate PayMaster Properties File
The merchant must indicate where the PayMaster Properties File is located using the PropertiesReader
.
Step 5 : Retrieve values from PayMaster Response Entity
Merchant can retrieve the values from PayMaster Response Entity.
- The getter function is used to retrieve value and the function only accepts one parameter –
getter(parameter name)
.
Refer to Pre-Auth Completion Parameters for fields supported by PayMaster Merchant Plug-In (MPI).
Make sure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.