public static string MakePreAliPayOrder(string companyId, PreAliPayOrderModel model) { try { AliPayApiConfig config = AliPayApiConfigServices.QueryAliPayConfig(companyId); if (config == null) { throw new MyException("获取支付宝配置失败"); } string aliPayNotifyUrl = string.Format("{0}/AliPayNotify", config.SystemDomain); AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest(); request.BizContent = JsonHelper.GetJsonString(model); request.SetNotifyUrl(aliPayNotifyUrl); AlipayTradePrecreateResponse response = GetDefaultAopClient(companyId).Execute(request); if (response.IsError) { TxtLogServices.WriteTxtLogEx("AliPayApiServices", string.Format("预下单失败:{0}", response.Body)); return(""); } return(response.QrCode); } catch (Exception ex) { TxtLogServices.WriteTxtLogEx("AliPayApiServices", string.Format("预下单失败:{0}", ex.Message)); } return(""); }
public static string MakeWapPayOrder(string companyId, PreAliPayOrderModel model, string returnUrl, string notifyUrl) { try { AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); request.BizContent = JsonHelper.GetJsonString(model); request.SetNotifyUrl(notifyUrl); request.SetReturnUrl(returnUrl); AlipayTradeWapPayResponse response = GetDefaultAopClient(companyId).pageExecute(request); if (response.IsError) { TxtLogServices.WriteTxtLogEx("AliPayApiServices", string.Format("wap网站支付失败:{0}", response.Body)); return(""); } return(response.Body); } catch (Exception ex) { TxtLogServices.WriteTxtLogEx("AliPayApiServices", string.Format("网站支付失败:{0}", ex.Message)); } return(""); }