Payment Request
This guideline provides instructions on how to apply the corresponding source code to a merchant website and application to form the payment request parameters. These parameters are included in the redirect link sent to PayMaster for UPP payment processing.
- Java
- .Net
- PHP
- Python
- Node.js
Step 1 : Library
Include the PayMaster Merchant Plug-In (MPI) Java library PayMaster.jar in your application.
Step 2 : Import
For UPP payments, import the following into your 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 PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "UPPPayment.properties");
// Declare variable for PayMaster Entity
PayMasterEntity paymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set into PayMaster Entity
paymentRequestEntity.setParameter("PaymentID", "U01");
paymentRequestEntity.setParameter("MerchRefNo", "merchant-refNo-0001");
paymentRequestEntity.setParameter("CurrCode", "458");
paymentRequestEntity.setParameter("TxnAmt", "1.00");
paymentRequestEntity.setParameter("ExpTxnAmt", "2");
paymentRequestEntity.setParameter("CountryCode", "MY");
paymentRequestEntity.setParameter("TokenFlag", "N");
paymentRequestEntity.setParameter("MerchUserID", "User ID");
paymentRequestEntity.setParameter("PreAuthFlag", "N");
// Call PaymentRequestMessageBuilder to generate the message
PaymentRequestMessageBuilder messageBuilder = new PaymentRequestMessageBuilder();
String paymentMessage = messageBuilder.buildPaymentRequestMessage(paymentRequestEntity, propertiesReader);
// Redirect the message generated to PayMaster Gateway for settlement
response.sendRedirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + paymentMessage);
Step 4 : Indicate PayMaster Properties File Location
Indicate where the PayMaster Properties File is located using PropertiesReader
.
Step 5 : Assign Values to the Payment Request Entity
Assign values into the PayMaster Request Entity. Include all the fields as they are mandatory. Use the setter function setter(parameter name, parameter value)
to assign values.
Refer to UPP Payment Parameters for a complete list of fields supported by the PayMaster Merchant Plug-In (MPI). This will ensure all necessary parameters are included and correctly formatted in your payment request.
Step 6 : Generate UPP Payment
Once all mandatory values are assigned, call the PaymentRequestMessageBuilder
to generate the UPP Payment message (paymentMessage
).
Step 7 : Send the Payment Message to the PayMaster Gateway
Use the paymentMessage
to redirect to the PayMaster Gateway for the UPP Payment.
Refer to Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
Include the PayMaster Merchant Plug-In (MPI) .Net library PayMaster.dll in your application.
Step 2 : Namespace
For UPP payments, use the following namespaces in your 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 PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "UPPPayment.properties");
// Declare variable for PayMaster Entity
PayMasterEntity uppPaymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set into PayMaster 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", "N");
uppPaymentRequestEntity.setter("MerchUserID", "User ID");
uppPaymentRequestEntity.setter("PreAuthFlag", "N");
// Call PaymentRequestMessageBuilder to generate the message
PaymentRequestMessageBuilder uppMessageBuilder = new PaymentRequestMessageBuilder();
string uppPaymentMessage = uppMessageBuilder.buildPaymentRequestMessage(uppPaymentRequestEntity, propertiesReader);
// Redirect the message generated to PayMaster Gateway for settlement
Response.Redirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + uppPaymentMessage);
....
Step 4 : Indicate PayMaster Properties File Location
Indicate where the PayMaster Properties File is located using PropertiesReader
.
Step 5 : Assign Values to the Payment Request Entity
Assign values to the PayMaster Request Entity. The merchant code must include all the fields as stated in the sample code, as they are mandatory. Use the setter function setter(parameter name, parameter value)
to assign values.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
Once all mandatory values are assigned, call PaymentRequestMessageBuilder
to generate the UPP Payment message (uppPaymentMessage
).
Step 7 : Send the Payment Message to the PayMaster Gateway
Use the uppPaymentMessage
to redirect to the PayMaster Gateway for the UPP Payment.
Refer to Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
Include the PayMaster Merchant Plug-In (MPI) PHP library PayMaster.phar in your application.
Step 2 : Import
For UPP payments, import the following into your 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 PayMaster 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 PayMaster Entity
$paymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set into PayMaster 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", "N");
$paymentRequestEntity->setter("PreAuthFlag", "N");
// Call PaymentRequestMessageBuilder to generate the message
$paymentRequestMessageBuilder = new PaymentRequestMessageBuilder();
$paymentMessage = $paymentRequestMessageBuilder->buildPaymentRequestMessage($paymentRequestEntity, $propertiesReader);
// Redirect the message generated to PayMaster 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
Locate the absolute path of PayMaster.phar as the basePath
in your source code. Example:
$basePath='phar://<absolute path of PayMaster.phar>/'
Step 5 : Indicate PayMaster Properties File Location
Indicate where the PayMaster Properties File is located using PropertiesReader
.
Step 6 : Assign Values to the Payment Request Entity
Assign values into the PayMaster Request Entity. The merchant code must include all the fields as stated in the sample code, as they are mandatory. Use the setter function setter(parameter name, parameter value)
to assign values.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Generate UPP Payment
Once all mandatory values are assigned, call PaymentRequestMessageBuilder
to generate the UPP Payment message (paymentMessage
).
Step 8 : Send the Payment Message to the PayMaster Gateway
Use the paymentMessage
to redirect to the PayMaster Gateway for the UPP Payment.
Refer to Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Packages
Setup and include PayMaster Merchant Plug-In (MPI) Python packages in your application.
Step 2 : Import
For UPP payments, include the following in your 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 PayMaster Properties - 1st Parameter = File Path, 2nd Parameter = File name
propertiesReader = PropertiesReader("PayMasterProperties/", "UPPPayment.properties")
# Declare variable for PayMaster Entity
uppPaymentRequestEntity = PayMasterEntity()
# Get all the parameter values from the user side and set into PayMaster 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", "N")
uppPaymentRequestEntity.setter("MerchUserID", "User ID")
uppPaymentRequestEntity.setter("PreAuthFlag", "N")
# Call Payment Master Payment Request Message Builder to generate the message
uppMessageBuilder = PaymentRequestMessageBuilder()
uppPaymentMessage = uppMessageBuilder.buildPaymentRequestMessage(uppPaymentRequestEntity, propertiesReader)
# Redirect the message generated to PayMaster Gateway for settlement
redirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + uppPaymentMessage)
Step 4 : Indicate PayMaster Properties File Location
Indicate where the PayMaster Properties File is located using PropertiesReader
.
Step 5 : Assign Values to the Payment Request Entity
Assign values into the PayMaster Request Entity. The merchant code must include all the fields as stated in the sample code, as they are mandatory.
- The setter function is used to assign value and the function accepts two parameters:
setter(parameter name, parameter value)
.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
Once all the mandatory values are assigned, call PaymentRequestMessageBuilder
to generate the UPP Payment message (paymentMessage
).
Step 7 : Send the Payment Message to the PayMaster Gateway
Use the paymentMessage
to redirect to the PayMaster Gateway for the UPP Payment.
Refer to Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
Setup and include the PayMaster Merchant Plug-In (MPI) Node.js library into your application.
Step 2 : Source Code
var paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.post('/UPPPayment', (req, res) => {
// Indicate PayMaster Properties File Location
paymaster.PropertiesReader('./properties/', 'UPPPayment.properties');
// Assign values to Payment 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', 'N');
paymaster.setter('MerchUserID', 'UserName');
paymaster.setter('PreAuthFlag', 'N');
// Generate the Request Message
payment.MERCH_UPPPaymentRequest(paymaster.PaymentRequestEntity, paymaster.propDetails, function(err, response, result) {
if (err) {
throw err;
}
if (response) {
// Redirect the message generated to PayMaster Gateway for settlement
res.redirect("https://xxx.finexusgroup.com/upp/faces/upp/payment.xhtml?" + result);
}
});
});
}
Step 3 : Indicate PayMaster Properties File Location
Indicate where the PayMaster Properties File is located using the PropertiesReader
.
Step 4 : Assign Values to the Payment Request Entity
Assign values into the PayMaster Request Entity. Your code must include all the fields as shown in the sample code since they are mandatory.
- The setter function is used to assign value and the function accepts two parameters:
setter(parameter name, parameter value)
.
Refer to UPP Payment Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 5 : Generate the Request Message
Use the MERCH_UPPPaymentRequest()
function to generate the payment request message.
Step 6 : Send the Payment Message to PayMaster
The Payment Message generated by the JavaScript will be used to send to PayMaster for the UPP payment.
Refer to Payment Response for security controls supported by PayMaster Merchant Plug-In (MPI).