wang_
wang_
  • 发布:2016-05-27 15:30
  • 更新:2016-05-27 16:24
  • 阅读:1343

关于支付调用问题

分类:HTML5+

var channel=null;
// 1. 获取支付通道
function plusReady(){
// 获取支付通道
plus.payment.getChannels(function(channels){
channel=channels[0];
},function(e){
alert("获取支付通道失败:"+e.message);
});
}
document.addEventListener('plusready',plusReady,false);

var ALIPAYSERVER='http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';
var WXPAYSERVER='http://demo.dcloud.net.cn/helloh5/payment/wxpay.php?total=';
// 2. 发起支付请求
function pay(id){
// 从服务器请求支付订单
var PAYSERVER='';
if(id=='alipay'){
PAYSERVER=ALIPAYSERVER;
}else if(id=='wxpay'){
PAYSERVER=WXPAYSERVER;
}else{
plus.nativeUI.alert("不支持此支付通道!",null,"捐赠");
return;
}
var xhr=new XMLHttpRequest();
xhr.onreadystatechange=function(){
switch(xhr.readyState){
case 4:
if(xhr.status==200){
plus.payment.request(channel,xhr.responseText,function(result){
plus.nativeUI.alert("支付成功!",function(){
back();
});
},function(error){
plus.nativeUI.alert("支付失败:" + error.code);
});
}else{
alert("获取订单信息失败!");
}
break;
default:
break;
}
}
xhr.open('GET',PAYSERVER);
xhr.send();
}
以上字符代码中,其中var ALIPAYSERVER='http://demo.dcloud.net.cn/helloh5/payment/alipay.php?total=';这个链接后面可以接多个参数?这个链接要换成我公司的项目链接?

2016-05-27 15:30 负责人:无 分享
已邀请:
MoGaven

MoGaven

需要去看Alipay支付所需的参数

该问题目前已经被锁定, 无法添加新回复