Payment Response
The following guideline explains how to apply the corresponding source code in a merchant's website or application to retrieve the payment response parameters from the response message returned by PayMaster.
- Java
- .Net
- PHP
- Python
- Node.js
Step 1 : Library
Include the PayMaster Merchant Plug-In (MPI) Java library – PayMaster.jar – into your merchant application.
Step 2 : Import
For UPP payments, import the following into your 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.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/", "UPPPayment.properties");
// Declare variable for Payment Master Entity
PayMasterEntity paymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into Payment Master Entity
paymentResponseEntity.setter("ResponseMessage", responseMessage);
// Call Payment Master Payment Response Message Builder to set value
PaymentResponseMessageBuilder paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
paymentResponseMessageBuilder.buildUPPPaymentResponseMessage(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");
// Additional processing...
}
.....
Step 4 : Indicate PayMaster Properties File Location
Indicate the location of the PayMaster Properties File using PropertiesReader
.
Step 5 : Set Response Message
Set the response message from the PayMaster Gateway using the setter method: paymentResponseEntity.setter("ResponseMessage", "<response message returned by PayMaster Gateway>");
.
Step 6 : Build Payment Response Message
Call the UPP Payment Response Message Builder to parse the response message and assign values to the PayMaster Response Entity.
Step 7 : Retrieve Values from PayMaster Response Entity
Retrieve values from the PayMaster Response Entity using the getter method: String value = paymentResponseEntity.getter("parameter name");
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Library
Include the PayMaster Merchant Plug-In (MPI) .Net library – PayMaster.dll – into your merchant application.
Step 2 : Namespace
For UPP payments, use the following namespaces in your 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/", "UPPPayment.properties");
// Declare variable for Payment Master Entity
PayMasterEntity uppPaymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into Payment Master Entity
uppPaymentResponseEntity.setter("ResponseMessage", responseMessage);
// Call Payment Master Payment Response Message Builder to set value
PaymentResponseMessageBuilder uppPaymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
uppPaymentResponseMessageBuilder.buildUPPPaymentResponseMessage(uppPaymentResponseEntity, propertiesReader);
if (uppPaymentResponseEntity.getter("TxnStatDetCde").Equals("0000")) {
String MerchantID = uppPaymentResponseEntity.getter("MerchantID");
String MerchRefNo = uppPaymentResponseEntity.getter("MerchRefNo");
String TxnStatus = uppPaymentResponseEntity.getter("TxnStatus");
String SHAlgorithmType = uppPaymentResponseEntity.getter("SHAlgorithmType");
String SHValue = uppPaymentResponseEntity.getter("SHValue");
// Additional processing...
}
.....
Step 4 : Indicate PayMaster Properties File Location
Indicate the location of the PayMaster Properties File using the PropertiesReader
.
Step 5 : Set Response Message
Set the response message from the PayMaster Gateway using the setter method: uppPaymentResponseEntity.setter("ResponseMessage", "<response message returned by PayMaster Gateway>");
.
Step 6 : Build Payment Response Message
Call the UPP Payment Response Message Builder to parse the response message and assign values to the PayMaster Response Entity.
Step 7 : Retrieve Values from PayMaster Response Entity
Retrieve values from the PayMaster Response Entity using the getter method: String value = uppPaymentResponseEntity.getter("parameter name");
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Library
Include the PayMaster Merchant Plug-In (MPI) PHP library – PayMaster.phar – into your merchant application.
Step 2 : Merchant Code
For UPP payments, import the following into your 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;
// Merchant to locate the absolute path of PayMaster.phar
$basePath = 'phar://<absolute path of 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>', 'UPPPayment.ini');
// Declare variable for Payment Master Entity
$paymentResponseEntity = new PayMasterEntity();
// Get response message from PayMaster and set it into Payment Master Entity
$paymentResponseEntity->setter('ResponseMessage', $responseMessage);
// Call Payment Master Payment Response Message Builder to set value
$paymentResponseMessageBuilder = new PaymentResponseMessageBuilder();
$paymentResponseMessageBuilder->buildUPPPaymentResponseMessage($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');
// Additional processing...
}
?>
Step 4 : Locate the Absolute Path of PayMaster.phar
Locate the absolute path of PayMaster.phar and set it as the basePath in your source code. For example: $basePath = 'phar://<absolute path of PayMaster.phar>/';
Step 5 : Indicate PayMaster Properties File Location
Use PropertiesReader
to indicate the location of the PayMaster Properties File.
Step 6 : Assign Response Message to Payment Response Entity
Assign the response message received from PayMaster to the Payment Response Entity using the setter function: $paymentResponseEntity->setter('ResponseMessage', $responseMessage);
Step 7 : Build Payment Response Message
Call the UPP Payment Response Message Builder to parse the response message and assign values to the PayMaster Response Entity.
Step 8 : Retrieve Values from PayMaster Response Entity
Retrieve values from the PayMaster Response Entity using the getter function: $value = $paymentResponseEntity->getter('parameter name');
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Packages
Set up and include PayMaster Merchant Plug-In (MPI) Python packages into your merchant application.
Step 2 : Import
For UPP payments, include the following in your 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.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/", "UPPPayment.properties")
# Declare variable for Payment Master Entity
uppPaymentResponseEntity = PayMasterEntity()
# Get response message from PayMaster and set it into Payment Master Entity
uppPaymentResponseEntity.setter("ResponseMessage", responseMessage)
# Call Payment Master Payment Response Message Builder to set value
uppPaymentResponseMessageBuilder = PaymentResponseMessageBuilder()
uppPaymentResponseMessageBuilder.buildUPPPaymentResponseMessage(uppPaymentResponseEntity, propertiesReader)
if uppPaymentResponseEntity.getter("TxnStatDetCde") == '0000':
MerchantID = uppPaymentResponseEntity.getter("MerchantID")
MerchRefNo = uppPaymentResponseEntity.getter("MerchRefNo")
TxnStatus = uppPaymentResponseEntity.getter("TxnStatus")
SHAlgorithmType = uppPaymentResponseEntity.getter("SHAlgorithmType")
SHValue = uppPaymentResponseEntity.getter("SHValue")
# Additional processing...
Step 4 : Indicate PayMaster Properties File Location
Use PropertiesReader
to indicate the location of the PayMaster Properties File.
Step 5 : Assign Response Message to Payment Response Entity
Assign the response message received from PayMaster to the Payment Response Entity using the setter function: uppPaymentResponseEntity.setter("ResponseMessage", responseMessage)
Step 6 : Build Payment Response Message
Call the UPP Payment Response Message Builder to parse the response message and assign values to the PayMaster Response Entity.
Step 7 : Retrieve Values from PayMaster Response Entity
Retrieve values from the PayMaster Response Entity using the getter function: value = uppPaymentResponseEntity.getter("parameter name")
.
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 1 : Library
Set up and include the PayMaster Merchant Plug-In (MPI) NodeJS library into your merchant application.
Step 2 : Functions
MERCH_UppPaymentResponse()
- This function should run on the merchant's response page for UPP payment.
- It will parse the response parameters returned from the PayMaster Gateway and return the required result.
Step 3 : Source Code
var paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.get('/UPPPayment', (req, res) => {
paymaster.PropertiesReader('./properties/', 'UPPPayment.properties');
paymaster.MERCH_UPPPaymentResponse(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');
// Additional processing...
}
}
});
// Additional code...
});
}
Step 4 : Indicate PayMaster Properties File Location
Use the PropertiesReader
to indicate where the PayMaster Properties File is located.
Step 5 : Retrieve Values from PayMaster Response Entity
Retrieve values from the PayMaster Response Entity using the getter function: var value = paymaster.getter('parameter name');
Ensure that the value of TxnStatDetCde
is not equal to 5015, as this represents an invalid secure hash value.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).