支付宝手机网站接口对接
2017-03-16 17:58
316 查看
手机网站支付接口,请参考支付宝官方文档:https://b.alipay.com/signing/productSet.htm?navKey=all
1.需要提供应用ID、应用私钥、支付宝公钥
2.代码实现:
下载官方SDK,并编译引用到项目中去。
初始化对象:private readonly IAopClient _client= new DefaultAopClient("https://openapi.alipay.com/gateway.do", "应用ID", "应用私钥", "json", "1.0", "签名类型", "支付宝公钥", "字符编码格式,支持GBK和UTF-8", false);
支付接口:
1>调用支付宝支付网关
View Code
1.需要提供应用ID、应用私钥、支付宝公钥
2.代码实现:
下载官方SDK,并编译引用到项目中去。
初始化对象:private readonly IAopClient _client= new DefaultAopClient("https://openapi.alipay.com/gateway.do", "应用ID", "应用私钥", "json", "1.0", "签名类型", "支付宝公钥", "字符编码格式,支持GBK和UTF-8", false);
支付接口:
1>调用支付宝支付网关
/// <summary> /// 查询订单在支付宝的状态 /// </summary> /// <param name="queryOrderRequest"></param> /// <returns></returns> private bool AlipayTradeWapQuery(订单查询实体 queryOrder) { var result = false; if (queryOrder == null) { Log.Error(this.GetType().ToString(), "查询数据不能为空"); return result; } Log.Info(this.GetType().ToString(), "AlipayTradeWapQuery Start......"); string responseText = string.Empty; try { #region 调用支付宝支付查询接口 AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); request.BizContent = "{" + " \"out_trade_no\":\"" + queryOrder.订单编号 + "\"," + " \"trade_no\":\"" + queryOrder.交易号 + "\"" + " }"; AlipayTradeQueryResponse response = _client.Execute(request); string tradeStatus = response.TradeStatus; responseText = tradeStatus; if (tradeStatus == "TRADE_SUCCESS" || tradeStatus == "TRADE_CLOSED" || tradeStatus == "TRADE_FINISHED") { //处理支付业务 result=true; Log.Info(this.GetType().ToString(), "支付成功"); } else { Log.Info(this.GetType().ToString(), "支付失败"); } #endregion } catch (Exception ex) { responseText = ex.Message; Log.Error(this.GetType().ToString(), "Exception: " + ex.Message); } Log.Debug(this.GetType().ToString(), string.Format("支付宝手机网站支付查询跟踪信息。GetForm:{0}", responseText); Log.Info(this.GetType().ToString(), "AlipayTradeWapQuery End......"); return result; }
View Code
相关文章推荐
- 自己动手搞定支付宝手机网站支付接口 FOR ECShop
- 支付宝手机网站支付接口API之C#版
- 支付宝接口开发-手机网站支付-沙箱测试
- 支付宝”电脑网站支付“接口对接
- 支付宝接口开发-手机网站支付-沙箱测试
- 支付宝支付-手机网站支付接口(H5手机站)
- 支付宝的手机网站支付接口的应用
- 4.PHP接入支付宝手机网站支付、移动支付接口
- 支付宝接口手机网站支付验证返回字符串以及签名验证不通过的原因总结
- 支付宝接口开发-手机网站支付-沙箱测试
- 呕心之作:支付宝的手机网站支付接口的应用
- .net蚂蚁金服支付宝手机网站支付接口记录
- 支付宝中的手机网站支付接口,php版 notify_url.php 异步通知页面未成功执行
- tp3.2 实现新支付宝支付接口 (手机网站支付)
- 支付宝手机网站支付接口集成的经验小结
- 呕心之作:支付宝的手机网站支付接口的应用
- 手机APP+PHP网站API+支付宝接口集成经验
- erdaicms旅游网站程序模板免费下载(PC站自带手机站,自带3套模板可切换,对接支付宝和微信支付)
- 支付宝——手机网站支付接口研究
- C#版支付宝手机网站支付接口API之