欢迎访问移动开发之家(rcyd.net),关注移动开发教程。移动开发之家  移动开发问答|  每日更新
页面位置 : > > 内容正文

微信开发(4)微信支付3.7C#版,

来源: 开发者 投稿于  被查看 9697 次 评论:52

微信开发(4)微信支付3.7C#版,


1.下载示例代码

下载地址:http://dldx.csdn.net/fd.php?i=730282530419400&s=f205228286602140c31c30095f3d6f24
不要下载官方示例代码,那个例子也跑不通。

2、 解压缩

打开code目录下的WeiPayDemo项目。项目代码是用老版本的VS做的,在VS013中打开时会进行一些转换。

3、 打开PayConfig.cs修改如下参数:

public static string MchId = "2222831601"; //修改为你的微信商户号
public static string AppId = "wx11f796122a4333a4"; //修改为你的公众号的AppId
public static string AppSecret = "555f4555cee55551439555bd7990555"; //你的AppSecret
public static string AppKey = "1597777cceeccee5cccc77cbd7991111";//你的支付API密钥
public static string SendUrl = "http://xxx.my3w.com/Send.aspx"; //发起支付页面
public static string PayUrl = "http://xxx.my3w.com/WeiPay.aspx"; //支付页面
public static string NotifyUrl = "http://xxx.my3w.com/Notify.aspx";//通知url页面

4、 在公众平台后台,修改测试授权目录和授权回调页面域名

在本例中分别为http://xxx.my3w.com/和xxx.my3w.com。

5、 建一个default.aspx页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WxPayAPI._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<body runat="server">
<a href="http://xxx.my3w.com/Send.aspx">JSAPI支付</a>
</body>
</html>

里面只有一个链接,调到支付页面send.aspx。

6、 使用VS的发布功能将代码发布到服务器上

可以使用FTP方式进行发布。

7、 测试

用火狐打开http://xxx.my3w.com/,点击地址栏右边的二维码图标,弹出一个二维码,用微信“扫一扫”扫描二维码,即可进入页面进行测试。

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关频道:

用户评论