/// <summary>
        /// 创建支付宝的支付订单
        /// </summary>
        private string CreateAlipayOrder()
        {
            var order = new Alipay.Order()
            {
                Amount       = 0.01,
                OutTradeNo   = "35",
                Subject      = "测测看支付宝",
                Body         = "1234",
                ExtendParams = new ExtendParam()
                {
                    HbFqNum = "3"
                },
                GoodsDetail = new Goods[] {
                    new Goods()
                    {
                        Id = "12"
                    }
                }
            };

            var gateway = gatewayList.GetGateway(GatewayType.Alipay);

            gateway.GatewayTradeType = GatewayTradeType.Web;

            PaymentSetting paymentSetting = new PaymentSetting(gateway, order);

            return(paymentSetting.Payment());
        }
Exemple #2
0
        public void CreateOrder(GatewayType gatewayType)
        {
            var gateway        = gateways.Get(gatewayType, GatewayTradeType.Wap);
            var paymentSetting = new PaymentSetting(gateway);

            paymentSetting.Order = new Order()
            {
                OrderAmount = 0.01,
                OrderNo     = DateTime.Now.ToString("yyyyMMddhhmmss"),
                Subject     = "WapPayment",
                PaymentDate = DateTime.Now
            };
            paymentSetting.Payment();
        }
Exemple #3
0
        private void CreateTenpayOrder()
        {
            PaymentSetting paymentSetting = new PaymentSetting(GatewayType.Tenpay);

            paymentSetting.Merchant.UserName  = "******";
            paymentSetting.Merchant.Key       = "000000000000000000000000000000000000000000";
            paymentSetting.Merchant.NotifyUrl = new Uri("http://yourwebsite.com/Notify.aspx");

            paymentSetting.Order.Amount  = 0.01;
            paymentSetting.Order.Id      = "93";
            paymentSetting.Order.Subject = "测测看";

            paymentSetting.Payment();
        }
Exemple #4
0
        public JsonResult CreateOrder(GatewayType gatewayType)
        {
            var gateway        = gateways.Get(gatewayType, GatewayTradeType.APP);
            var paymentSetting = new PaymentSetting(gateway);

            paymentSetting.Order = new Order()
            {
                OrderAmount = 0.01,
                OrderNo     = DateTime.Now.ToString("yyyyMMddhhmmss"),
                Subject     = "AppPayment",
                PaymentDate = DateTime.Now
            };
            return(Json(paymentSetting.Payment()));
        }
Exemple #5
0
        /// <summary>
        /// 创建微信的支付订单
        /// </summary>
        private void CreateWeChatPayOrder()
        {
            PaymentSetting paymentSetting = new PaymentSetting(GatewayType.WeChatPay);

            paymentSetting.SetGatewayParameterValue("appid", "wx000000000000000");
            paymentSetting.Merchant.UserName  = "******";
            paymentSetting.Merchant.Key       = "000000000000000000000000000000000000000000";
            paymentSetting.Merchant.NotifyUrl = new Uri("http://yourwebsite.com/Notify.aspx");

            paymentSetting.Order.Amount  = 0.01;
            paymentSetting.Order.Id      = "31";
            paymentSetting.Order.Subject = "测测看微信";

            paymentSetting.Payment();
        }
Exemple #6
0
        /// <summary>
        /// 创建支付宝的支付订单
        /// </summary>
        private void CreateAlipayOrder()
        {
            PaymentSetting paymentSetting = new PaymentSetting(GatewayType.Alipay);

            paymentSetting.SetGatewayParameterValue("seller_email", "*****@*****.**");
            paymentSetting.Merchant.UserName  = "******";
            paymentSetting.Merchant.Key       = "000000000000000000000000000000000000000000";
            paymentSetting.Merchant.NotifyUrl = new Uri("http://yourwebsite.com/Notify.aspx");

            paymentSetting.Order.Amount  = 0.01;
            paymentSetting.Order.Id      = "35";
            paymentSetting.Order.Subject = "测测看支付宝";

            paymentSetting.Payment();
        }
        private void CreateTenpayOrder()
        {
            var            gateway        = new TenpayGateway();
            PaymentSetting paymentSetting = new PaymentSetting(gateway);

            //paymentSetting.Merchant.UserName = "******";
            //paymentSetting.Merchant.Key = "000000000000000000000000000000000000000000";
            //paymentSetting.Merchant.NotifyUrl = new Uri("http://yourwebsite.com/Notify.aspx");

            paymentSetting.Order.Amount     = 0.01;
            paymentSetting.Order.OutTradeNo = "93";
            paymentSetting.Order.Body       = "测测看";

            paymentSetting.Payment();
        }
        public void CreateOrder(GatewayType gatewayType)
        {
            PaymentSetting paymentSetting = new PaymentSetting(gatewayType);

            paymentSetting.Merchant.AppId     = "appid000000000000000";
            paymentSetting.Merchant.Email     = "*****@*****.**";
            paymentSetting.Merchant.Partner   = "000000000000000";
            paymentSetting.Merchant.Key       = "000000000000000000000000000000000000000000";
            paymentSetting.Merchant.NotifyUrl = new Uri("http://yourwebsite.com/Notify.aspx");
            paymentSetting.Merchant.ReturnUrl = new Uri("http://yourwebsite.com/Return.aspx");

            paymentSetting.Order.OrderAmount = 0.01;
            paymentSetting.Order.OrderNo     = "35";
            paymentSetting.Order.Subject     = "WebPayment";
            paymentSetting.Payment();
        }
        /// <summary>
        /// 创建二维码订单
        /// </summary>
        /// <param name="gatewayType">支付网关类型</param>
        public void CreateOrder(GatewayType gatewayType)
        {
            //通过网关类型,交易类型获取网关
            var gateway = gateways.Get(gatewayType, GatewayTradeType.QRCode);
            //设置需要支付的订单的数据,创建支付订单URL地址或HTML表单
            var paymentSetting = new PaymentSetting(gateway);

            paymentSetting.Order = new Order()
            {
                OrderAmount = 0.01,                                    //订单总金额
                OrderNo     = DateTime.Now.ToString("yyyyMMddhhmmss"), //订单编号
                Subject     = "QRCodePayment",                         //订单主题
                PaymentDate = DateTime.Now                             //订单支付时间
            };
            paymentSetting.Payment();
        }
        /// <summary>
        /// 创建微信的支付订单
        /// </summary>
        private string CreateWechatpayOrder()
        {
            var order = new Wechatpay.Order()
            {
                Amount     = 0.01,
                OutTradeNo = "35",
                Body       = "测测看微信支付",
            };

            var gateway = gatewayList.GetGateway(GatewayType.Wechatpay);

            gateway.GatewayTradeType = GatewayTradeType.App;

            PaymentSetting paymentSetting = new PaymentSetting(gateway, order);

            return(paymentSetting.Payment());
        }
Exemple #11
0
        /// <summary>
        /// 创建易宝的支付订单
        /// </summary>
        private void CreateYeepayOrder()
        {
            PaymentSetting paymentSetting = new PaymentSetting(GatewayType.Yeepay);

            paymentSetting.Merchant = new Merchant
            {
                UserName  = "******",                              // 商户编号
                Key       = "000000000000000000000000000000000000000000",   // 商户密钥
                NotifyUrl = new Uri("http://yourwebsite.com/Notify")
            };

            paymentSetting.Order = new Order
            {
                Amount  = 0.01,
                Id      = "24",
                Subject = "测试易宝"
            };

            paymentSetting.Payment();
        }
Exemple #12
0
        /// <summary>
        /// 创建微信的支付订单
        /// </summary>
        private void CreateWeChatPayOrder()
        {
            PaymentSetting paymentSetting = new PaymentSetting(GatewayType.WeChatPay);

            paymentSetting.Merchant = new WeChatPayMerchant                   // 微信支付需要额外的 AppId 参数,这里需要使用继承自 Merchant 的 WeChatPayMerchant。
            {
                AppId     = "wx000000000000000",                              // 公众号APPID
                UserName  = "******",                                // 微信支付商户号
                Key       = "000000000000000000000000000000000000000000",     // API密钥
                NotifyUrl = new Uri("http://yourwebsite.com/Notify")
            };

            paymentSetting.Order = new Order
            {
                Amount  = 0.01,
                Id      = "31",
                Subject = "测试微信"
            };

            paymentSetting.Payment();
        }
Exemple #13
0
        /// <summary>
        /// 创建支付宝的支付订单
        /// </summary>
        private void CreateAlipayOrder()
        {
            PaymentSetting paymentSetting = new PaymentSetting(GatewayType.Alipay);

            paymentSetting.Merchant = new AlipayMerchant                    // 支付宝需要额外的 SellerEmail 参数,这里需要使用继承自 Merchant 的 AlipayMerchant。
            {
                SellerEmail = "*****@*****.**",                       // 支付宝的注册邮箱
                UserName    = "******",                            // 合作伙伴身份(PID)
                Key         = "000000000000000000000000000000000000000000", // MD5密钥
                NotifyUrl   = new Uri("http://yourwebsite.com/Notify")
            };

            paymentSetting.Order = new Order
            {
                Amount  = 0.01,
                Id      = "35",
                Subject = "测试支付宝"
            };

            paymentSetting.Payment();
        }