예제 #1
0
        //生成签名--支付
        public static string makeSignForQrCodePay(PayData pd)
        {
            Dictionary <string, string> dics = new Dictionary <string, string>();

            //1-赋值公共参数
            dics.Add("app_id", pd.GetValue("app_id").ToString());//所给的appId
            dics.Add("nonce_str", pd.GetValue("nonce_str").ToString());
            dics.Add("version", pd.GetValue("version").ToString());
            dics.Add("timestamp", pd.GetValue("timestamp").ToString());
            dics.Add("mch_id", pd.GetValue("mch_id").ToString());
            //2-赋值支付参数
            dics.Add("title", pd.GetValue("title").ToString());
            dics.Add("total_fee", pd.GetValue("total_fee").ToString());
            dics.Add("out_trade_no", pd.GetValue("out_trade_no").ToString());
            dics.Add("channel", pd.GetValue("channel").ToString());
            dics.Add("openid", pd.GetValue("openid").ToString());
            //3-ASCII排序后的字符串
            var    signStr = getParamSrc(dics);
            string API     = signStr + "&key=" + pd.GetValue("app_secret");
            string signMd5 = MD5(API);

            return(signMd5);
        }