126 lines
5.7 KiB
C#
126 lines
5.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using System.Web.Script.Serialization;
|
|||
|
|
using System.Text;
|
|||
|
|
namespace Mtxfw.shop
|
|||
|
|
{
|
|||
|
|
public partial class alipay : System.Web.UI.Page
|
|||
|
|
{
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!IsPostBack)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
////////////////////////////////////////////请求参数////////////////////////////////////////////
|
|||
|
|
if (!String.IsNullOrEmpty(Request.QueryString["t"]) && !String.IsNullOrEmpty(Request.QueryString["oids"]) && !String.IsNullOrEmpty(Request.QueryString["amount"]))
|
|||
|
|
{
|
|||
|
|
string t = Request.QueryString["t"].ToString();
|
|||
|
|
string OIDs = Request.QueryString["oids"].ToString();
|
|||
|
|
string orderAmount = Request.QueryString["amount"].ToString();
|
|||
|
|
//支付类型
|
|||
|
|
string payment_type = "1";
|
|||
|
|
//必填,不能修改
|
|||
|
|
//服务器异步通知页面路径
|
|||
|
|
string notify_url = "http://shop.q-b.cc/pay/notify_url.aspx";
|
|||
|
|
//需http://格式的完整路径,不能加?id=123这类自定义参数
|
|||
|
|
|
|||
|
|
//页面跳转同步通知页面路径
|
|||
|
|
string return_url = "http://shop.q-b.cc/pay/return_url.aspx";
|
|||
|
|
//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
|
|||
|
|
|
|||
|
|
//卖家支付宝帐户
|
|||
|
|
string seller_email = "glqiaobao520@126.com";
|
|||
|
|
//必填
|
|||
|
|
|
|||
|
|
//商户订单号
|
|||
|
|
string out_trade_no = OIDs;
|
|||
|
|
//商户网站订单系统中唯一订单号,必填
|
|||
|
|
|
|||
|
|
//订单名称
|
|||
|
|
string subject = (t == "1" ? "购买商品付款" : "账户充值");
|
|||
|
|
//必填
|
|||
|
|
|
|||
|
|
//付款金额
|
|||
|
|
string total_fee = orderAmount;
|
|||
|
|
//必填
|
|||
|
|
|
|||
|
|
//订单描述
|
|||
|
|
|
|||
|
|
string body = "";
|
|||
|
|
//默认支付方式
|
|||
|
|
string paymethod = "bankPay";
|
|||
|
|
//必填
|
|||
|
|
//默认网银
|
|||
|
|
string defaultbank = "";
|
|||
|
|
|
|||
|
|
if (Request.QueryString["pay_bank"] != null)
|
|||
|
|
{
|
|||
|
|
if (Request.QueryString["pay_bank"].Trim() != "")
|
|||
|
|
{
|
|||
|
|
if (Request.QueryString["pay_bank"] == "directPay")
|
|||
|
|
{
|
|||
|
|
paymethod = "directPay";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
paymethod = "bankPay";
|
|||
|
|
defaultbank = Request.QueryString["pay_bank"];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//必填,银行简码请参考接口技术文档
|
|||
|
|
|
|||
|
|
//商品展示地址
|
|||
|
|
string show_url = "http://shop.q-b.cc/";
|
|||
|
|
//需以http://开头的完整路径,例如:http://www.xxx.com/myorder.html
|
|||
|
|
|
|||
|
|
//防钓鱼时间戳
|
|||
|
|
string anti_phishing_key = Mtxfw.Utility.Submit.Query_timestamp();
|
|||
|
|
//若要使用请调用类文件submit中的query_timestamp函数
|
|||
|
|
|
|||
|
|
//客户端的IP地址
|
|||
|
|
string exter_invoke_ip = Mtxfw.Utility.Common.GetIP;
|
|||
|
|
//非局域网的外网IP地址,如:221.0.0.1
|
|||
|
|
|
|||
|
|
|
|||
|
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
//把请求参数打包成数组
|
|||
|
|
SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
|
|||
|
|
sParaTemp.Add("partner", Mtxfw.Utility.AlipayConfig.Partner);
|
|||
|
|
sParaTemp.Add("_input_charset", Mtxfw.Utility.AlipayConfig.Input_charset.ToLower());
|
|||
|
|
sParaTemp.Add("service", "create_direct_pay_by_user");
|
|||
|
|
sParaTemp.Add("payment_type", payment_type);
|
|||
|
|
sParaTemp.Add("notify_url", notify_url);
|
|||
|
|
sParaTemp.Add("return_url", return_url);
|
|||
|
|
sParaTemp.Add("seller_email", seller_email);
|
|||
|
|
sParaTemp.Add("out_trade_no", out_trade_no);
|
|||
|
|
sParaTemp.Add("subject", subject);
|
|||
|
|
sParaTemp.Add("total_fee", total_fee);
|
|||
|
|
sParaTemp.Add("body", body);
|
|||
|
|
sParaTemp.Add("paymethod", paymethod);
|
|||
|
|
sParaTemp.Add("defaultbank", defaultbank);
|
|||
|
|
sParaTemp.Add("show_url", show_url);
|
|||
|
|
sParaTemp.Add("anti_phishing_key", anti_phishing_key);
|
|||
|
|
sParaTemp.Add("exter_invoke_ip", exter_invoke_ip);
|
|||
|
|
|
|||
|
|
//建立请求
|
|||
|
|
string sHtmlText = Mtxfw.Utility.Submit.BuildRequest(sParaTemp, "post", "确认");
|
|||
|
|
Response.Write(sHtmlText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception err)
|
|||
|
|
{
|
|||
|
|
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin1.txt", err.ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|