public async Task <IActionResult> H5Pay(WeChatPayH5PayViewModel viewModel)
        {
            var request = new WeChatPayUnifiedOrderRequest()
            {
                Body           = viewModel.Body,
                OutTradeNo     = viewModel.OutTradeNo,
                TotalFee       = viewModel.TotalFee,
                SpbillCreateIp = viewModel.SpbillCreateIp,
                NotifyUrl      = viewModel.NotifyUrl,
                TradeType      = viewModel.TradeType,
            };
            var response = await _client.ExecuteAsync(request);

            // mweb_url为拉起微信支付收银台的中间页面,可通过访问该url来拉起微信客户端,完成支付,mweb_url的有效期为5分钟。
            return(Redirect(response.MwebUrl));
        }
Exemple #2
0
        public async Task <IActionResult> H5Pay(WeChatPayH5PayViewModel viewModel)
        {
            var request = new WeChatPayUnifiedOrderRequest()
            {
                Body           = viewModel.Body,
                OutTradeNo     = viewModel.OutTradeNo,
                TotalFee       = viewModel.TotalFee,
                SpbillCreateIp = viewModel.SpbillCreateIp,
                NotifyUrl      = viewModel.NotifyUrl,
                TradeType      = viewModel.TradeType,
            };
            var response = await _client.ExecuteAsync(request);

            ViewData["response"] = response.Body;
            return(View());
        }
Exemple #3
0
        public async Task <IActionResult> H5Pay(WeChatPayH5PayViewModel viewModel)
        {
            var request = new WeChatPayUnifiedOrderRequest
            {
                Body           = viewModel.Body,
                OutTradeNo     = viewModel.OutTradeNo,
                TotalFee       = viewModel.TotalFee,
                SpBillCreateIp = viewModel.SpBillCreateIp,
                NotifyUrl      = viewModel.NotifyUrl,
                TradeType      = viewModel.TradeType
            };

            var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);

            // mweb_url为拉起微信支付收银台的中间页面,可通过访问该url来拉起微信客户端,完成支付,mweb_url的有效期为5分钟。
            ViewData["response"] = response.Body;
            return(View());
        }