Exemplo n.º 1
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();
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 查询微信的订单支付状态
        /// </summary>
        private void QueryWeChatPaymentOrder()
        {
            PaymentSetting querySetting = new PaymentSetting(GatewayType.WeChatPayment);
            querySetting.SetGatewayParameterValue("appid", "wx000000000000000");
            querySetting.Merchant.UserName = "******";
            querySetting.Merchant.Key = "0000000000000000000000000000000000000000";

            // 查询时需要设置订单的Id与金额,在查询结果中将会核对订单的Id与金额,如果不相符会返回查询失败。
            querySetting.Order.Id = "20";
            querySetting.Order.Amount = 0.01;

            if (querySetting.CanQueryNow && querySetting.QueryNow())
            {
                // 订单已支付
            }
        }