付款查询
本指南介绍了如何在商户网站应用程序中应用相应的源代码,形成UPP支付查询处理的强制支付请求参数并将其发送给PayMaster。
- Java
- .Net
- PHP
- Python
- Node.js
第 1 步:图书馆
商户必须在其应用程序中包含 PayMaster 商户插件 (MPI) Java 库 PayMaster.jar。
第 2 步:导入
对于 UPP 付款,商家应将以下内容导入其代码中:
com.PayMaster.Entities.PayMasterEntity
com.PayMaster.PropertiesReader.PropertiesReader
com.PayMaster.MessageRequestBuilder.WebservicePaymentRequestMessageBuilder
第 3 步:源代码
import com.PayMaster.Entities.PayMasterEntity;
import com.PayMaster.PropertiesReader.PropertiesReader;
import com.PayMaster.MessageRequestBuilder.WebservicePaymentRequestMessageBuilder;
// 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 them into Payment Master Entity
paymentRequestEntity.setter("PaymentID", "U02");
paymentRequestEntity.setter("MerchantID", "000010000099939");
paymentRequestEntity.setter("ServiceID", "FNX");
paymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL");
paymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");
// Call Payment Master Payment Request Message Builder to generate the message
WebservicePaymentRequestMessageBuilder messageBuilder = new WebservicePaymentRequestMessageBuilder();
messageBuilder.buildUPPQueryRequestMessage(paymentRequestEntity, propertiesReader);
// Retrieve values from Payment Master Entity
String MerchantID = paymentRequestEntity.getter("MerchantID");
String CardNo = paymentRequestEntity.getter("CardNo");
String TxnDtTm = paymentRequestEntity.getter("TxnDtTm");
String TxnAmt = paymentRequestEntity.getter("TxnAmt");
String TxnStatus = paymentRequestEntity.getter("TxnStatus");
String CurrCode = paymentRequestEntity.getter("CurrCode");
String AuthIDRespCode = paymentRequestEntity.getter("AuthIDRespCode");
String ExpTxnAmt = paymentRequestEntity.getter("ExpTxnAmt");
String RetrievalRefNo = paymentRequestEntity.getter("RetrievalRefNo");
String OrgRespCode = paymentRequestEntity.getter("OrgRespCode");
String OrigTxnAmt = paymentRequestEntity.getter("OrigTxnAmt");
String OrigCurrCode = paymentRequestEntity.getter("OrigCurrCode");
String TxnChannel = paymentRequestEntity.getter("TxnChannel");
String FICode = paymentRequestEntity.getter("FICode");
String PymtGwRefNo = paymentRequestEntity.getter("PymtGwRefNo");
String TxnStatDetCde = paymentRequestEntity.getter("TxnStatDetCde");
String TxnStatMsg = paymentRequestEntity.getter("TxnStatMsg");
String ServiceID = paymentRequestEntity.getter("ServiceID");
String MerchHostID = paymentRequestEntity.getter("MerchHostID");
String MerchSessionID = paymentRequestEntity.getter("MerchSessionID");
String MerchRefNo = paymentRequestEntity.getter("MerchRefNo");
String OrderRefNo = paymentRequestEntity.getter("OrderRefNo");
String QueryStatus = paymentRequestEntity.getter("QueryStatus");
String FPXRefNo = paymentRequestEntity.getter("FPXRefNo");
String UppPymtMode = paymentRequestEntity.getter("UppPymtMode");
String OrigRespCode = paymentRequestEntity.getter("OrigRespCode");
String ExporigTxnAmt = paymentRequestEntity.getter("ExporigTxnAmt");
.....
第 4 步:指示 PayMaster 属性文件位置
商家必须使用PropertiesReader
指定 PayMaster 属性文件的位置。
第 5 步:为 PayMaster 请求实体分配值
商家应向 PayMaster 请求实体分配值。该代码必须包含示例代码中指定的所有字段,因为它们是强制性的。
- setter函数用于赋值,接受两个参数:
setter(参数名,参数值)
。
第 6 步: 调用 Web 服务支付请求消息生成器
分配所有强制值后,商家应使用buildUPPPaymentQueryRequest
函数调用 Web 服务支付请求消息生成器。
- 将生成付款查询请求消息并将其提交到 PayMaster 网关。
- 从 PayMaster 网关收到的查询响应将被处理并分配回 PayMaster 请求实体。
第 7 步: 从 PayMaster 请求实体检索值
商家可以使用相同的 PayMaster 请求实体从查询响应中检索信息。
- getter 函数用于检索值,接受一个参数:
getter(参数名称)
。
PayMaster商户插件(MPI)支持的字段请参考 UPP支付查询参数。
第 1 步:图书馆
商户必须在其应用程序中包含 PayMaster 商户插件 (MPI) .NET 库 PayMaster.dll。
第 2 步:命名空间
对于 UPP 支付,商户应在商户代码中包含以下命名空间:
using com.PayMaster.Entities
using com.PayMaster.Properties
using com.PayMaster.MessageRequestBuilder
第 3 步:源代码
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 them into Payment Master Entity
uppPaymentRequestEntity.setter("PaymentID", "U02");
uppPaymentRequestEntity.setter("MerchantID", "000010000099939");
uppPaymentRequestEntity.setter("ServiceID", "FNX");
uppPaymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL");
uppPaymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");
// Call Payment Master Web Service Payment Request Message Builder for UPP query request
WebServicePaymentRequestMessageBuilder uppMessageBuilder = new WebServicePaymentRequestMessageBuilder();
await uppMessageBuilder.buildUPPPaymentQueryRequest(uppPaymentRequestEntity, propertiesReader);
// Retrieve values from Payment Master Entity
string MerchantID = uppPaymentRequestEntity.getter("MerchantID");
string CardNo = uppPaymentRequestEntity.getter("CardNo");
string TxnDtTm = uppPaymentRequestEntity.getter("TxnDtTm");
string TxnAmt = uppPaymentRequestEntity.getter("TxnAmt");
string TxnStatus = uppPaymentRequestEntity.getter("TxnStatus");
string CurrCode = uppPaymentRequestEntity.getter("CurrCode");
string AuthIDRespCode = uppPaymentRequestEntity.getter("AuthIDRespCode");
string ExpTxnAmt = uppPaymentRequestEntity.getter("ExpTxnAmt");
string RetrievalRefNo = uppPaymentRequestEntity.getter("RetrievalRefNo");
string OrgRespCode = uppPaymentRequestEntity.getter("OrgRespCode");
string OrigTxnAmt = uppPaymentRequestEntity.getter("OrigTxnAmt");
string OrigCurrCode = uppPaymentRequestEntity.getter("OrigCurrCode");
string TxnChannel = uppPaymentRequestEntity.getter("TxnChannel");
string FICode = uppPaymentRequestEntity.getter("FICode");
string PymtGwRefNo = uppPaymentRequestEntity.getter("PymtGwRefNo");
string TxnStatDetCde = uppPaymentRequestEntity.getter("TxnStatDetCde");
string TxnStatMsg = uppPaymentRequestEntity.getter("TxnStatMsg");
string ServiceID = uppPaymentRequestEntity.getter("ServiceID");
string MerchHostID = uppPaymentRequestEntity.getter("MerchHostID");
string MerchSessionID = uppPaymentRequestEntity.getter("MerchSessionID");
string MerchRefNo = uppPaymentRequestEntity.getter("MerchRefNo");
string OrderRefNo = uppPaymentRequestEntity.getter("OrderRefNo");
string QueryStatus = uppPaymentRequestEntity.getter("QueryStatus");
string FPXRefNo = uppPaymentRequestEntity.getter("FPXRefNo");
string UppPymtMode = uppPaymentRequestEntity.getter("UppPymtMode");
string OrigRespCode = uppPaymentRequestEntity.getter("OrigRespCode");
string ExporigTxnAmt = uppPaymentRequestEntity.getter("ExporigTxnAmt");
.....
第 4 步:指示 PayMaster 属性文件位置
商家必须使用PropertiesReader
指定 PayMaster 属性文件的位置。
第 5 步:为付款请求实体分配值
商家应向 PayMaster 请求实体分配值。该代码必须包含示例代码中所述的所有字段,因为它们是强制性的。
- setter函数用于赋值,接受两个参数:
setter(参数名,参数值)
。
第 6 步: 调用 Web 服务付款请求
分配所有强制值后,商家应使用buildUPPPaymentQueryRequest
函数调用 Web 服务支付请求消息生成器。
- 将生成付款查询请求消息并将其提交到 PayMaster 网关。
- 从 PayMaster 网关收到的查询响应将被处理并分配回 PayMaster 请求实体。
第 7 步: 从 PayMaster 请求实体检索值
商家可以使用相同的 PayMaster 请求实体从查询响应中检索信息。
- getter 函数用于检索值,接受一个参数:
getter(参数名称)
。
PayMaster商户插件(MPI)支持的字段请参考 UPP支付查询参数。
第 1 步:图书馆
商户必须在其应用程序中包含 PayMaster 商户插件 (MPI) PHP 库 PayMaster.phar。
第 2 步:商户代码
对于 UPP 支付查询,商家应将以下组件导入其代码中:
PropertiesReader
– 读取属性文件。PayMasterEntity
– 为 PayMaster UPP 付款查询分配所有可接受的值。WebServicePaymentRequestMessageBuilder
– 生成PayMaster UPP支付查询请求消息。
第 3 步:源代码
<?php
use com\PayMaster\Entities\PayMasterEntity;
use com\PayMaster\PropertiesReader\PropertiesReader;
use com\PayMaster\MessageRequestBuilder\WebServicePaymentRequestMessageBuilder;
use com\PayMaster\Import\ImportFile;
// Locate the absolute path of PayMaster.phar
$basePath = 'phar://<PayMaster.phar path>/';
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("./PayMasterProperties/", "UPPPayment.ini");
// Declare variable for Payment Master Entity
$paymentRequestEntity = new PayMasterEntity();
// Set Values to Payment Master Entity
$paymentRequestEntity->setter("PaymentID", "U02");
$paymentRequestEntity->setter("MerchantID", "000010000099939");
$paymentRequestEntity->setter("ServiceID", "FNX");
$paymentRequestEntity->setter("MerchRefNo", "MYB2023030315435025LL");
$paymentRequestEntity->setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp");
// Call Payment Master Payment Response Message Builder to set value
$webServicePaymentRequestMessageBuilder = new WebServicePaymentRequestMessageBuilder();
$webServicePaymentRequestMessageBuilder->buildUPPQueryRequestMessage($paymentRequestEntity, $propertiesReader);
// Retrieve values from Payment Master Entity
$MerchantID = $paymentRequestEntity->getter("MerchantID");
$CardNo = $paymentRequestEntity->getter("CardNo");
$TxnDtTm = $paymentRequestEntity->getter("TxnDtTm");
$TxnAmt = $paymentRequestEntity->getter("TxnAmt");
$TxnStatus = $paymentRequestEntity->getter("TxnStatus");
$CurrCode = $paymentRequestEntity->getter("CurrCode");
$AuthIDRespCode = $paymentRequestEntity->getter("AuthIDRespCode");
$ExpTxnAmt = $paymentRequestEntity->getter("ExpTxnAmt");
$RetrievalRefNo = $paymentRequestEntity->getter("RetrievalRefNo");
$OrgRespCode = $paymentRequestEntity->getter("OrgRespCode");
$OrigTxnAmt = $paymentRequestEntity->getter("OrigTxnAmt");
$OrigCurrCode = $paymentRequestEntity->getter("OrigCurrCode");
$TxnChannel = $paymentRequestEntity->getter("TxnChannel");
$FICode = $paymentRequestEntity->getter("FICode");
$PymtGwRefNo = $paymentRequestEntity->getter("PymtGwRefNo");
$TxnStatDetCde = $paymentRequestEntity->getter("TxnStatDetCde");
$TxnStatMsg = $paymentRequestEntity->getter("TxnStatMsg");
$ServiceID = $paymentRequestEntity->getter("ServiceID");
$MerchHostID = $paymentRequestEntity->getter("MerchHostID");
$MerchSessionID = $paymentRequestEntity->getter("MerchSessionID");
$MerchRefNo = $paymentRequestEntity->getter("MerchRefNo");
$OrderRefNo = $paymentRequestEntity->getter("OrderRefNo");
$QueryStatus = $paymentRequestEntity->getter("QueryStatus");
$FPXRefNo = $paymentRequestEntity->getter("FPXRefNo");
$UppPymtMode = $paymentRequestEntity->getter("UppPymtMode");
$OrigRespCode = $paymentRequestEntity->getter("OrigRespCode");
$ExporigTxnAmt = $paymentRequestEntity->getter("ExporigTxnAmt");
第 4 步:Locate Absolute Path of PayMaster.phar
商户必须指定PayMaster.phar的绝对路径作为商户源代码中的basePath(上例中的第7行)。
例子:$basePath=’phar://<absolute path of PayMaster.phar>/’
第 5 步:为 PayMaster 请求实体分配值
商家应向 PayMaster 请求实体分配值。该代码必须包含示例代码中指定的所有字段,因为它们是强制性的。
- setter函数用于赋值,接受两个参数:
setter(参数名,参数值)
。
第 6 步: 调用 Web 服务付款请求
分配所有强制值后,商家应使用buildUPPQueryRequestMessage
函数调用 Web 服务支付请求消息生成器。
- 将生成付款查询请求消息并将其提交到 PayMaster 网关。
- 从 PayMaster 网关收到的查询响应将被处理并分配回 PayMaster 请求实体。
第 7 步: 从 PayMaster 请求实体检索值
商家可以使用相同的 PayMaster 请求实体从查询响应中检索信息。
- getter 函数用于检索值,接受一个参数:
getter(参数名称)
。
PayMaster商户插件(MPI)支持的字段请参考 UPP支付查询参数。
第 1 步:打包
商户必须在其应用程序中设置并包含 PayMaster 商户插件 (MPI) Python 包。
第 2 步:导入
对于 UPP 付款,商家应在其代码中包含以下内容:
PropertiesReader
– 读取属性文件。PayMasterEntity
– 为 PayMaster UPP 付款查询分配所有可接受的值。WebServicePaymentRequestMessageBuilder
– 生成PayMaster UPP支付查询请求消息。
第 3 步:源代码
from com.PayMaster.Entities.PayMasterEntity import PayMasterEntity
from com.PayMaster.PropertiesReader.PropertiesReader import PropertiesReader
from com.PayMaster.MessageRequestBuilder.WebServicePaymentRequestMessageBuilder import WebServicePaymentRequestMessageBuilder
# 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
uppPaymentRequestEntity = PayMasterEntity()
# Set Values to Payment Master Entity
uppPaymentRequestEntity.setter("PaymentID", "U02")
uppPaymentRequestEntity.setter("MerchantID", "000010000099939")
uppPaymentRequestEntity.setter("ServiceID", "FNX")
uppPaymentRequestEntity.setter("MerchRefNo", "MYB2023030315435025LL")
uppPaymentRequestEntity.setter("QueryRespURL", "https://XXX.XXXXX.XXX/query.jsp")
# Call Payment Master Web Service Payment Request Message Builder for UPP query request
uppMessageBuilder = WebServicePaymentRequestMessageBuilder()
uppMessageBuilder.buildUPPPaymentQueryRequest(uppPaymentRequestEntity, propertiesReader)
# Retrieve values from Payment Master Entity
MerchantID = uppPaymentRequestEntity.getter("MerchantID")
CardNo = uppPaymentRequestEntity.getter("CardNo")
TxnDtTm = uppPaymentRequestEntity.getter("TxnDtTm")
TxnAmt = uppPaymentRequestEntity.getter("TxnAmt")
TxnStatus = uppPaymentRequestEntity.getter("TxnStatus")
CurrCode = uppPaymentRequestEntity.getter("CurrCode")
AuthIDRespCode = uppPaymentRequestEntity.getter("AuthIDRespCode")
ExpTxnAmt = uppPaymentRequestEntity.getter("ExpTxnAmt")
RetrievalRefNo = uppPaymentRequestEntity.getter("RetrievalRefNo")
OrgRespCode = uppPaymentRequestEntity.getter("OrgRespCode")
OrigTxnAmt = uppPaymentRequestEntity.getter("OrigTxnAmt")
OrigCurrCode = uppPaymentRequestEntity.getter("OrigCurrCode")
TxnChannel = uppPaymentRequestEntity.getter("TxnChannel")
FICode = uppPaymentRequestEntity.getter("FICode")
PymtGwRefNo = uppPaymentRequestEntity.getter("PymtGwRefNo")
TxnStatDetCde = uppPaymentRequestEntity.getter("TxnStatDetCde")
TxnStatMsg = uppPaymentRequestEntity.getter("TxnStatMsg")
ServiceID = uppPaymentRequestEntity.getter("ServiceID")
MerchHostID = uppPaymentRequestEntity.getter("MerchHostID")
MerchSessionID = uppPaymentRequestEntity.getter("MerchSessionID")
MerchRefNo = uppPaymentRequestEntity.getter("MerchRefNo")
OrderRefNo = uppPaymentRequestEntity.getter("OrderRefNo")
QueryStatus = uppPaymentRequestEntity.getter("QueryStatus")
FPXRefNo = uppPaymentRequestEntity.getter("FPXRefNo")
UppPymtMode = uppPaymentRequestEntity.getter("UppPymtMode")
OrigRespCode = uppPaymentRequestEntity.getter("OrigRespCode")
ExporigTxnAmt = uppPaymentRequestEntity.getter("ExporigTxnAmt")
第 4 步:指示 PayMaster 属性文件位置
商家必须使用PropertiesReader
指定 PayMaster 属性文件的位置。
第 5 步:为 PayMaster 请求实体分配值
商家应向 PayMaster 请求实体分配值。该代码必须包含示例代码中指定的所有字段,因为它们是强制性的。
- setter函数用于赋值,接受两个参数:
setter(参数名,参数值)
。
第 6 步: 调用 Web 服务付款请求
分配所有强制值后,商家应使用buildUPPPaymentQueryRequest
函数调用 Web 服务支付请求消息生成器。
- 将生成付款查询请求消息并将其提交到 PayMaster 网关。
- 从 PayMaster 网关收到的查询响应将被处理并分配回 PayMaster 请求实体。
第 7 步: 从 PayMaster 请求实体检索值
商家可以使用相同的 PayMaster 请求实体从查询响应中检索信息。
- getter 函数用于检索值并接受一个参数:
getter(参数名称)
。
PayMaster商户插件(MPI)支持的字段请参考 UPP支付查询参数。
第 1 步:图书馆
商户必须在其应用程序中设置并包含 PayMaster 商户插件 (MPI) Node.js 库。
第 2 步源代码
const paymaster = require('./js/PayMaster.min.js');
module.exports = function (app) {
app.get('/UPPQuery', (req, res) => {
// Set values in PayMaster
paymaster.setter('PaymentID', 'U02');
paymaster.setter('MerchantID', '000010000099939');
paymaster.setter('ServiceID', 'FNX');
paymaster.setter('MerchRefNo', 'MYB2023030315435025LL');
paymaster.setter('QueryRespURL', 'https://XXX.XXXXX.XXX/query.jsp');
// Submit payment request to PayMaster
paymaster.MERCH_UPPPaymentQueryRequest(paymaster.PaymasterRequestEntity, paymaster.propDetails, (err, response, result) => {
if (err) {
throw err;
}
if (response) {
// Retrieve values from the response
const MerchantID = paymaster.getter('MerchantID');
const CardNo = paymaster.getter('CardNo');
const TxnDtTm = paymaster.getter('TxnDtTm');
const TxnAmt = paymaster.getter('TxnAmt');
const TxnStatus = paymaster.getter('TxnStatus');
const CurrCode = paymaster.getter('CurrCode');
const AuthIDRespCode = paymaster.getter('AuthIDRespCode');
const ExpTxnAmt = paymaster.getter('ExpTxnAmt');
const RetrievalRefNo = paymaster.getter('RetrievalRefNo');
const OrgRespCode = paymaster.getter('OrgRespCode');
const OrigTxnAmt = paymaster.getter('OrigTxnAmt');
const OrigCurrCode = paymaster.getter('OrigCurrCode');
const TxnChannel = paymaster.getter('TxnChannel');
const FICode = paymaster.getter('FICode');
const PymtGwRefNo = paymaster.getter('PymtGwRefNo');
const TxnStatDetCde = paymaster.getter('TxnStatDetCde');
const TxnStatMsg = paymaster.getter('TxnStatMsg');
const ServiceID = paymaster.getter('ServiceID');
const MerchHostID = paymaster.getter('MerchHostID');
const MerchSessionID = paymaster.getter('MerchSessionID');
const MerchRefNo = paymaster.getter('MerchRefNo');
const OrderRefNo = paymaster.getter('OrderRefNo');
const QueryStatus = paymaster.getter('QueryStatus');
const FPXRefNo = paymaster.getter('FPXRefNo');
const UppPymtMode = paymaster.getter('UppPymtMode');
const OrigRespCode = paymaster.getter('OrigRespCode');
const ExporigTxnAmt = paymaster.getter('ExporigTxnAmt');
// Send response
res.json({
MerchantID,
CardNo,
TxnDtTm,
TxnAmt,
TxnStatus,
CurrCode,
AuthIDRespCode,
ExpTxnAmt,
RetrievalRefNo,
OrgRespCode,
OrigTxnAmt,
OrigCurrCode,
TxnChannel,
FICode,
PymtGwRefNo,
TxnStatDetCde,
TxnStatMsg,
ServiceID,
MerchHostID,
MerchSessionID,
MerchRefNo,
OrderRefNo,
QueryStatus,
FPXRefNo,
UppPymtMode,
OrigRespCode,
ExporigTxnAmt
});
}
});
});
}
第 3 步:指示 PayMaster 属性文件位置
商家必须使用PropertiesReader
指定 PayMaster 属性文件的位置。
第 4 步:为所有字段分配值
商家必须为所有字段分配值,如示例代码所示。
- setter函数用于赋值,接受两个参数:
setter(参数名,参数值)
。
第 5 步:向 PayMaster 提交付款请求
使用 MERCH_UPPPamentQueryRequest()
函数生成付款请求消息并将其提交给 PayMaster。
第 6 步: PayMaster 返回的响应参数
PayMaster 返回的响应参数将由 PayMaster MPI Node.js 库处理。
第 7 步: 检索支付查询响应参数的值
商户可以使用 getter 函数检索支付查询响应参数的值,该函数接受一个参数:getter(参数名称)
。
PayMaster商户插件(MPI)支持的字段请参考 UPP支付查询参数。