/// <summary> /// 订单支付 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void pay_Click(object sender, EventArgs e) { Log.Info(this.GetType().ToString(), "============支付请求开始========="); //易票联网关支付地址 //1、获取商品信息参数----------------------------- string currencyType = T_currencyType.Text; string totalFee = T_amount.Text; string remark = T_remark.Text; //2、生成订单流水号------------------------------- string outTradeNo = DateTime.Now.Ticks + ""; System.Diagnostics.Debug.Write(outTradeNo); //3、实例化支付请求实体类,并设置需要的参数-------- PayCenterData data = new PayCenterData(); data.SetValue("partner", Resource.PARTNER); data.SetValue("out_trade_no", outTradeNo); data.SetValue("total_fee", totalFee); data.SetValue("currency_type", currencyType); data.SetValue("return_url", "http://172.20.16.194/Paycenter_sdk/PayResponse.aspx"); data.SetValue("notify_url", "http://172.20.16.194/Paycenter_sdk/Paycenter_sdk/NotifyPayResponse.aspx"); data.SetValue("submission_type", "00"); //中文要base64转码 data.SetValue("base64_memo", Convert.ToBase64String(Encoding.Default.GetBytes(remark))); //data.SetValue("notify_url","zhaohang");//直连招商银行 //4、传递参数调用sdk发起支付请求 PaycenterService ps = new PaycenterService(); ps.paycenterPayRequest(data, Response); }
/// <summary> /// 海关电子订单支付 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void customsPay_Click(object sender, EventArgs e) { Log.Info(this.GetType().ToString(), "============海关支付请求开始========="); //易票联网关支付地址 //1、获取商品信息参数----------------------------- string currencyType = Tc_currencyType.Text; string totalFee = Tc_amount.Text; string remark = Tc_remark.Text; string goodsAmount = T_goodsAmount.Text; string goodsAmountCurr = T_goodsAmountCurr.Text; string taxAmount = T_taxAmount.Text; string taxAmountCurr = T_taxAmountCurr.Text; string freight = T_freight.Text; string freightCurr = T_freightCurr.Text; string bankAccount = T_bankAccount.Text; string bankAccType = T_bankAccType.Text; string userId = T_userId.Text; string userName = T_userName.Text; string certType = T_cert_type.Text; string certNo = T_cert_no.Text; string userMobile = T_userMobile.Text; //2、生成订单流水号------------------------------- string outTradeNo = DateTime.Now.Ticks + ""; System.Diagnostics.Debug.Write(outTradeNo); //3、实例化支付请求实体类,并设置需要的参数-------- PayCenterData data = new PayCenterData(); data.SetValue("partner", Resource.PARTNER); data.SetValue("out_trade_no", outTradeNo); data.SetValue("total_fee", totalFee); data.SetValue("currency_type", currencyType); data.SetValue("return_url", "http://localhost:57212/PayResponse.aspx"); data.SetValue("notify_url", "http://localhost:57212/NotifyPayResponse.aspx"); //中文要base64转码 data.SetValue("base64_memo", Convert.ToBase64String(Encoding.Default.GetBytes(remark))); //海关电子网关支付特有参数 data.SetValue("submission_type", "01"); data.SetValue("goods_amount", goodsAmount); data.SetValue("goods_amount_curr", goodsAmountCurr); data.SetValue("tax_amount", taxAmount); data.SetValue("tax_amount_curr", taxAmountCurr); data.SetValue("freight", freight); data.SetValue("freight_curr", freightCurr); String userInfo = "bank_account=" + bankAccount + "&bank_acc_type=" + bankAccType + "&user_id=" + userId + "&user_name=" + userName + "&user_cert_type=" + certType + "&user_cert_no=" + certNo + "&user_mobile=" + userMobile;//根据接口文档中拼接base64_user_info //data.SetValue("notify_url","zhaohang");//直连招商银行 data.SetValue("base64_user_info", Convert.ToBase64String(Encoding.Default.GetBytes(userInfo))); //4、传递参数调用sdk发起支付请求 PaycenterService ps = new PaycenterService(); ps.paycenterPayRequest(data, Response); }
protected void order_query_Click(object sender, EventArgs e) { //----参数--由接入者实际接入时填写--- string outTradeNo = "1447208747438"; //设置商户交易流水号 //----参数end PaycenterService ps = new PaycenterService(); PayCenterData pd = ps.paycenterQueryOrder(outTradeNo); Log.Info(this.GetType().ToString(), "返回结果:" + pd.GetValue("resp_desc")); }
protected void refund_query_Click(object sender, EventArgs e) { //----参数--由接入者实际接入时填写--- string outTradeNo = "1447208747438"; //设置商户交易流水号 string outRefundNo = "TK144720874743802"; string refundId = "1988"; //----参数end PaycenterService ps = new PaycenterService(); PayCenterData pd = ps.paycenterRefundQuery(outTradeNo, refundId, outRefundNo); Log.Info(this.GetType().ToString(), "返回结果:" + pd.GetValue("resp_desc")); }
protected void refund_request_Click(object sender, EventArgs e) { //----参数--由接入者实际接入时填写--- string outTradeNo = "1447208747438"; //设置商户交易流水号 string outRefundNo = "TK144720874743802"; string totalAmount = "0.05"; string refundAmount = "0.01"; //----参数end PaycenterService ps = new PaycenterService(); PayCenterData pd = ps.paycenterRefundRequest(outTradeNo, outRefundNo, totalAmount, refundAmount); Log.Info(this.GetType().ToString(), "返回结果:" + pd.GetValue("resp_desc")); Log.Info(this.GetType().ToString(), "易票联退款流水号:" + pd.GetValue("refund_id")); }
protected void Page_Load(object sender, EventArgs e) { Log.Info(this.GetType().ToString(), "===========支付请求同步通知============"); PaycenterService ps = new PaycenterService(); PayCenterData data = ps.acceptResponse(Page); if ("1".Equals(data.GetValue("pay_result"))) { Label1.Text = "支付成功"; //支付成功业务处理 //支付成功业务处理 } else { //支付失败业务处理 //支付失败业务处理 Label1.Text = "支付失败"; } }
protected void Page_Load(object sender, EventArgs e) { Log.Info(this.GetType().ToString(), "===========支付请求异步通知============"); //调用sdk得到异步通知参数 PaycenterService ps = new PaycenterService(); PayCenterData data = ps.acceptNotifyResponse(Page); if ("1".Equals(data.GetValue("pay_result"))) { Log.Info(this.GetType().ToString(), "支付成功"); //支付成功业务处理 //支付成功业务处理 } else { Log.Info(this.GetType().ToString(), "支付失败"); //支付失败业务处理 //支付失败业务处理 } }