资源简介

微信现金红包asp.net c#源码支付接口Demo。可以给任何程序员参考使用。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Models;
using System.Security.Cryptography;
using System.Configuration;
using System.IO;
using System.Net;
using System.Security.Cryptography.X509Certificates;

namespace Common
{
    public class PayForWeiXinHelp
    {

        /// 
        /// 调用微信支付接口前处理数据,包括sign验证等
        /// 

        /// 
        /// 
        public string DoDataForPayWeiXin(PayWeiXin payForWeiXin)
        {
            #region 处理nonce_str随机字符串,不长于 32 位(本程序生成长度为16位的)
            string str = “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ“;
            payForWeiXin.nonce_str = RandomStr(str16);
            #endregion

            #region 商户信息从config文件中读取
            //商户支付密钥key
            string key = ConfigurationManager.AppSettings[“key“].ToString();
            //商户号
            payForWeiXin.mch_id = ConfigurationManager.AppSettings[“mch_id“].ToString();
            //商户 appid 
            payForWeiXin.wxappid = ConfigurationManager.AppSettings[“wxappid“].ToString();
            //提供方名称 
            payForWeiXin.nick_name = ConfigurationManager.AppSettings[“nick_name“].ToString();
            payForWeiXin.act_id = “act_id“;
            //红包収送者名称 
            payForWeiXin.send_name = ConfigurationManager.AppSettings[“send_name“].ToString();
            //红包収放总人数
            payForWeiXin.total_num = int.Parse(ConfigurationManager.AppSettings[“total_num“].ToString());
            //红包祝福诧
            payForWeiXin.wishing = ConfigurationManager.AppSettings[“wishing“].ToString();
            //活劢名称 
            payForWeiXin.act_name = ConfigurationManager.AppSettings[“act_name“].ToString();
            //备注信息 
            payForWeiXin.remark = ConfigurationManager.AppSettings[“remark“].ToString();
            //商户logo的url 
            payForWeiXin.logo_imgurl = ConfigurationManager.AppSettings[“logo_imgurl“].ToString();
            //分享文案 
            payForWeiXin.share_content = ConfigurationManager.AppSettings[“share_content“].ToString();
            //分享链接
            payForWeiXin.share_url = ConfigurationManager.AppSettings[“share_url“].ToString();
            //分享的图片url 
            payForWeiXin.share_imgurl = ConfigurationManager.AppSettings[“share_imgurl“].ToString();
            //调用接口的机器 Ip 地址
            payForWeiXin.client_ip = ConfigurationManager.AppSettings[“client_ip“].ToString();
            #endregion

            #region 订单信息
            //生成订单号组成: mch_id+yyyymmdd+10 位一天内不能重复的数字
            //生成10位不重复的数字
            string num= “0123456789“;
            string randomNum = RandomStr(num10);
            payForWeiXin.mch_billno = payForWeiXin.mch_billno + System.DateTime.Now.ToString(“yyyyMMdd“) + randomNum;
            #endregion

            string postData = @“l> 
                                 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\
     文件        2698  2015-07-29 12:20  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\Common.csproj
     文件       12194  2015-01-29 16:52  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\PayForWeiXinHelp.cs
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\Properties\
     文件        1332  2015-01-27 15:11  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\Properties\AssemblyInfo.cs
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Debug\
     文件       12800  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Debug\Common.dll
     文件       17920  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Debug\Common.pdb
     文件        9728  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Debug\Models.dll
     文件        7680  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Debug\Models.pdb
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Release\
     文件       12288  2015-07-29 12:30  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Release\Common.dll
     文件       15872  2015-07-29 12:30  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Release\Common.pdb
     文件        9216  2015-07-29 12:30  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Release\Models.dll
     文件        7680  2015-07-29 12:30  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\bin\Release\Models.pdb
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\
     文件        1702  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\Common.csproj.FileListAbsolute.txt
     文件        7536  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\Common.csprojResolveAssemblyReference.cache
     文件       12800  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\Common.dll
     文件       17920  2015-08-09 15:05  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\Common.pdb
     文件        6720  2015-08-09 15:00  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2019-04-15 17:22  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\TempPE\
     文件           0  2015-01-27 15:11  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
     文件           0  2015-01-27 15:11  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
     文件           0  2015-01-27 15:11  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
     目录           0  2019-04-15 17:21  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Release\
     文件         488  2015-07-29 12:30  微信现金红包asp.net c#源码Demo\PayForWeiXin\Common\obj\Release\Common.csproj.FileListAbsolute.txt
............此处省略448个文件信息

评论

共有 条评论