Payment Request
The following guideline explains how to apply the corresponding source codes to form the mandatory payment request parameters in the redirect link and send them to PayMaster for payment request processing.
- Java
- .Net
- PHP
- Python
- Node.js
Step 1 : Library
The merchant shall include the PayMaster Merchant Plug-In (MPI) Java library, PayMaster.jar, into 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.MessageRequestBuilder.PaymentRequestMessageBuilder
Step 3 : Source Code
import com.PayMaster.Entities.PayMasterEntity;
import com.PayMaster.PropertiesReader.PropertiesReader;
import com.PayMaster.MessageRequestBuilder.PaymentRequestMessageBuilder;
// 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 paymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set into Payment Master Entity
paymentRequestEntity.set("PaymentID", "U01");
paymentRequestEntity.set("MerchRefNo", "merchant-refNo-0001");
paymentRequestEntity.set("CurrCode", "458");
paymentRequestEntity.set("TxnAmt", "1.00");
paymentRequestEntity.set("ExpTxnAmt", "2");
paymentRequestEntity.set("CountryCode", "MY");
paymentRequestEntity.set("MerchUserID", "guest-finexus");
paymentRequestEntity.set("TokenFlag", "Y");
paymentRequestEntity.set("PreAuthFlag", "Y");
// Call Payment Master Payment Request Message Builder to generate the message
PaymentRequestMessageBuilder messageBuilder = new PaymentRequestMessageBuilder();
String paymentMessage = messageBuilder.buildPaymentRequestMessage(paymentRequestEntity, propertiesReader);
// Redirect the message generated to Payment Master Gateway for settlement
res.sendRedirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + paymentMessage);
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 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.
- The setter function is used to assign values, and it accepts two parameters:
setter(parameter name, parameter value)
.
Refer to Pre-Auth Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
Once all mandatory values are assigned, the merchant calls the Payment Request Message Builder to generate the UPP Payment — paymentMessage
.
Step 7 : Send the Payment Message to the PayMaster Gateway
The paymentMessage
will be used to send to the PayMaster Gateway for the UPP Payment.
Refer to Pre-Auth Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant shall 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.MessageRequestBuilder
Step 3 : Source Code
using com.PayMaster.Entities;
using com.PayMaster.Properties;
using com.PayMaster.MessageRequestBuilder;
// 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 uppPaymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set into Payment Master Entity
uppPaymentRequestEntity.Setter("PaymentID", "U01");
uppPaymentRequestEntity.Setter("EcommMerchInd", "2");
uppPaymentRequestEntity.Setter("MerchRefNo", "merchant-refNo-0001");
uppPaymentRequestEntity.Setter("CountryCode", "MY");
uppPaymentRequestEntity.Setter("CurrCode", "458");
uppPaymentRequestEntity.Setter("TxnAmt", "1.00");
uppPaymentRequestEntity.Setter("ExpTxnAmt", "2");
uppPaymentRequestEntity.Setter("TokenFlag", "Y");
uppPaymentRequestEntity.Setter("MerchUserID", "User ID");
uppPaymentRequestEntity.Setter("PreAuthFlag", "Y");
// Call Payment Master Payment Request Message Builder to generate the message
PaymentRequestMessageBuilder uppMessageBuilder = new PaymentRequestMessageBuilder();
string uppPaymentMessage = uppMessageBuilder.BuildPaymentRequestMessage(uppPaymentRequestEntity, propertiesReader);
// Redirect the message generated to Payment Master Gateway for settlement
Response.Redirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + uppPaymentMessage);
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 must 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.
- The setter function is used to assign values, and it accepts two parameters:
setter(parameter name, parameter value)
.
Refer to Pre-Auth Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
Once all mandatory values are assigned, the merchant calls the Payment Request Message Builder to generate the UPP Payment — uppPaymentMessage
.
Step 7 : Send the Payment Message to the PayMaster Gateway
The uppPaymentMessage
will be sent to the PayMaster Gateway for the UPP Payment.
Refer to Pre-Auth Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant shall include the PayMaster Merchant Plug-In (MPI) PHP library, PayMaster.phar, in the merchant application.
Step 2 : Import
For UPP payments, the merchant should import the following into their code:
PropertiesReader
- to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster UPP payment.PaymentRequestMessageBuilder
– to generate the PayMaster UPP payment request message.
Step 3 : Source Code
<?php
use com\PayMaster\Entities\PayMasterEntity;
use com\PayMaster\PropertiesReader\PropertiesReader;
use com\PayMaster\MessageRequestBuilder\PaymentRequestMessageBuilder;
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();
// Path to the root project folder
$propertiesReader->PropertiesReader(<absolute path>, "UPPPayment.ini");
// Declare variable for Payment Master Entity
$paymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set into Payment Master Entity
$paymentRequestEntity->setter("PaymentID", "U01");
$paymentRequestEntity->setter("MerchRefNo", "merchant-refNo-0001");
$paymentRequestEntity->setter("CurrCode", "458");
$paymentRequestEntity->setter("TxnAmt", "1.00");
$paymentRequestEntity->setter("ExpTxnAmt", "2");
$paymentRequestEntity->setter("EcommMerchInd", "1");
$paymentRequestEntity->setter("CountryCode", "MY");
$paymentRequestEntity->setter("TokenFlag", "Y");
$paymentRequestEntity->setter("PreAuthFlag", "Y");
$paymentRequestEntity->setter("MerchUserID", "User ID");
// Call Payment Master Payment Request Message Builder to generate the message
$paymentRequestMessageBuilder = new PaymentRequestMessageBuilder();
$paymentMessage = $paymentRequestMessageBuilder->buildPaymentRequestMessage($paymentRequestEntity, $propertiesReader);
// Redirect the message generated to Payment Master Gateway for settlement
header("Location: https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" . $paymentMessage);
exit();
?>
Step 4 : Locate the Absolute Path of PayMaster.phar
The merchant must locate the absolute path of PayMaster.phar and set it as the $basePath
in the 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 Values to the Payment Request Entity
The merchant must 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.
- The setter function is used to assign values, and it accepts two parameters:
setter(parameter name, parameter value)
.
Refer to Pre-Auth Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Generate UPP Payment
Once all mandatory values are assigned, the merchant calls the Payment Request Message Builder to generate the UPP Payment — paymentMessage
.
Step 8 : Send the Payment Message to the PayMaster Gateway
The paymentMessage
will be used to send to the PayMaster Gateway for the UPP Payment.
Refer to Pre-Auth Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Packages
The merchant shall 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 include the following in their code:
PropertiesReader
– to read the properties files.PayMasterEntity
– to assign all the acceptable values for PayMaster UPP payment.PaymentRequestMessageBuilder
- to generate the PayMaster UPP payment request message.
Step 3 : Source Code
from com.PayMaster.Entities.PayMasterEntity import PayMasterEntity
from com.PayMaster.PropertiesReader.PropertiesReader import PropertiesReader
from com.PayMaster.MessageRequestBuilder.PaymentRequestMessageBuilder import PaymentRequestMessageBuilder
# Declare variable for Payment Master Properties - 1st Parameter = File Name, 2nd Parameter = File Path
propertiesReader = PropertiesReader("UPPPayment.properties", "PayMasterProperties/")
# Declare variable for Payment Master Entity
uppPaymentRequestEntity = PayMasterEntity()
# Get all the parameter values from the user side and set them into the Payment Master Entity
uppPaymentRequestEntity.setter("PaymentID", "U01")
uppPaymentRequestEntity.setter("EcommMerchInd", "2")
uppPaymentRequestEntity.setter("MerchRefNo", "merchant-refNo-0001")
uppPaymentRequestEntity.setter("CountryCode", "MY")
uppPaymentRequestEntity.setter("CurrCode", "458")
uppPaymentRequestEntity.setter("TxnAmt", "1.00")
uppPaymentRequestEntity.setter("ExpTxnAmt", "2")
uppPaymentRequestEntity.setter("TokenFlag", "Y")
uppPaymentRequestEntity.setter("MerchUserID", "User ID")
uppPaymentRequestEntity.setter("PreAuthFlag", "Y")
# Call Payment Master Payment Request Message Builder to generate the message
uppMessageBuilder = PaymentRequestMessageBuilder()
uppPaymentMessage = uppMessageBuilder.buildPaymentRequestMessage(uppPaymentRequestEntity, propertiesReader)
# Redirect the message generated to the Payment Master Gateway for settlement
redirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + uppPaymentMessage)
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 must 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.
- The setter function is used to assign values, and it accepts two parameters:
setter(parameter name, parameter value)
.
Refer to Pre-Auth Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
Once all mandatory values are assigned, the merchant calls the Payment Request Message Builder to generate the UPP Payment — uppPaymentMessage
.
Step 7 : Send the Payment Message to the PayMaster Gateway
The uppPaymentMessage
will be sent to the PayMaster Gateway for the UPP Payment.
Refer to Pre-Auth Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant shall set up and include the PayMaster Merchant Plug-In (MPI) Node.js library in the merchant application.
Step 2 : Source Code
var paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.post('/UPPPayment', (req, res) => {
// Load the PayMaster properties file
paymaster.PropertiesReader('./properties/', 'UPPPayment.properties');
// Set the required parameters in the PayMaster Request Entity
paymaster.setter('PaymentID', 'U01');
paymaster.setter('EcommMerchInd', '2');
paymaster.setter('MerchRefNo', 'merchant-refNo-0001');
paymaster.setter('CountryCode', 'MY');
paymaster.setter('CurrCode', '458');
paymaster.setter('ExpTxnAmt', '2');
paymaster.setter('TxnAmt', '1.00');
paymaster.setter('TokenFlag', 'Y');
paymaster.setter('MerchUserID', 'UserName');
paymaster.setter('PreAuthFlag', 'Y');
// Generate the payment request message and handle the response
paymaster.MERCH_UPPPaymentRequest(paymaster.PaymentRequestEntity, paymaster.propDetails, function(err, response, result) {
if (err) {
throw err;
}
if (response) {
// Redirect the user to the PayMaster Gateway for settlement
res.redirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + result);
}
});
});
}
Step 3 : Indicate PayMaster Properties File Location
The merchant must specify the location of the PayMaster Properties File using the PropertiesReader
.
Step 4 : Assign Values to the Payment Request Entity
The merchant must 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.
- The setter function is used to assign values, and it accepts two parameters:
setter(parameter name, parameter value)
.
Refer to Pre-Auth Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 5 : Generate the Request Message
The MERCH_UPPPaymentRequest()
function is used to generate the payment request message.
Step 6 : Send the Payment Message to PayMaster
The payment message returned by the JavaScript code will be sent to PayMaster for the UPP payment.
Refer to Pre-Auth Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).