更新记录
1.1.0(2024-02-07)
更新依赖
1.0.5(2024-01-22)
1.更新sdk 版本与 配置参数
1.0.4(2023-12-12)
--更新ios sdk版本1.12.0
查看更多平台兼容性
Android | iOS |
---|---|
× | 适用版本区间:9 - 16 |
原生插件通用使用流程:
- 购买插件,选择该插件绑定的项目。
- 在HBuilderX里找到项目,在manifest的app原生插件配置中勾选模块,如需要填写参数则参考插件作者的文档添加。
- 根据插件作者的提供的文档开发代码,在代码中引用插件,调用插件功能。
- 打包自定义基座,选择插件,得到自定义基座,然后运行时选择自定义基座,进行log输出测试。
- 开发完毕后正式云打包
付费原生插件目前不支持离线打包。
Android 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/android
iOS 离线打包原生插件另见文档 https://nativesupport.dcloud.net.cn/NativePlugin/offline_package/ios
注意事项:使用HBuilderX2.7.14以下版本,如果同一插件且同一appid下购买并绑定了多个包名,提交云打包界面提示包名绑定不一致时,需要在HBuilderX项目中manifest.json->“App原生插件配置”->”云端插件“列表中删除该插件重新选择
概述
netsNofPay 简介
NETS NOF PAY
netsNofPay 模块概述
本模块封装了NETS NOF PAY原生SDK,提供初始化、注册、注销、检查账户金额、检查账户金额结果上报、付款、付款结果上报
模块使用攻略
联系QQ:770104707
模块接口
NofService
初始化
NofService({params},callback(ret, err))
params
serverBaseUrl
- 类型:字符串
- 描述:服务端地址
apiGwBaseUrl
- 类型:字符串
- 描述:网关地址
appId
- 类型:字符串
- 描述:应用ID
appSecret
- 类型:字符串
- 描述:应用密钥
serverCertName
- 类型:字符串
- 描述:证书名称
mapPubKeyId
- 类型:字符串
- 描述:map 公钥ID
mapKeyModulus
- 类型:字符串
- 描述:map Modulus
mapKeyExponent
- 类型:字符串
- 描述:map Exponent
hppPubKeyId
- 类型:字符串
- 描述:hpp 公钥ID
hppKeyModulus
- 类型:字符串
- 描述:hpp Modulus
hppKeyExponent
- 类型:字符串
- 描述:hpp Exponent
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
let HOST_URL = "https://uatnetspay.nets.com.sg"
let API_GW_URL = "https://uat-api.nets.com.sg/uat"
let APPLICATION_ID = "00011000002"
let APP_SECRET = "6944DAE581D8EDA2C1B29C1888F4F398D9E4A63D3208FD5BF5291F6FA47E6136"
let HPP_ISSUER_ID = "0001"
let HPP_ISSUER_ID_UOB = "0002"
let HPP_ISSUER_ID_OCBC = "0003"
let HPP_ISSUER_ID_SIM = "9999"
let MAP_PUBLIC_KEY_ID = "2"
let MAP_PUBLIC_KEY_EXPONENT = "03"
// let MAP_PUBLIC_KEY_MODULUS =
// "cfbb65135256d4e525fc6aada10ff7a78e0f239d6f4ac7ed0ef2b883e1b4cba8ec1c492081
// 42952cdc530380024d6ca7bae28f7d82a36e8b95baad64df079b368d17dce484e00e88ba008
// e41576da8e9aaa102d4287f07f0edd89a76df8eeb02e08498c01b6a9fd5014e3b73fd49b0c7
// 6ba32180894fe1da728c858bad96db9191e7c8244bf0649f09577ebe4bd1d0a1640dc2b8ad6
// f64b2a2f8715777b669703f3fcb8023dbe024fcb21ca0697044400dcdc288b335ccb254e8d9
// 8bb93eb4c71b84141467e35cb284d13c62099ba90367d490581dabdf33744898a54a81bf054
// 51288ec4c1065df003efa51aab502acadba022ee6d48b91901140e00d5eb20b"
let MAP_PUBLIC_KEY_MODULUS = "cfbb65135256d4e525fc6aada10ff7a78e0f239d6f4ac7ed0ef2b883e1b4cba8ec1c49208142952cdc530380024d6ca7bae28f7d82a36e8b95baad64df079b368d17dce484e00e88ba008e41576da8e9aaa102d4287f07f0edd89a76df8eeb02e08498c01b6a9fd5014e3b73fd49b0c76ba32180894fe1da728c858bad96db9191e7c8244bf0649f09577ebe4bd1d0a1640dc2b8ad6f64b2a2f8715777b669703f3fcb8023dbe024fcb21ca0697044400dcdc288b335ccb254e8d98bb93eb4c71b84141467e35cb284d13c62099ba90367d490581dabdf33744898a54a81bf05451288ec4c1065df003efa51aab502acadba022ee6d48b91901140e00d5eb20b"
let HPP_PUBLIC_KEY_ID = "2"
let HPP_PUBLIC_KEY_EXPONENT = "03"
// let HPP_PUBLIC_KEY_MODULUS =
// "D031A01F005662CCE917C57C8FCC18BB934026DC0D02A0E865896077BBCB2760B05AB979A9
// 253523B11573196465973566760B4F7AE0552349F826AB62A2D2E10B783A99D6668A643090E
// 259ACB30BCD9B9C5A2BFED83A8011DFD79CE0C285E09CF183E31662908B1F5AA8043562DB40
// 56B35876712787B373AED178F55EE860B252CEBD29721B97B84B17429EBE2EB6889F8487FD9
// 8EB5DA5477971AF85791B18C8F73CAF1706CC41C22F45F855FE197FCEE10ADB441DD84E92D6
// 1C51F23DBEDEFBF153ADA2BFD675FB5BF4ABC6B9E70DED677C8C9A85E189D73B3A287CE4B6B
// 1310B284527A742BE39B47F7FC56022E0419B81113FF739324FCC348AECCED7"
let HPP_PUBLIC_KEY_MODULUS = "D031A01F005662CCE917C57C8FCC18BB934026DC0D02A0E865896077BBCB2760B05AB979A9253523B11573196465973566760B4F7AE0552349F826AB62A2D2E10B783A99D6668A643090E259ACB30BCD9B9C5A2BFED83A8011DFD79CE0C285E09CF183E31662908B1F5AA8043562DB4056B35876712787B373AED178F55EE860B252CEBD29721B97B84B17429EBE2EB6889F8487FD98EB5DA5477971AF85791B18C8F73CAF1706CC41C22F45F855FE197FCEE10ADB441DD84E92D61C51F23DBEDEFBF153ADA2BFD675FB5BF4ABC6B9E70DED677C8C9A85E189D73B3A287CE4B6B1310B284527A742BE39B47F7FC56022E0419B81113FF739324FCC348AECCED7"
let serverName = "netspayserver"
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.NofService({
serverBaseUrl:HOST_URL,
apiGwBaseUrl:API_GW_URL,
appId:APPLICATION_ID,
appSecret:APP_SECRET,
serverCertName:serverName,
mapPubKeyId:MAP_PUBLIC_KEY_ID,
mapKeyModulus:MAP_PUBLIC_KEY_MODULUS,
mapKeyExponent:MAP_PUBLIC_KEY_EXPONENT,
hppPubKeyId:HPP_PUBLIC_KEY_ID,
hppKeyModulus:HPP_PUBLIC_KEY_MODULUS,
hppKeyExponent:HPP_PUBLIC_KEY_EXPONENT,
}, function(ret, err){
const msg = JSON.stringify(ret);
modal.toast({
message: msg,
duration: 1.5
});
});
Registration
注册
Registration({params},callback(ret, err))
params
muid
- 类型:字符串
- 描述:自定义账户
mid
- 类型:字符串
- 描述:由 NETS 分配的 MID
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.Registration({
muid:"xxxxx@nets.com",
mid:"11136198800",
}, function(ret, err){
const msg = JSON.stringify(ret);
if(ret.status){
var result = ret.result;
var t0102 = result.data;
}
});
Deregistration
注销
Deregistration({params},callback(ret, err))
params
无
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.Deregistration({}, function(ret, err){
const msg = JSON.stringify(ret);
if(ret.status){
var result = ret.result;
var t0102 = result.data;
}
});
CheckFundAvailability
验证账户金额
CheckFundAvailability({params},callback(ret, err))
params
amount
- 类型:字符串
- 描述:金额
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.CheckFundAvailability({
amount: "000000002000"
}, function(ret, err){
const msg = JSON.stringify(ret);
if(ret.status){
var result = ret.result;
var t0102 = result.data;
}
});
CheckFundAvailabilityReport
验证账户金额结果上报
CheckFundAvailabilityReport({params},callback(ret, err))
params
amount
- 类型:字符串
- 描述:金额
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.CheckFundAvailabilityReport({
amount: "000000002000",
responseCode:"00",// u9 55
transactionCryptogram:"",
}, function(ret, err){
const msg = JSON.stringify(ret);
if(ret.status){
var result = ret.result;
var t0102 = result.data;
}
});
Debit
付款
Debit({params},callback(ret, err))
params
amount
- 类型:字符串
- 描述:金额
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.Debit({
amount: "000000002000"
}, function(ret, err){
const msg = JSON.stringify(ret);
if(ret.status){
var result = ret.result;
var t0102 = result.data;
}
});
DebitReport
付款结果上报
DebitReport({params},callback(ret, err))
params
amount
- 类型:字符串
- 描述:金额
callback(ret, err)
ret:
- 类型:JSON 对象
- 内部字段:
{
status: true, //初始化状态
code: 0, //状态码
eventType: 'onSuccess', //事件类型 onSuccess onFailure
msg: "onSuccess",//描述
result:{ //其他结果数据
}
}
示例代码
var NetsNofPay = uni.requireNativePlugin('saner-NetsNofPay');
NetsNofPay.DebitReport({
amount: "000000002000",
responseCode:"00",// u9 55
transactionCryptogram:"",
}, function(ret, err){
const msg = JSON.stringify(ret);
if(ret.status){
var result = ret.result;
var t0102 = result.data;
}
});