<!doctype html>
<html>
<head>
<head>
<title>微信和支付宝JSAPI支付页面demo</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=UTF-8">
</head>
<body>
</br></br></br></br>
<div align="center">
正在支付,请等待....
</div>
<script type="text/javascript" src="http://static.solaridc.com/jquery/jquery-1.9.1.js"></script>
<script type="text/javascript">
callpay();
function jsApiCall()
{
WeixinJSBridge.invoke(
'getBrandWCPayRequest',
{
"appId":"wx50207d2390936e26",
"timeStamp":"1427160790332",
"signType":"MD5",
"package":"prepay_id=wx2015032409435699f3c23fd30370937173",
"nonceStr":"0d6HuxczrznWuXb8",
"paySign":"D61AE52D8167C42B341A9290E88EE7AA"
},
function(res){
if(res.err_msg == "get_brand_wcpay_request:ok" ) {
alert('支付成功!');
}
}
);
}
function callpay()
{
if (typeof WeixinJSBridge == "undefined"){
if( document.addEventListener ){
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
}else if (document.attachEvent){
document.attachEvent('WeixinJSBridgeReady', jsApiCall);
document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
}
}else{
jsApiCall();
}
}
function alipay(data, fun) {
AlipayJSBridge.call("tradePay", {
tradeNO : data.tradeNo
}, function(result) {
fun(result);
});
}
alipay(data, function(result) {
if (result.resultCode == "9000") {
alert('支付成功!');
} else {
alert('支付失败!');
}
});
</script>
</body>
</html>