基本信息
源码名称:asp.net 微信支付示例源码下载(JSSDK)
源码大小:0.09M
文件格式:.zip
开发语言:C#
更新时间:2017-07-26
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="pay.aspx.cs" Inherits="wxDemoweb.wxpay.pay" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>GMTA-微信支付测试</title>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta name="author" content="chiukingho">
<meta name="viewport" content="width=480,user-scalable=no,target-densitydpi=device-dpi">
<style>
.button
{
width: 150px;
line-height: 30px;
text-align: center;
font-weight: bold;
color: #fff;
text-shadow: 1px 1px 1px #333;
border-radius: 10px;
position: relative;
overflow: hidden;
cursor: pointer;
margin-top: 20px;
height: 50px;
}
.button.gray
{
color: #8c96a0;
text-shadow: 1px 1px 1px #fff;
border: 1px solid #dce1e6;
box-shadow: 0 1px 2px #fff inset,0 -1px 0 #a8abae inset;
background: -webkit-linear-gradient(top,#f2f3f7,#e4e8ec);
background: -moz-linear-gradient(top,#f2f3f7,#e4e8ec);
background: linear-gradient(top,#f2f3f7,#e4e8ec);
}
#proImg
{
width: 100px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="text-align: center; margin-top: 50px;">
当前网络环境: <span class="int"></span>
<br />
<br />
<br />
<span id="payMsg" style="color: Red;">微信支付测试:0.01 元</span>
<br />
<span id="Span1" style="color: Red;">订单编号:<%=ordercode %></span>
<br />
<input type="button" class="button" value="支付" id="payOK" />
<br />
<%=wxpayconfig.timestamp%>
<br />
<%=wxpayconfig.nonceStr%>
<br />
<%=wxpayconfig.package%>
<br />
<%=wxpayconfig.signType %>
<br />
<%=wxpayconfig.paySign %>
</div>
<div style="margin-top: 200px; text-align: right;">
<span style="font-size: 12px; color: #CCC;">好男人就是我,我就是蟑螂欧巴 </span>
</div>
</form>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js" type="text/javascript"></script>
<script type="text/javascript">
wx.config({
debug: false,
appId: 'wx7770e80e51db839e', // 必填,公众号的唯一标识
timestamp: "<%=wxconfig.timestamp%>",
nonceStr: "<%=wxconfig.nonceStr%>",
signature: "<%=wxconfig.signature%>",
jsApiList: [ // 必填,需要使用的JS接口列表
'onMenuShareTimeline',
'onMenuShareAppMessage',
'getNetworkType',
'chooseWXPay'
]
});
wx.ready(function () {
document.querySelector('#payOK').onclick = function () {
wx.chooseWXPay({
timestamp: "<%=wxpayconfig.timestamp%>", // 支付签名时间戳
nonceStr: "<%=wxpayconfig.nonceStr%>", // 支付签名随机串
package: "<%=wxpayconfig.package%>", // 统一支付接口返回的package包
signType: "<%=wxpayconfig.signType%>", // 签名方式,'MD5'
paySign: "<%=wxpayconfig.paySign %>", // 支付签名
success: function (res) {
if(res.err_msg == "get_brand_wcpay_request:ok" )
{
alert("支付成功");
// 使用以上方式判断前端返回,微信团队郑重提示:res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
}
}
});
};
var shareData = {
title: 'GMTA-微信支付测试',
desc: '好男人就是我,我就是蟑螂欧巴',
link: 'http://***/wxpay/pay.aspx',
imgUrl: 'http://***/wxshare.jpg',
trigger: function (res) {
//alert('用户点击发送给朋友');
},
success: function (res) {
//alert('已分享');
},
cancel: function (res) {
//alert('已取消');
},
fail: function (res) {
//alert(JSON.stringify(res));
}
};
//监听“分享给朋友”,按钮点击、自定义分享内容及分享结果接口
wx.onMenuShareAppMessage(shareData);
//监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
wx.onMenuShareTimeline(shareData);
//获取用户网络状态
wx.getNetworkType({
success: function (res) {
$(".int").html(res.networkType);
document.getElementById("int").innerHTML=res.networkType;
},
fail: function (res) {
alert(JSON.stringify(res));
}
});
//监听错误事件 出现'invalid signature' AJAX刷新ticket,并刷新当前页面
wx.error(function (res) {
if(res.errMsg.indexOf("invalid signature") > 0 )
{
alert("无效的签名,需要更新");
}
else{alert(res.errMsg);}
});
});
</script>
</body>
</html>