|
调试了一下代码,在cordova.js中的927行
var messages = nativeApiProvider.get().exec(bridgeSecret, service, action, callbackId, argsJson);
返回"111 F09 Alipay93996451 sAttempt to invoke virtual method 'int java.lang.String.length()' on a null object reference"
调用的页面js中按照外卖的例子做的,
先加载了插件
require("$UI/system/lib/cordova/cordova");
require("cordova!org.apache.cordova.device");
require("cordova!com.justep.cordova.plugin.alipay");
支付代码:
Model.prototype.payOrderByAlipay = function() {
if (!navigator.alipay) {
return;
}
//var notifyUrl = mb_Comm.BASE_URL + "AliPay";
var notifyUrl = location.origin;//"http://115.28.165.203:8080/mobao/AliPay";
var tradeNo = justep.UUID.createUUID();
var alipay = navigator.alipay;
alipay.pay({
"seller" : "315127044@qq.com", // 卖家支付宝账号或对应的支付宝唯一用户号
"subject" : "测试一下", // 商品名称
"body" : "测试一下", // 商品详情
"price" : "0.01", // 金额,单位为RMB
"tradeNo" : tradeNo, // 唯一订单号
"timeout" : "30m", // 超时设置
"notifyUrl" : notifyUrl
}, // 服务器通知路径
function(message) {
alert("支付成功");
}, function(msg) {
alert("支付失败:"+msg);
});
}; |
|