/// <summary> /// 开始支付,输出到页面wxJsApiParam /// 页面执行脚本调用微信 /// </summary> /// <param name="order"></param> /// <returns></returns> public string BeginPay(PayHistory order) { BaseSubmit(order); JsApiPay jsApiPay = new JsApiPay(System.Web.HttpContext.Current); jsApiPay.openid = order.TagData;//传入OPENID jsApiPay.total_fee = Convert.ToInt32(order.Amount * 100); //JSAPI支付预处理 WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(order); var wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 return wxJsApiParam; }
/// <summary> /// 开始支付,输出到页面wxJsApiParam /// 页面执行脚本调用微信 /// </summary> /// <param name="order"></param> /// <returns></returns> public string BeginPay(PayHistory order) { BaseSubmit(order); JsApiPay jsApiPay = new JsApiPay(System.Web.HttpContext.Current); jsApiPay.openid = order.TagData;//传入OPENID jsApiPay.total_fee = Convert.ToInt32(order.Amount * 100); //JSAPI支付预处理 WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(order); var wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 return(wxJsApiParam); }
/// <summary> /// 开始支付,输出到页面wxJsApiParam /// 页面执行脚本调用微信 /// </summary> /// <param name="order"></param> /// <param name="openId"></param> /// <returns></returns> public string BeginPay(PayHistory order, string openId) { BaseSubmit(order); JsApiPay jsApiPay = new JsApiPay(System.Web.HttpContext.Current); jsApiPay.openid = openId; if (string.IsNullOrEmpty(jsApiPay.openid)) { throw new Exception("openid为空,请传入 openId"); } jsApiPay.total_fee = Convert.ToInt32(order.Amount * 100); //JSAPI支付预处理 WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult(order); var wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数 return(wxJsApiParam); }