做任何商城类的项目都离不开支付这一环节,今天就记录一下在开发微信H5支付时的开发过程

在开发到订单这部分模块的时候终于遇到了微信开发第二个难题,微信支付!

首先请阅读 微信JSAPI支付文档  和 微信统一下单API 了解场景和参数

微信支付需要有 微信公众平台 和 微信商户平台 账号

在微信商户平台配置 API秘钥

配置 JSAPI域名

配置完这些之后 开始写 WechatHelper 所用到的类

目录

Data 用来存放需要用到的参数

 public class WxPayData{public WxPayData(){}//采用排序的Dictionary的好处是方便对数据包进行签名,不用再签名之前再做一次排序private SortedDictionary<string, object> m_values = new SortedDictionary<string, object>();/*** 设置某个字段的值* @param key 字段名* @param value 字段值*/public void SetValue(string key, object value){m_values[key] = value;}/*** 根据字段名获取某个字段的值* @param key 字段名* @return key对应的字段值*/public object GetValue(string key){object o = null;m_values.TryGetValue(key, out o);return o;}/*** 判断某个字段是否已设置* @param key 字段名* @return 若字段key已被设置,则返回true,否则返回false*/public bool IsSet(string key){object o = null;m_values.TryGetValue(key, out o);if (null != o)return true;elsereturn false;}/*** @将Dictionary转成xml* @return 经转换得到的xml串* @throws WxPayException**/public string ToXml(){//数据为空时不能转化为xml格式if (0 == m_values.Count){throw new WxPayException("WxPayData数据为空!");}string xml = "<xml>";foreach (KeyValuePair<string, object> pair in m_values){//字段值不能为null,会影响后续流程if (pair.Value == null){throw new WxPayException("WxPayData内部含有值为null的字段!");}if (pair.Value.GetType() == typeof(int)){xml += "<" + pair.Key + ">" + pair.Value + "</" + pair.Key + ">";}else if (pair.Value.GetType() == typeof(string)){xml += "<" + pair.Key + ">" + "<![CDATA[" + pair.Value + "]]></" + pair.Key + ">";}else//除了string和int类型不能含有其他数据类型{throw new WxPayException("WxPayData字段数据类型错误!");}}xml += "</xml>";return xml;}/*** @将xml转为WxPayData对象并返回对象内部的数据* @param string 待转换的xml串* @return 经转换得到的Dictionary* @throws WxPayException*/public SortedDictionary<string, object> FromXml(string xml){if (string.IsNullOrEmpty(xml)){throw new WxPayException("将空的xml串转换为WxPayData不合法!");}XmlDocument xmlDoc = new Xml.XmlDocument_XxeFixed();xmlDoc.LoadXml(xml);XmlNode xmlNode = xmlDoc.FirstChild;//获取到根节点<xml>XmlNodeList nodes = xmlNode.ChildNodes;foreach (XmlNode xn in nodes){XmlElement xe = (XmlElement)xn;m_values[xe.Name] = xe.InnerText;//获取xml的键值对到WxPayData内部的数据中}try{//2015-06-29 错误是没有签名if (m_values["return_code"].ToString() != "SUCCESS"){return m_values;}CheckSign();//验证签名,不通过会抛异常}catch (WxPayException ex){throw new WxPayException(ex.Message);}return m_values;}/*** @Dictionary格式转化成url参数格式* @ return url格式串, 该串不包含sign字段值*/public string ToUrl(){string buff = "";foreach (KeyValuePair<string, object> pair in m_values){if (pair.Value == null){throw new WxPayException("WxPayData内部含有值为null的字段!");}if (pair.Key != "sign" && pair.Value.ToString() != ""){buff += pair.Key + "=" + pair.Value + "&";}}buff = buff.Trim('&');return buff;}/*** @Dictionary格式化成Json* @return json串数据*/public string ToJson(){//  string jsonStr = JsonMapper.ToJson(m_values);return "";}/*** @values格式化成能在Web页面上显示的结果(因为web页面上不能直接输出xml格式的字符串)*/public string ToPrintStr(){string str = "";foreach (KeyValuePair<string, object> pair in m_values){if (pair.Value == null){throw new WxPayException("WxPayData内部含有值为null的字段!");}str += string.Format("{0}={1}<br>", pair.Key, pair.Value.ToString());}return str;}/*** @生成签名,详见签名生成算法* @return 签名, sign字段不参加签名*/public string MakeSign(){//转url格式string str = ToUrl();//在string后加入API KEYstr += "&key=" + WechatConfig.Key;//MD5加密var md5 = MD5.Create();var bs = md5.ComputeHash(Encoding.UTF8.GetBytes(str));var sb = new StringBuilder();foreach (byte b in bs){sb.Append(b.ToString("x2"));}//所有字符转为大写return sb.ToString().ToUpper();}/*** * 检测签名是否正确* 正确返回true,错误抛异常*/public bool CheckSign(){//如果没有设置签名,则跳过检测if (!IsSet("sign")){throw new WxPayException("WxPayData签名存在但不合法!");}//如果设置了签名但是签名为空,则抛异常else if (GetValue("sign") == null || GetValue("sign").ToString() == ""){throw new WxPayException("WxPayData签名存在但不合法!");}//获取接收到的签名string return_sign = GetValue("sign").ToString();//在本地计算新的签名string cal_sign = MakeSign();if (cal_sign == return_sign){return true;}throw new WxPayException("WxPayData签名验证错误!");}/*** @获取Dictionary*/public SortedDictionary<string, object> GetValues(){return m_values;}}

Exception

public class WxPayException : Exception{public WxPayException(string msg) : base(msg){}}

HttpService

用于发送请求,访问微信统一下单API 和 查询订单接口

public class HttpService{public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors){return true;}public static string Post(string xml, string url, bool isUseCert, int timeout){GC.Collect();//垃圾回收,回收没有正常关闭的http连接string result = "";//返回结果HttpWebRequest request = null;HttpWebResponse response = null;Stream reqStream = null;try{//设置最大连接数ServicePointManager.DefaultConnectionLimit = 200;//设置https验证方式if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)){ServicePointManager.ServerCertificateValidationCallback =new RemoteCertificateValidationCallback(CheckValidationResult);}/**************************************************************** 下面设置HttpWebRequest的相关属性* ************************************************************/request = (HttpWebRequest)WebRequest.Create(url);request.Method = "POST";request.Timeout = timeout * 1000;//设置代理服务器//WebProxy proxy = new WebProxy();                          //定义一个网关对象//proxy.Address = new Uri(WxPayConfig.PROXY_URL);              //网关服务器端口:端口//request.Proxy = proxy;//设置POST的数据类型和长度request.ContentType = "text/xml";byte[] data = Encoding.UTF8.GetBytes(xml);request.ContentLength = data.Length;是否使用证书//if (isUseCert)//{//    string path = HttpContext.Current.Request.PhysicalApplicationPath;//    X509Certificate2 cert = new X509Certificate2(path + WxPayConfig.SSLCERT_PATH, WxPayConfig.SSLCERT_PASSWORD);//    request.ClientCertificates.Add(cert);//}//往服务器写入数据reqStream = request.GetRequestStream();reqStream.Write(data, 0, data.Length);reqStream.Close();//获取服务端返回response = (HttpWebResponse)request.GetResponse();//获取服务端返回数据StreamReader sr = new StreamReader(response.GetResponseStream(), Encoding.UTF8);result = sr.ReadToEnd().Trim();sr.Close();}catch (System.Threading.ThreadAbortException e){System.Threading.Thread.ResetAbort();}catch (WebException e){throw new WxPayException(e.ToString());}catch (Exception e){throw new WxPayException(e.ToString());}finally{//关闭连接和流if (response != null){response.Close();}if (request != null){request.Abort();}}return result;}}

WechatConfig 微信支付统一下单所用到的参数 会读取 /App_Data/xml/payment.xml 文件里面的内容

appid:微信公众平台的开发者ID(AppID)

mchid:微信商户平台账号

key:在微信商户平台设置的API密钥

appsecret:在微信公众平台中设置的开发者密码(AppSecret)

ip:终端IP

notify_url:微信支付异步回调地址,在微信支付成功时会异步调用你的接口

gateway:微信支付统一下单API接口

queryorder:微信支付查询订单接口

sealed class WechatConfig{#region 字段static string appid = string.Empty;static string mchid = string.Empty;static string key = string.Empty;static string appsecret = string.Empty;static string notify_url = string.Empty;static string gateway = string.Empty;static string queryorder = string.Empty;#endregionstatic WechatConfig(){XmlDocument xml = new Xml.XmlDocument_XxeFixed();xml.XmlResolver = null;xml.Load(HttpContext.Current.Server.MapPath("/App_Data/xml/payment.xml"));var root = xml.SelectSingleNode("paymentMethod").ChildNodes;foreach (XmlNode xn in root){XmlElement xe = (XmlElement)xn;if (xe.GetAttribute("id") == "wechatpay"){appid = xe.GetAttribute("appid");mchid = xe.GetAttribute("mchid");key = xe.GetAttribute("key");appsecret = xe.GetAttribute("appsecret");notify_url = xe.GetAttribute("notify_url");gateway = xe.GetAttribute("gateway");queryorder = xe.GetAttribute("queryorder");break;}}}internal static string Gateway{get{return gateway;}}internal static string Appid{get{return appid;}}internal static string Mchid{get{return mchid;}}internal static string Appsecret{get{return appsecret;}}internal static string Key{get{return key;}}internal static string Queryorder{get{return queryorder;}}internal static string Notify_url{get{return notify_url;}}}

WechatHelper

在业务处理层调用 根据不同场景传入不同的参数,可用于一个项目多个支付场景

out_trade_no :商户支付的订单号由商户自定义生成,仅支持使用字母、数字、中划线-、下划线_、竖线|、星号*这些英文半角字符的组合,请勿使用汉字或全角等特殊字符。微信支付要求商户订单号保持唯一性(建议根据当前系统时间加随机序列来生成订单号)。重新发起一笔支付要使用原订单号,避免重复支付;已支付过或已调用关单、撤销的订单号不能重新发起支付。

total_fee:订单总金额,单位为分 这里在方法里对金额进行了处理 可直接传实际金额

attach:附加数据,在查询API和支付通知中原样返回,可作为自定义参数使用。用于区分不同的支付场景,在回调中可以根据此来调用不同的方法

body:商品简单描述

ip:终端ip

trade_type:交易类型 JSAPI -JSAPI支付  NATIVE -Native支付  APP -APP支付

openId:此参数为微信用户在商户对应appid下的唯一标识

public sealed class WechatHelper{#region JSAPI Pay/// <summary>/// JSAPI Pay/// </summary>/// <param name="out_trade_no">订单编号</param>/// <param name="total_fee">价格</param>/// <param name="attach">自定义参数,回调回传</param>/// <returns></returns>public static ResultModel JSApiPay(string out_trade_no, decimal total_fee, string openid, string ip, string attach = "", string body = "购买商品"){WxPayData result = Pay(out_trade_no, total_fee, attach, body, ip, "JSAPI", openid);string return_code = result.GetValue("return_code").ToString();//返回状态码  SUCCESS/FAIL string result_code = result.GetValue("result_code").ToString();//返回状态码  SUCCESS/FAIL if (return_code == "SUCCESS" && result_code == "SUCCESS"){//  string url = result.GetValue("prepay_id").ToString();//预付款订单prepay_idResultModel rm = new ResultModel();rm.appId = WechatConfig.Appid;rm.timeStamp = WxPayApi.GenerateTimeStamp();rm.nonceStr = result.GetValue("nonce_str").ToString();rm.package = "prepay_id=" + result.GetValue("prepay_id").ToString();//设置支付参数var paySignReqHandler = new RequestHandler(null);paySignReqHandler.SetParameter("appId", rm.appId);paySignReqHandler.SetParameter("timeStamp", rm.timeStamp);paySignReqHandler.SetParameter("nonceStr", rm.nonceStr);paySignReqHandler.SetParameter("package", rm.package);paySignReqHandler.SetParameter("signType", "MD5");var paySign = paySignReqHandler.CreateMd5Sign("key", WechatConfig.Key);rm.paySign = paySign;return rm;}return null;}#endregionpublic static WxPayData Pay(string out_trade_no, decimal total_fee, string attach, string body, string ip, string trade_type, string openId = ""){var paymoney = Convert.ToInt32(total_fee * 100);WxPayData data = new WxPayData();data.SetValue("body", body);//商品描述data.SetValue("attach", attach);//附加数据,回调返回data.SetValue("out_trade_no", out_trade_no);//订单编号data.SetValue("total_fee", paymoney.ToString());//总金额data.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));//交易起始时间data.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));//交易结束时间data.SetValue("goods_tag", "");//商品标记,订单优惠标记,使用代金券或立减优惠功能时需要的参数data.SetValue("trade_type", trade_type);//交易类型if (trade_type == "JSAPI"){data.SetValue("openid", openId);//openId}data.SetValue("product_id", out_trade_no);//商品IDreturn WxPayApi.UnifiedOrder(data, ip);//调用统一下单接口}public static WxPayData GetNotifyData(Stream InputStream){//接收从微信后台POST过来的数据Stream s = InputStream;int count = 0;byte[] buffer = new byte[1024];StringBuilder builder = new StringBuilder();while ((count = s.Read(buffer, 0, 1024)) > 0){builder.Append(Encoding.UTF8.GetString(buffer, 0, count));}s.Flush();s.Close();s.Dispose();//转换数据格式并验证签名WxPayData data = new WxPayData();try{data.FromXml(builder.ToString());}catch (WxPayException ex){//若签名错误,则立即返回结果给微信支付后台WxPayData res = new WxPayData();res.SetValue("return_code", "FAIL");res.SetValue("return_msg", ex.Message);}return data;}//查询订单public static bool QueryOrder(string transaction_id){WxPayData req = new WxPayData();req.SetValue("transaction_id", transaction_id);WxPayData res = WxPayApi.OrderQuery(req);if (res.GetValue("return_code").ToString() == "SUCCESS" &&res.GetValue("result_code").ToString() == "SUCCESS"){return true;}else{return false;}}}public class ResultModel{public string appId { get; set; }public string timeStamp { get; set; }public string nonceStr { get; set; }public string package { get; set; }public string paySign { get; set; }}

WxPayApi

在wechathelper中拿到业务参数之后到wxpayapi中加入固定参数

public class WxPayApi{/*** * 统一下单* @param WxPaydata inputObj 提交给统一下单API的参数* @param int timeOut 超时时间* @throws WxPayException* @return 成功时返回,其他抛异常*/public static WxPayData UnifiedOrder(WxPayData inputObj,string ip, int timeOut = 6){//检测必填参数if (!inputObj.IsSet("out_trade_no")){throw new WxPayException("缺少统一支付接口必填参数out_trade_no!");}else if (!inputObj.IsSet("body")){throw new WxPayException("缺少统一支付接口必填参数body!");}else if (!inputObj.IsSet("total_fee")){throw new WxPayException("缺少统一支付接口必填参数total_fee!");}else if (!inputObj.IsSet("trade_type")){throw new WxPayException("缺少统一支付接口必填参数trade_type!");}//关联参数if (inputObj.GetValue("trade_type").ToString() == "JSAPI" && !inputObj.IsSet("openid")){throw new WxPayException("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!");}if (inputObj.GetValue("trade_type").ToString() == "NATIVE" && !inputObj.IsSet("product_id")){throw new WxPayException("统一支付接口中,缺少必填参数product_id!trade_type为JSAPI时,product_id为必填参数!");}inputObj.SetValue("notify_url", WechatConfig.Notify_url);//异步通知urlinputObj.SetValue("appid", WechatConfig.Appid);//公众账号IDinputObj.SetValue("mch_id", WechatConfig.Mchid);//商户号inputObj.SetValue("spbill_create_ip", ip);//终端ip              inputObj.SetValue("nonce_str", GenerateNonceStr());//随机字符串//签名inputObj.SetValue("sign", inputObj.MakeSign());string xml = inputObj.ToXml();string response = HttpService.Post(xml, WechatConfig.Gateway, false, timeOut);WxPayData result = new WxPayData();result.FromXml(response);//ReportCostTime(url, timeCost, result);//测速上报return result;}/*** 生成时间戳,标准北京时间,时区为东八区,自1970年1月1日 0点0分0秒以来的秒数* @return 时间戳*/public static string GenerateTimeStamp(){TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);return Convert.ToInt64(ts.TotalSeconds).ToString();}/*** 生成随机串,随机串包含字母或数字* @return 随机串*/public static string GenerateNonceStr(){return Guid.NewGuid().ToString().Replace("-", "");}/***    * 查询订单* @param WxPayData inputObj 提交给查询订单API的参数* @param int timeOut 超时时间* @throws WxPayException* @return 成功时返回订单查询结果,其他抛异常*/public static WxPayData OrderQuery(WxPayData inputObj, int timeOut = 6){string url = "https://api.mch.weixin.qq.com/pay/orderquery";inputObj.SetValue("appid", WechatConfig.Appid);//公众账号IDinputObj.SetValue("mch_id", WechatConfig.Mchid);//商户号inputObj.SetValue("nonce_str",GenerateNonceStr());//随机字符串inputObj.SetValue("sign", inputObj.MakeSign());//签名string xml = inputObj.ToXml();var start = DateTime.Now;string response = HttpService.Post(xml, url, false, timeOut);//调用HTTP通信接口提交数据var end = DateTime.Now;int timeCost = (int)((end - start).TotalMilliseconds);//获得接口耗时//将xml格式的数据转化为对象以返回WxPayData result = new WxPayData();result.FromXml(response);// ReportCostTime(url, timeCost, result);//测速上报return result;}/**** 订单查询完整业务流程逻辑* @param transaction_id 微信订单号(优先使用)* @param out_trade_no 商户订单号* @return 订单查询结果(xml格式)*/public static WxPayData Run(string transaction_id, string out_trade_no){WxPayData data = new WxPayData();if (!string.IsNullOrEmpty(transaction_id))//如果微信订单号存在,则以微信订单号为准{data.SetValue("transaction_id", transaction_id);}else//微信订单号不存在,才根据商户订单号去查单{data.SetValue("out_trade_no", out_trade_no);}WxPayData result = OrderQuery(data);//提交订单查询请求给API,接收返回数据return result;}}

这样一个完整的wechathelper类就搭建完成了

创建xml配置文件 payment.xml

<?xml version="1.0" encoding="utf-8" ?>
<paymentMethod><infoid="wechatpay"appid=""mchid=""key=""appsecret=""ip=""notify_url="http://xxx/pay/WechatNotify"gateway="https://api.mch.weixin.qq.com/pay/unifiedorder"queryorder="https://api.mch.weixin.qq.com/pay/orderquery" />
</paymentMethod>

在控制器中创建 WechatHelper 调用JSApiPay方法

public ActionResult PayView(){WechatHelper wechatPay = new WechatHelper();var pay = wechatPay.JSApiPay(OrderNum, Price, WxOpenId, "ip", "5");var jssdkUiPackage = JSSDKHelper.GetJsSdkUiPackage(APPID, SECRET), Request.Url.AbsoluteUri);ViewBag.JssdkUiPackage = jssdkUiPackage;ViewBag.uid = user.Id;ViewBag.orderNum = order.OrderNum;JsSdkUiPackage jup = jssdkUiPackage as JsSdkUiPackage;return View(pay);
}

创建支付页面

@{var jssdk = ViewBag.JssdkUiPackage as Senparc.Weixin.MP.Helpers.JsSdkUiPackage;var uid = ViewBag.uid;var ordernum = ViewBag.orderNum;
}<!DOCTYPE html>
<html>
<head><meta name="viewport" content="width=device-width" /><title>微信支付</title>
</head>
<body><input type="hidden" id="appid" value="@Model.appId" /><input type="hidden" id="timestamp" value="@Model.timeStamp" /><input type="hidden" id="nonceStr" value="@Model.nonceStr" /><input type="hidden" id="signature" value="@Model.paySign" /><input type="hidden" id="wxpackage" value="@Model.package" /><input type="hidden" id="uid" value="@uid" /><input type="hidden" id="_timestamp" value="@jssdk.Timestamp" /><input type="hidden" id="_nonceStr" value="@jssdk.NonceStr" /><input type="hidden" id="_signature" value="@jssdk.Signature" /><input type="hidden" id="ordernum" value="@ordernum" /><input type="hidden" id="types" value="1" /><script src="~/scripts/plug/jquery-1.9.1.min.js"></script><script src="~/scripts/plug/jweixin-1.2.0.js"></script><script src="~/scripts/plug/wechatpay.js"></script>
</body>
</html>wechatpay.jsvar appid = $("#appid").val();
var timestamp = $("#timestamp").val();
var nonceStr = $("#nonceStr").val();
var signature = $("#signature").val();
var wxpackage = $("#wxpackage").val();
var uid = $("#uid").val();
var _timestamp = $("#_timestamp").val();
var _nonceStr = $("#_nonceStr").val();
var _signature = $("#_signature").val();var types = $("#types").val();wx.config({debug: false,appId: appid, // 公众号的唯一标识timestamp: _timestamp, //生成签名的时间戳nonceStr: _nonceStr, // 生成签名的随机串signature: _signature,// 签名jsApiList: ['chooseWXPay', 'translateVoice']
});wx.ready(function () {wx.chooseWXPay({timestamp: timestamp,nonceStr: nonceStr,package: wxpackage,signType: 'MD5',paySign: signature,success: function (res) {if (res.errMsg == "chooseWXPay:ok") {window.location.href = "/pay/Pay_Success";} else {window.location.href = "/pay/Pay_Error";}},fail: function (res) {window.location.href = "/pay/Pay_Error";},cancel: function (res) {window.location.href = "/pay/Pay_Error";}});
});

微信支付异步回调

这里就是支付成功之后微信异步回调的接口方法

参数可以参考 微信API文档  支付结果通知

 #region 微信支付异步回调[HttpPost][Transaction]public ActionResult WechatNotify(){try{WechatHelper wechatPay = new WechatHelper();WxPayData notifyData = wechatPay.GetNotifyData(Request.InputStream);string attach = notifyData.GetValue("attach").ToString();string transaction_id = notifyData.GetValue("transaction_id").ToString();if (!notifyData.IsSet("transaction_id")){log("回调return_msg=支付结果中微信订单号不存在", "wechatpayer");}if (!wechatPay.QueryOrder(transaction_id)){log("回调return_msg=订单查询失败", "wechatpayer");}else{log("回调return_msg=OK", "wechatpayer");}var payxml = XDocument.Parse(notifyData.ToXml());if (payxml.Element("xml").Element("return_code").Value == "SUCCESS"){if (payxml.Element("xml").Element("result_code").Value == "SUCCESS"){string out_trade_no = payxml.Element("xml").Element("out_trade_no").Value;}return Content("<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[交易失败]]></return_msg></xml>");}return Content("<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[交易失败]]></return_msg></xml>");}catch (Exception ex){log(ex.ToString(), "wechatpayer");return Content("<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[交易失败]]></return_msg></xml>");}}#endregion

这样就完成了在微信H5中唤起微信支付 并且通过异步回调 完成一些业务

边记录边学习 欢迎各位一起探讨

Asp.net 微信H5唤起支付和支付回调相关推荐

  1. 如何在微信h5拉起支付宝支付界面

    微信拉起支付宝支付会有一个中间页面跳转,具体操作步骤如下: 1.中间页引导用户在浏览器中打开去唤起支付宝. 2.浏览器中打开支付宝或app中打开支付宝. 3.唤起成功后,进行支付宝支付:支付成功.支付 ...

  2. 【H5唤起微信“扫一扫”】舒工自定义微信H5唤起扫码Vue组件sg-scan.vue(扫码按钮大概是在底部),注意只是代码片段,不含微信鉴权业务流程

    <!--强哥的自定义组件:H5唤起微信"扫一扫"--> <template><div class="sg-scan" :up=&q ...

  3. 企业微信H5唤起(打开)微信小程序

    1.登录企业微信管理后台(https://work.weixin.qq.com/wework_admin/frame) 2.获取企业ID,我的企业>企业信息>企业ID(ww28b3c6e7 ...

  4. html5 移动微信支付,H5唤起移动支付方法(支付宝、微信支付、银联支付) · Yumiko’s Blog...

    8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? 最近开发的项目中涉及到了移动支付的模块,主要是支付宝.微信支付和银联支付. 下面总结一下H5唤起这些移动支付平台的方法. ...

  5. 微信h5支付,支付宝h5支付 详细流程

    一.微信h5支付 1.效验是否是微信浏览器 var uAgent = window.navigator.userAgent; if (uAgent.indexOf("MicroMesseng ...

  6. h5唤醒微信支付PHP,app内嵌微信h5支付,支付服务唤起支付处理

    app内发起支付,报错net::ERR_UNKNOWN_URL_SCHEME 出错原因:在调微信 H5 支付https://wx.tenpay.com/cgi-bin/mmpayweb-bin/che ...

  7. h5唤起支付(微信和支付宝)

    h5调用微信支付 // 微信支付weChatPay(data){var vm= this;//下面是解决WeixinJSBridge is not defined 报错的方法if (typeof We ...

  8. app 访问h5 如何截取_微信H5支付申请相关问题

    之前的文章「微信支付申请相关问题」里说过微信公众号和 APP 申请微信支付,今天来说下微信 H5 支付的申请. 背景介绍 H5 支付是指商户在微信客户端外的移动端网页展示商品或服务,用户在前述页面确认 ...

  9. vue 微信公众号支付接口_基于vue的h5项目之支付宝支付与微信支付

    本文仅记录基于vue开发h5项目过程中使用支付宝和微信支付过程中的重点与槽点,仅为前端部分,如有疏漏不正之处,请于文末评论探讨.注意:标红部分灰常重要,仔细阅读官方文档非常重要,耐心非常重要,细心非常 ...

最新文章

  1. codeup:问题 D: 最短路径
  2. asp.net FileUpload上传文件
  3. 原创:谈谈12306铁路客运售票系统的架构问题(二)
  4. golang刷Leetcode系列 --- 加1
  5. 为什么要与下属建立良好的人际关系?
  6. 从零开始写项目第八篇【将未完成的项目发布在Tomcat上】
  7. 2复数与复变函数(二)
  8. Qt C++ QSerialPortInfo的测试
  9. python抓包与解包_python 抓包与解包
  10. 很高兴向大家推荐《jBPM4工作流应用开发指南》这本书
  11. 软考程序员资源免费分享
  12. JVM相关知识——内存分布和垃圾回收机制
  13. 安卓版文件转换器如何使用?
  14. ImageLoader----内存缓存
  15. 杭电多校(MINIEYE)第四场 补题
  16. NFC Antenna Tool,便捷的 NFC 电路 和 NFC 线圈设计工具
  17. 数据库查询语句遇到:Unknown column 'XXXX' in 'where clause'解决方法
  18. 各类文件头及其十六进制标识
  19. Memcached单键超1M数据量的拆分设计及测试
  20. ssm在线考试系统设计与实现(论文+程序设计+数据库文件)下载

热门文章

  1. 25、进程的挂起状态
  2. 马云和史玉柱到底谁说了谎?
  3. 2018慕尼黑上海电子展
  4. fastmmi(ffbm)
  5. 论无名合同及其法律适用
  6. CIH病毒破坏硬件原理与删除木马的100多种方法
  7. OpenCV 霍夫变换
  8. 国际c语言乱码大赛图片,国际C语言乱码大赛(IOCCC)经典之作
  9. 【AD】AD如何导出gerber文件给雕刻机软件
  10. 易语言python代码长短_怎样用易语言取网络文件长度源码