1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > C#(Winform)+H5(Html)微信/支付宝对接接口及前端支付页面

C#(Winform)+H5(Html)微信/支付宝对接接口及前端支付页面

时间:2020-12-16 10:38:28

相关推荐

C#(Winform)+H5(Html)微信/支付宝对接接口及前端支付页面

由于工作需要,开了一个C#(Winform)+H5(Html)的微信/支付宝对接接口,需要使用的小伙伴可通过链接进行下载,欢迎各位小伙伴交流探讨。

测试链接:/pay.html (必须用手机浏览器打开)

支付页面

后台服务

支付相关信息存储表

核心代码

[HttpPost]public PayResponse pay(PayRequest request){PayResponse response = new PayResponse();response.isSuccess = false;response.errorMsg = "";try{LogHelper.LogHelper.AddShowLog("Request:" + Serializer<PayRequest>(request));request = GetPayDefaultParam(request);decimal realMoney = request.amount;CreatePayRecord(request.pforder, request.amount, realMoney, request.rolename, request.roleid, request.serverid, request.payType);checkSing(request);string returnUrl = request.returnurl;string notifyUrl = request.notifyurl;string productInfo = "game";string orderId = request.pforder;decimal totalFee = realMoney;notifyUrl = System.Web.HttpUtility.UrlDecode(notifyUrl);returnUrl = System.Web.HttpUtility.UrlDecode(returnUrl);if (request.payType == 1){response.url = WxH5Service.GetRequestUrl(returnUrl,notifyUrl,orderId,totalFee,productInfo,request.mch_id,request.appid,request.appsecret);}else if (request.payType == 2){response.url = AliWAPService.GetRequestUrl(returnUrl,notifyUrl,orderId,totalFee,productInfo,request.appid,request.signkey,request.appsecret);}else{response.errorMsg = "不支持的支付方式" + request.payType;}if (data.ContainsKey(request.appid)){decimal amount = data[request.appid];amount += request.amount;data[request.appid] = amount;}else{data.Add(request.appid, request.amount);}string json = Serializer(data);File.WriteAllText(filePath, json);response.isSuccess = true;LogHelper.LogHelper.AddShowLog("Response:" + Serializer<PayResponse>(response));}catch (Exception ex){response.errorMsg = ex.Message;}response.sign = GetResponseSign(response);return response;}

源码文件清单

源码下载链接

/download/qq_27352959/15639776

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。