Completion Request
This 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 completion processing.
- 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.MessageRequestBuilder.PaymentRequestMessageBuilder
Step 3 : Source Code
import com.PayMaster.Entities.PayMasterEntity;
import com.PayMaster.PropertiesReader.PropertiesReader;
import com.PayMaster.MessageRequestBuilder.PaymentRequestMessageBuilder;
// Declare a variable for Payment Master Properties - 1st Parameter = File Path, 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "CCPayment.properties");
// Declare a variable for Payment Master Entity
PayMasterEntity paymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set them into the Payment Master Entity
paymentRequestEntity.setter("PaymentID", "C13");
paymentRequestEntity.setter("MerchRefNo", "merchant-refNo-0001");
paymentRequestEntity.setter("CurrCode", "458");
paymentRequestEntity.setter("TxnAmt", "1.00");
paymentRequestEntity.setter("ExpTxnAmt", "2");
paymentRequestEntity.setter("CardNo", "8853010000095323");
// Call Payment Master Payment Request Message Builder to generate the message
PaymentRequestMessageBuilder messageBuilder = new PaymentRequestMessageBuilder();
String paymentMessage = messageBuilder.buildPaymentRequestMessage(paymentRequestEntity, propertiesReader);
// POST request to Payment Master Gateway for pre-authorization payment
String initialUrl = "https://xxx.finexusgroup.com/upp/faces/preauthcomplete.xhtml?" + paymentMessage;
HttpURLConnection connection = null;
URL url = new URL(initialUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("POST");
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
in.close();
String finalUrl = connection.getURL().toString();
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 Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
Once all the 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 Completion Response for security controls supported by PayMaster Merchant Plug-In (MPI).
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.MessageRequestBuilder
Step 3 : Source Code
using com.PayMaster.Entities;
using com.PayMaster.Properties;
using com.PayMaster.MessageRequestBuilder;
// Declare a variable for Payment Master Properties - 1st Parameter = File Path, 2nd Parameter = File name
PropertiesReader propertiesReader = new PropertiesReader("./PayMasterProperties/", "CCPayment.properties");
// Declare a variable for Payment Master Entity
PayMasterEntity ccPaymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set them into the Payment Master Entity
ccPaymentRequestEntity.setter("PaymentID", "C13");
ccPaymentRequestEntity.setter("MerchRefNo", "merchant-refNo-0001");
ccPaymentRequestEntity.setter("CurrCode", "458");
ccPaymentRequestEntity.setter("TxnAmt", "1.00");
ccPaymentRequestEntity.setter("ExpTxnAmt", "2");
ccPaymentRequestEntity.setter("CardNo", "8853010000095XXX"); // Masked for security
// Call Payment Master Payment Request Message Builder to generate the message
PaymentRequestMessageBuilder ccMessageBuilder = new PaymentRequestMessageBuilder();
string ccPaymentMessage = ccMessageBuilder.buildPaymentRequestMessage(ccPaymentRequestEntity, propertiesReader);
// POST request to Payment Master Gateway for pre-authorization payment
string initialUrl = "https://xxx.finexusgroup.com/upp/faces/preauthcomplete.xhtml?" + ccPaymentMessage;
HttpClient httpClient = new HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, initialUrl);
HttpResponseMessage response = await httpClient.SendAsync(request);
Uri finalUrl = response.RequestMessage.RequestUri;
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 Completion 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 — ccPaymentMessage
.
Step 7 : Send the Payment Message to the PayMaster Gateway
The ccPaymentMessage
will be used to send to the PayMaster Gateway for the UPP Payment.
Refer to Pre-Auth Completion Response for security controls supported by PayMaster Merchant Plug-In (MPI).
Step 1 : Library
The merchant must include the PayMaster Merchant Plug-In (MPI) PHP library, PayMaster.phar, in the merchant application.
Step 2 : Import
For UPP payments, the merchant must import the following classes into the merchant 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>', 'CCPayment.ini');
// Declare variable for Payment Master Entity
$paymentRequestEntity = new PayMasterEntity();
// Get all the parameter values from the user side and set them into the Payment Master Entity
$paymentRequestEntity->setter('PaymentID', 'C13');
$paymentRequestEntity->setter('MerchRefNo', 'merchant-refNo-0001');
$paymentRequestEntity->setter('CurrCode', '458');
$paymentRequestEntity->setter('TxnAmt', '1.00');
$paymentRequestEntity->setter('ExpTxnAmt', '2');
$paymentRequestEntity->setter('CardNo', '8853010000095XXX'); // Masked for security
// Call Payment Master Payment Request Message Builder to generate the message
$paymentRequestMessageBuilder = new PaymentRequestMessageBuilder();
$paymentMessage = $paymentRequestMessageBuilder->buildPaymentRequestMessage($paymentRequestEntity, $propertiesReader);
// POST request to Payment Master Gateway for pre-authorization
$initialUrl = "https://xxx.finexusgroup.com/upp/faces/preauthcomplete.xhtml?" . $paymentMessage;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $initialUrl);
curl_setopt($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
$finalUrl = curl_getinfo($ch, CURLINFO_REDIRECT_URL);
exit();
?>
Step 4 : Locate the Absolute Path of PayMaster.phar
The merchant must locate the absolute path of PayMaster.phar and use it as the $basePath
in the merchant's 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 Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 7 : Generate UPP Payment
Once all the mandatory values are assigned, the merchant calls the PaymentRequestMessageBuilder 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 Completion Response for security controls supported by PayMaster Merchant Plug-In (MPI).
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 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
import requests
# Declare variable for Payment Master Properties - 1st Parameter = File Path, 2nd Parameter = File name
properties_reader = PropertiesReader("CCPayment.properties", "PayMasterProperties/")
# Declare variable for Payment Master Entity
cc_payment_request_entity = PayMasterEntity()
# Get all the parameter values from the user side and set them into the Payment Master Entity
cc_payment_request_entity.setter("PaymentID", "C13")
cc_payment_request_entity.setter("MerchRefNo", "merchant-refNo-0001")
cc_payment_request_entity.setter("CurrCode", "458")
cc_payment_request_entity.setter("TxnAmt", "1.00")
cc_payment_request_entity.setter("ExpTxnAmt", "2")
cc_payment_request_entity.setter("CardNo", "8853010000095XXX") # Masked for security
# Call Payment Master Payment Request Message Builder to generate the message
cc_message_builder = PaymentRequestMessageBuilder()
cc_payment_message = cc_message_builder.buildPaymentRequestMessage(cc_payment_request_entity, properties_reader)
# POST request to Payment Master Gateway for pre-authorization
initial_url = "https://xxx.finexusgroup.com/upp/faces/preauthcomplete.xhtml?" + cc_payment_message
response = requests.post(initial_url)
final_url = response.url
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 Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 6 : Generate UPP Payment
OOnce all the mandatory values are assigned, the merchant calls the PaymentRequestMessageBuilder
to generate the UPP Payment (cc_payment_message
).
Step 7 : Send the Payment Message to the PayMaster Gateway
The cc_payment_message
will be used to send to the PayMaster Gateway for the UPP Payment.
Refer to Pre-Auth Completion 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 into the merchant application.
Step 2 : Source Code
var paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.post('/UPPPayment', (req, res) => {
// Indicate the PayMaster Properties File location
paymaster.PropertiesReader('./properties/', 'UPPPayment.properties');
// Assign values to 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', 'N');
paymaster.setter('MerchUserID', 'UserName');
paymaster.setter('PreAuthFlag', 'N');
// Generate the UPP Payment request message
payment.MERCH_UPPPaymentRequest(paymaster.PaymentRequestEntity, paymaster.propDetails, function (err, response, result) {
if (err) {
throw err;
}
if (response) {
// Redirect to PayMaster with the generated payment message
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 Completion Parameters for the fields supported by the PayMaster Merchant Plug-In (MPI).
Step 5 : Generate the Payment Request Message
Use the MERCH_UPPPaymentRequest()
function to generate the payment request message.
Step 6 : Send the Payment Message to PayMaster
The payment message returned by the JavaScript will be used to send to PayMaster for the UPP payment.
Refer to Pre-Auth Completion Response for security controls supported by PayMaster Merchant Plug-In (MPI).