Ejemplo n.º 1
0
        private const string md5key = "Cptfhb6gH4uzz7XtrkTr";  //商户sp校验密钥

        public static string PayDirect(string sOrderID, decimal dPrice, string privateField, string itemName)
        {
            string servadd          = "https://payinterface.qiandai.com/qdpay/entrance.do";
            string interfaceVer     = "1.0";
            string tradeMoney       = dPrice.ToString("f2");
            string partnerTradeId   = sOrderID.Substring(0, 32);//小于等于32位
            string childItem        = "ccc";
            string partnerNo        = "1000010706";
            string returnUrl        = string.Format("{0}/Pay/PayQdb_Return.aspx", ProvideCommon.GetRootURI()); //页面返回地址;
            string notifyUrl        = string.Format("{0}/Pay/PayQdb_Notify.aspx", ProvideCommon.GetRootURI()); //服务器返回地址
            string productName      = itemName;
            string productUrl       = string.Format("{0}/pay/", ProvideCommon.GetRootURI());
            string remark           = string.Format("{0}|{1}", sOrderID.Substring(32), privateField);
            string bankCode         = "cnUpop";
            string signType         = "1";
            string userIp           = ProvideCommon.GetRealIP();
            string tradeFailureTime = "10";
            string place            = "externalMerchant";
            string orderTime        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string isDirect         = "1";
            string phone            = "1";
            string email            = "*****@*****.**";
            //组织验签数据
            string signStr = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}{13}{14}{15}", interfaceVer, tradeMoney, partnerTradeId,
                                           partnerNo, returnUrl, notifyUrl, productName, productUrl, remark, bankCode, signType,
                                           userIp, tradeFailureTime, place, orderTime, md5key);
            //验签数据加密
            string        sign   = GetMD5(signStr, "gb2312");
            StringBuilder sbText = new StringBuilder();

            sbText.AppendFormat("<form id='qdbpaysubmit' name='qdbpaysubmit' action='{0}' method='post'>", servadd);
            sbText.AppendFormat("<input type='hidden' name='interfaceVer' value='{0}'/>", interfaceVer);
            sbText.AppendFormat("<input type='hidden' name='tradeMoney' value='{0}'/>", tradeMoney);
            sbText.AppendFormat("<input type='hidden' name='partnerTradeId' value='{0}'/>", partnerTradeId);
            sbText.AppendFormat("<input type='hidden' name='partnerNo' value='{0}'/>", partnerNo);
            sbText.AppendFormat("<input type='hidden' name='childItem' value='{0}'/>", childItem);
            sbText.AppendFormat("<input type='hidden' name='returnUrl' value='{0}'/>", returnUrl);
            sbText.AppendFormat("<input type='hidden' name='notifyUrl' value='{0}'/>", notifyUrl);
            sbText.AppendFormat("<input type='hidden' name='productName' value='{0}'/>", productName);
            sbText.AppendFormat("<input type='hidden' name='productUrl' value='{0}'/>", productUrl);
            sbText.AppendFormat("<input type='hidden' name='remark' value='{0}'/>", remark);
            sbText.AppendFormat("<input type='hidden' name='bankCode' value='{0}'/>", bankCode);
            sbText.AppendFormat("<input type='hidden' name='signType' value='{0}'/>", signType);
            sbText.AppendFormat("<input type='hidden' name='userIp' value='{0}'/>", userIp);
            sbText.AppendFormat("<input type='hidden' name='tradeFailureTime' value='{0}'/>", tradeFailureTime);
            sbText.AppendFormat("<input type='hidden' name='place' value='{0}'/>", place);
            sbText.AppendFormat("<input type='hidden' name='orderTime' value='{0}'/>", orderTime);
            sbText.AppendFormat("<input type='hidden' name='sign' value='{0}'/>", sign);
            sbText.AppendFormat("<input type='hidden' name='isDirect' value='{0}'/>", isDirect);
            sbText.AppendFormat("<input type='hidden' name='phone' value='{0}'/>", phone);
            sbText.AppendFormat("<input type='hidden' name='email' value='{0}'/>", email);
            //submit按钮控件请不要含有name属性
            sbText.Append("<input type='submit' value='submit' style='display:none;'></form>");
            sbText.Append("<script>document.forms['qdbpaysubmit'].submit();</script>");
            FirstOfPayPointBLL.Add(sOrderID, userIp, sbText.ToString());
            return(sbText.ToString());
        }
Ejemplo n.º 2
0
        public static string PayBegin(string sChannel, string sPhone, string sAccount, decimal dPrice, int iCount)
        {
            string        sTranIP  = ProvideCommon.GetRealIP();
            string        p2_Order = TransPBLL.PointSalesInit(sChannel, sPhone, sAccount, dPrice, iCount, sTranIP);//订单号
            string        sPoints  = (dPrice * 10).ToString();
            StringBuilder sbText   = new StringBuilder();

            sbText.Append("到武林");
            sbText.Append(sPoints);
            sbText.Append("武林币");
            string p5_Pid   = sbText.ToString(); //商品名称
            string pd_FrpID = string.Empty;      //充值方式编码

            switch (sChannel)
            {
            case "yp-szx":
                pd_FrpID = "SZX-NET";
                break;

            case "yp-dx":
                pd_FrpID = "TELECOM-NET";
                break;

            case "yp-lt":
                pd_FrpID = "UNICOM-NET";
                break;

            case "yp-zt":
                pd_FrpID = "ZHENGTU-NET";
                break;

            case "yp-sd":
                pd_FrpID = "SNDACARD-NET";
                break;

            case "yp-jcard":
                pd_FrpID = "JUNNET-NET";
                break;

            case "yp-bank":
                pd_FrpID = "";
                break;
            }
            string pa_MP    = sAccount;
            string p8_Url   = string.Format("{0}/pay/YeeCallback.aspx", ProvideCommon.GetRootURI());
            string sTranUrl = YeePayBuy.CreateBuyUrl(p2_Order, dPrice.ToString(), sPoints, pa_MP, pd_FrpID, p8_Url);

            FirstOfPayPointBLL.Add(p2_Order, sTranIP, sTranUrl);
            return(sTranUrl);
        }
Ejemplo n.º 3
0
        private const string sppwd = "826672265045182445"; //商户sp校验密钥

        public static string PayDirect(string sOrderID, string sAccount, decimal dPrice, string spcustom, string sprec)
        {
            string        servadd   = "http://s3.vnetone.com/Default.aspx";                  //v币交易提交地址
            string        spreq     = string.Format("{0}/Pay/", ProvideCommon.GetRootURI()); //换成商户请求地址
            string        spname    = HttpUtility.UrlEncode("到武林平台");
            string        userip    = ProvideCommon.GetRealIP();
            string        spoid     = sOrderID.Substring(0, 30);
            string        snpcustom = HttpUtility.UrlEncode(string.Format("{0}|{1}", sOrderID.Substring(30), spcustom));
            string        spversion = "vpay1001"; //  '此接口的版本号码 此版本是"vpay1001"
            string        urlcode   = "utf-8";    //'编码  gbk  gb2312   utf-8  unicode   big5(注意不能一个繁体和简体字交叉写)  你程序的编码
            string        money     = dPrice.ToString();
            string        userid    = HttpUtility.UrlEncode(sAccount);
            StringBuilder sbText    = new StringBuilder();

            sbText.Append(spoid);
            sbText.Append(spreq);
            sbText.Append(sprec);
            sbText.Append(spid);
            sbText.Append(sppwd);
            sbText.Append(spversion);
            sbText.Append(money);
            string post_key = sbText.ToString();
            string spmd5    = ProvideCommon.MD5(post_key).ToUpper();//  '先MD532 然后转大写

            sbText.Remove(0, sbText.Length);
            sbText.AppendFormat("<form id='vpaysubmit' name='vpaysubmit' action='{0}' method='post'>", servadd);
            sbText.AppendFormat("<input type='hidden' name='spid' value='{0}'/>", spid);
            sbText.AppendFormat("<input type='hidden' name='spname' value='{0}'/>", spname);
            sbText.AppendFormat("<input type='hidden' name='spoid' value='{0}'/>", spoid);
            sbText.AppendFormat("<input type='hidden' name='spreq' value='{0}'/>", spreq);
            sbText.AppendFormat("<input type='hidden' name='sprec' value='{0}'/>", sprec);
            sbText.AppendFormat("<input type='hidden' name='userid' value='{0}'/>", userid);
            sbText.AppendFormat("<input type='hidden' name='userip' value='{0}'/>", userip);
            sbText.AppendFormat("<input type='hidden' name='spmd5' value='{0}'/>", spmd5);
            sbText.AppendFormat("<input type='hidden' name='spcustom' value='{0}'/>", snpcustom);
            sbText.AppendFormat("<input type='hidden' name='spversion' value='{0}'/>", spversion);
            sbText.AppendFormat("<input type='hidden' name='money' value='{0}'/>", money);
            sbText.AppendFormat("<input type='hidden' name='urlcode' value='{0}'/>", urlcode);
            //submit按钮控件请不要含有name属性
            sbText.Append("<input type='submit' value='submit' style='display:none;'></form>");
            sbText.Append("<script>document.forms['vpaysubmit'].submit();</script>");

            FirstOfPayPointBLL.Add(sOrderID, userip, sbText.ToString());
            return(sbText.ToString());
        }
Ejemplo n.º 4
0
        private const string key          = "a2990e2986ef3b21a5400414216c089a"; //密钥

        public static string PayDirect(string sOrderID, string sAccount, decimal dPrice, string PayType, HttpContext Context, string return_url)
        {
            string sPayUrl   = "https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi";
            string date      = DateTime.Now.ToString("yyyyMMdd");
            string strReq    = "" + DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4);
            string sp_billno = sOrderID.Substring(0, 32);
            //财付通订单号,10位商户号+8位日期+10位序列号,需保证全局唯一
            string transaction_id = bargainor_id + date + strReq;
            //创建PayRequestHandler实例
            PayRequestHandler reqHandler = new PayRequestHandler(Context);

            reqHandler.setKey(key);
            reqHandler.setGateUrl(sPayUrl);
            string  attach = string.Format("{0}|{1}|{2}", sOrderID.Substring(32), sAccount, PayType);
            decimal price  = Convert.ToInt32(dPrice * 100);

            //初始化
            reqHandler.init();
            string desc = string.Empty;

            if (PayType == "wlb")
            {
                desc = string.Format("到武林{0}元武林币充值", dPrice.ToString());
            }
            else
            {
                string sGameAbbre = PayType.Split('|')[0];
                string sGameName  = PayAll.GetGameName(sGameAbbre);
                desc = string.Format("到武林{0}元{1}游戏直冲", dPrice.ToString(), sGameName);
            }
            //-----------------------------
            //设置支付参数
            //-----------------------------
            reqHandler.setParameter("bargainor_id", bargainor_id);     //商户号
            reqHandler.setParameter("sp_billno", sp_billno);           //商家订单号
            reqHandler.setParameter("transaction_id", transaction_id); //财付通交易单号
            reqHandler.setParameter("return_url", return_url);         //支付通知url
            reqHandler.setParameter("desc", desc);                     //商品名称
            reqHandler.setParameter("total_fee", price.ToString());    //商品金额,以分为单位
            reqHandler.setParameter("attach", attach);                 //商家数据包,原样返回
            reqHandler.setParameter("cs", "utf-8");
            //用户ip,测试环境时不要加这个ip参数,正式环境再加此参数
            string UserIP = ProvideCommon.GetRealIP();

            reqHandler.setParameter("spbill_create_ip", UserIP);
            //post实现方式
            reqHandler.getRequestURL();
            StringBuilder sbText = new StringBuilder();

            sbText.AppendFormat("<form id='tenpaysubmit' name='tenpaysubmit' method=\"post\" action=\"{0}\">", reqHandler.getGateUrl());
            Hashtable ht = reqHandler.getAllParameters();

            foreach (DictionaryEntry de in ht)
            {
                sbText.AppendFormat("<input type=\"hidden\" name=\"{0}\" value=\"{1}\" >", de.Key, de.Value);
            }
            sbText.Append("<input type='submit' value='submit' style='display:none;'></form>");
            sbText.Append("<script>document.forms['tenpaysubmit'].submit();</script>");
            FirstOfPayPointBLL.Add(sOrderID, UserIP, sbText.ToString());
            return(sbText.ToString());
        }
Ejemplo n.º 5
0
        private static string ParaCreate(string out_trade_no, decimal dPrice, string sChannel, string sBankName, string sAccount, string body, string extra_common_param)
        {
            ////////////////////////////////////////////请求参数////////////////////////////////////////////
            //必填参数//
            //订单名称,显示在支付宝收银台里的“商品名称”里,显示在支付宝的交易管理的“商品名称”的列表里。
            string subject = "Dao50GamePAY";
            //订单总金额,显示在支付宝收银台里的“应付总额”里
            string total_fee = dPrice.ToString();

            //扩展功能参数——默认支付方式//

            //默认支付方式,代码见“即时到帐接口”技术文档
            string paymethod = string.Empty;

            switch (sChannel)
            {
            case "alipay":
                paymethod = "directPay";
                break;

            case "ibank":
                paymethod = "bankPay";
                break;
            }
            //默认网银代号,代号列表见“即时到帐接口”技术文档“附录”→“银行列表”
            string defaultbank = sBankName;

            //扩展功能参数——防钓鱼//

            //防钓鱼时间戳
            string anti_phishing_key = "";
            //获取客户端的IP地址,建议:编写获取客户端IP地址的程序
            string exter_invoke_ip = ProvideCommon.GetRealIP();
            //注意:
            //请慎重选择是否开启防钓鱼功能
            //exter_invoke_ip、anti_phishing_key一旦被设置过,那么它们就会成为必填参数
            //建议使用POST方式请求数据
            //示例:
            //exter_invoke_ip = "";
            //Service aliQuery_timestamp = new Service();
            //anti_phishing_key = aliQuery_timestamp.Query_timestamp();               //获取防钓鱼时间戳函数

            //扩展功能参数——其他//

            //商品展示地址,要用http:// 格式的完整路径,不允许加?id=123这类自定义参数
            string show_url = "http://game.dao50.com/Pay/";
            //默认买家支付宝账号
            string buyer_email = "";

            //扩展功能参数——分润(若要使用,请按照注释要求的格式赋值)//

            //提成类型,该值为固定值:10,不需要修改
            string royalty_type = "";
            //提成信息集
            string royalty_parameters = "";
            //注意:
            //与需要结合商户网站自身情况动态获取每笔交易的各分润收款账号、各分润金额、各分润说明。最多只能设置10条
            //各分润金额的总和须小于等于total_fee
            //提成信息集格式为:收款方Email_1^金额1^备注1|收款方Email_2^金额2^备注2
            //示例:
            //royalty_type = "10";
            //royalty_parameters = "[email protected]^0.01^分润备注一|[email protected]^0.01^分润备注二";

            ////////////////////////////////////////////////////////////////////////////////////////////////

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("payment_type", "1");
            sParaTemp.Add("show_url", show_url);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject);
            sParaTemp.Add("body", body);
            sParaTemp.Add("total_fee", total_fee);
            sParaTemp.Add("paymethod", paymethod);
            sParaTemp.Add("defaultbank", defaultbank);
            sParaTemp.Add("anti_phishing_key", anti_phishing_key);
            sParaTemp.Add("exter_invoke_ip", exter_invoke_ip);
            sParaTemp.Add("extra_common_param", extra_common_param);
            sParaTemp.Add("buyer_email", buyer_email);
            sParaTemp.Add("royalty_type", royalty_type);
            sParaTemp.Add("royalty_parameters", royalty_parameters);

            //构造即时到帐接口表单提交HTML数据,无需修改
            Service ali       = new Service();
            string  sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);
            string  sTranIP   = ProvideCommon.GetRealIP();

            FirstOfPayPointBLL.Add(out_trade_no, sTranIP, sHtmlText);
            return(sHtmlText);
        }
Ejemplo n.º 6
0
        private const string privateKey = "yth91678";  //商户sp校验密钥

        /// <summary>
        ///
        /// </summary>
        /// <param name="sOrderID">订单号</param>
        /// <param name="dPrice">价格</param>
        /// <param name="privateField">商户私有数据</param>
        /// <param name="itemName">产品名称</param>
        /// <param name="gatewayId">支付方式id</param>
        /// <param name="cardTypeCombine">0:移动,1:联通,2:电信</param>
        /// <returns></returns>
        public static string PayDirect(string sOrderID, decimal dPrice, string privateField, string itemName, string gatewayId, string cardTypeCombine)
        {
            string        servadd         = "http://pay3.shenzhoufu.com/interface/version3/entry.aspx";              //交易提交地址
            string        version         = "3";                                                                     //版本号 *
            string        merId           = "101959";                                                                //商户ID *
            int           ipayMoney       = Convert.ToInt32(dPrice * 100);
            string        payMoney        = ipayMoney.ToString();                                                    //支付金额(单位:分) *
            string        orderId         = sOrderID;                                                                //订单号(格式:yyyyMMdd-merId-SN) *
            string        pageReturnUrl   = string.Format("{0}/Pay/PaySzf_Return.aspx", ProvideCommon.GetRootURI()); //页面返回地址
            string        serverReturnUrl = string.Format("{0}/Pay/PaySzf_Notify.aspx", ProvideCommon.GetRootURI()); //服务器返回地址
            string        merUserName     = "******";                                                                   //商户的用户姓名
            string        merUserMail     = "";                                                                      //商户的用户Email
            string        itemDesc        = "";                                                                      //产品描述
            string        bankId          = "";                                                                      //平台银行ID
            string        verifyType      = "1";                                                                     //数据校验方式
            string        returnType      = "3";                                                                     //返回结果方式
            string        isDebug         = "0";                                                                     //是否调试
            StringBuilder sbText          = new StringBuilder();

            sbText.AppendFormat("{0}|", version);
            sbText.AppendFormat("{0}|", merId);
            sbText.AppendFormat("{0}|", payMoney);
            sbText.AppendFormat("{0}|", orderId);
            sbText.AppendFormat("{0}|", pageReturnUrl);
            sbText.AppendFormat("{0}|", serverReturnUrl);
            sbText.AppendFormat("{0}|", privateField);
            sbText.AppendFormat("{0}|", privateKey);
            sbText.AppendFormat("{0}|", verifyType);
            sbText.AppendFormat("{0}|", returnType);
            sbText.Append(isDebug);
            string post_key = sbText.ToString();
            //进行MD5加密
            /*md5String=md5( version+"|"  + merId+"|"  + payMoney+"|"  + orderId+"|"  + pageReturnUrl+"|"  + serverReturnUrl+"|"  + privateField+"|"  + privateKey+"|"  + verifyType+"|"  + returnType+"|"  + isDebug)*/
            string md5String = ProvideCommon.MD5(post_key).ToLower();

            sbText.Remove(0, sbText.Length);
            sbText.AppendFormat("<form id='szfpaysubmit' name='szfpaysubmit' action='{0}' method='post'>", servadd);
            sbText.AppendFormat("<input type='hidden' name='version' value='{0}'/>", version);
            sbText.AppendFormat("<input type='hidden' name='merId' value='{0}'/>", merId);
            sbText.AppendFormat("<input type='hidden' name='payMoney' value='{0}'/>", payMoney);
            sbText.AppendFormat("<input type='hidden' name='orderId' value='{0}'/>", orderId);
            sbText.AppendFormat("<input type='hidden' name='pageReturnUrl' value='{0}'/>", pageReturnUrl);
            sbText.AppendFormat("<input type='hidden' name='serverReturnUrl' value='{0}'/>", serverReturnUrl);
            sbText.AppendFormat("<input type='hidden' name='merUserName' value='{0}'/>", merUserName);
            sbText.AppendFormat("<input type='hidden' name='merUserMail' value='{0}'/>", merUserMail);
            sbText.AppendFormat("<input type='hidden' name='itemName' value='{0}'/>", itemName);
            sbText.AppendFormat("<input type='hidden' name='itemDesc' value='{0}'/>", itemDesc);
            sbText.AppendFormat("<input type='hidden' name='bankId' value='{0}'/>", bankId);
            sbText.AppendFormat("<input type='hidden' name='privateField' value='{0}'/>", privateField);
            sbText.AppendFormat("<input type='hidden' name='md5String' value='{0}'/>", md5String);
            sbText.AppendFormat("<input type='hidden' name='gatewayId' value='{0}'/>", gatewayId);
            sbText.AppendFormat("<input type='hidden' name='cardTypeCombine' value='{0}'/>", cardTypeCombine);
            sbText.AppendFormat("<input type='hidden' name='verifyType' value='{0}'/>", verifyType);
            sbText.AppendFormat("<input type='hidden' name='returnType' value='{0}'/>", returnType);
            sbText.AppendFormat("<input type='hidden' name='isDebug' value='{0}'/>", isDebug);
            sbText.Append("<input type='hidden' name='signString' value=''/>");
            //submit按钮控件请不要含有name属性
            sbText.Append("<input type='submit' value='submit' style='display:none;'></form>");
            sbText.Append("<script>document.forms['szfpaysubmit'].submit();</script>");
            string userip = ProvideCommon.GetRealIP();

            FirstOfPayPointBLL.Add(sOrderID, userip, sbText.ToString());
            return(sbText.ToString());
        }