微信开发(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/,点击地址栏右边的二维码图标,弹出一个二维码,用微信“扫一扫”扫描二维码,即可进入页面进行测试。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值