//安装 插件
cordova plugin add https://github.com/charleyw/cordova-plugin-alipay.git –variable PARTNER_ID=合作身份者id –variable SELLER_ACCOUNT=收款支付宝账号 –variable PRIVATE_KEY=商户私钥
//调用
AlipyService.alipay({ tradeNo: data.data.order_no, //订单号 subject: '用户充值', //标题 body: "账户充值", price: $scope.Account.rechargeAmount, //用户充值金额 notifyUrl: ENV.baseUrl + ENV.AlipayNoticeUrl //服务器同步通知 }) $scope.$on("alipay", function(event, data){ if (data.resultStatus==='9000') { //提示用户充值成功 TipService.setMessage('支付成功'); //重置充值金额 $scope.Account.rechargeAmount = null; //返回上个页面 $state.go('bills'); } })
//封装服务
.factory('AlipyService', ['$rootScope', function($rootScope){ return { alipay:function(params){ window.alipay.pay(params, function(data){ $rootScope.$broadcast("alipay", data); }, function(data){ $rootScope.$broadcast("alipay", data); }); } }; }])
.
最新评论