代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
CSharp
】
NET支付宝接口
作者:
dezai
/ 发布于
2014/6/20
/
523
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Text; public partial class pay : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Encoding gb2312 = Encoding.GetEncoding("gb2312"); Response.ContentEncoding = gb2312; Request.ContentEncoding = gb2312; } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (Request.Cookies[FormsAuthentication.FormsCookieName] != null) { Vlike_DB_read a = new Vlike_DB_read(); string zfb_ddh = a.get_zfb_id(Membership.GetUser().UserName, Convert.ToInt32(DropDownList1.SelectedValue)); Response.Redirect(img("0001", "包月", "影视包月 10元/月", zfb_ddh, "10.00", Membership.GetUser().UserName.ToUpper(), DropDownList1.SelectedValue)); } else { Response.Write("<script type="text/javascript">alert("请先登陆!");</script>"); } } private string img(string strcmd, string strSub, string strSubinfo, string strid, string strMoney, string strUser, string strNum) { string strsellerEmail = "341081@qq.com"; //卖家支付宝帐号 string strAc = ""; //卖家支付宝安全校验码 string INTERFACE_URL = "https://www.alipay.com/payto:"; string strCmd = strcmd; //命令字 string strSubject = strSub; //商品名 string strBody = strSubinfo; //商品描述 string strOrder_no = strid; //商户订单号 string strPrice = strMoney; //商品单价 0.01~50000.00 string rurl = "http://"; //商品展示网址 string strType = "2"; //type支付类型 1:商品购买2:服务购买3:网络拍卖4:捐赠 string strNumber = strNum; //购买数量 string strTransport = "3"; //发货方式 1:平邮2:快递3:虚拟物品 string strOrdinary_fee = ""; //平邮运费 string strExpress_fee = ""; //快递运费 string strReadOnly = "true"; //交易信息是否只读 string strBuyer_msg = ""; //买家给卖家的留言 string strBuyer = ""; //买家EMAIL string strBuyer_name = strUser; //买家姓名 string strBuyer_address = ""; //买家地址 string strBuyer_zipcode = ""; //买家邮编 string strBuyer_tel = ""; //买家电话号码 string strBuyer_mobile = ""; //买家手机号码 string strPartner = ""; //合作伙伴ID 保留字段 return CreatUrl(strsellerEmail, strAc, INTERFACE_URL, strCmd, strSubject, strBody, strOrder_no, strPrice, rurl, strType, strNumber, strTransport, strOrdinary_fee, strExpress_fee, strReadOnly, strBuyer_msg, strBuyer, strBuyer_name, strBuyer_address, strBuyer_zipcode, strBuyer_tel, strBuyer_mobile, strPartner); } private string CreatUrl( string strsellerEmail, string strAc, string INTERFACE_URL, string strCmd, string strSubject, string strBody, string strOrder_no, string strPrice, string rurl, string strType, string strNumber, string strTransport, string strOrdinary_fee, string strExpress_fee, string strReadOnly, string strBuyer_msg, string strBuyer, string strBuyer_name, string strBuyer_address, string strBuyer_zipcode, string strBuyer_tel, string strBuyer_mobile, string strPartner) { //以下参数值不能留空 string str2CreateAc = ""; str2CreateAc += "cmd" + strCmd + "subject" + strSubject; str2CreateAc += "body" + strBody; str2CreateAc += "order_no" + strOrder_no; str2CreateAc += "price" + strPrice; str2CreateAc += "url" + rurl; str2CreateAc += "type" + strType; str2CreateAc += "number" + strNumber; str2CreateAc += "transport" + strTransport; str2CreateAc += "ordinary_fee" + strOrdinary_fee; str2CreateAc += "express_fee" + strExpress_fee; str2CreateAc += "readonly" + strReadOnly; str2CreateAc += "buyer_msg" + strBuyer_msg; str2CreateAc += "seller" + strsellerEmail; str2CreateAc += "buyer" + strBuyer; str2CreateAc += "buyer_name" + strBuyer_name; str2CreateAc += "buyer_address" + strBuyer_address; str2CreateAc += "buyer_zipcode" + strBuyer_zipcode; str2CreateAc += "buyer_tel" + strBuyer_tel; str2CreateAc += "buyer_mobile" + strBuyer_mobile; str2CreateAc += "partner" + strPartner; str2CreateAc += strAc; string acCode = GetMD5(str2CreateAc); string parameter = ""; parameter += INTERFACE_URL + strsellerEmail + "?cmd=" + strCmd; parameter += "&subject=" + Server.UrlEncode(strSubject); parameter += "&body=" + Server.UrlEncode(strBody); parameter += "&order_no=" + strOrder_no; parameter += "&url=" + rurl; parameter += "&price=" + strPrice; parameter += "&type=" + strType; parameter += "&number=" + strNumber; parameter += "&transport=" + strTransport; parameter += "&ordinary_fee=" + strOrdinary_fee; parameter += "&express_fee=" + strExpress_fee; parameter += "&readonly=" + strReadOnly; parameter += "&buyer_msg=" + strBuyer_msg; parameter += "&buyer=" + strBuyer; parameter += "&buyer_name=" + Server.UrlEncode(strBuyer_name); parameter += "&buyer_address=" + strBuyer_address; parameter += "&buyer_zipcode=" + strBuyer_zipcode; parameter += "&buyer_tel=" + strBuyer_tel; parameter += "&buyer_mobile=" + strBuyer_mobile; parameter += "&partner=" + strPartner; parameter += "&ac=" + acCode; return parameter; } private static string GetMD5(string s) { System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider(); byte[] t = md5.ComputeHash(System.Text.Encoding.GetEncoding("gb2312").GetBytes(s)); System.Text.StringBuilder sb = new System.Text.StringBuilder(32); for (int i = 0; i < t.Length; i++) { sb.Append(t[i].ToString("x").PadLeft(2, "0")); } return sb.ToString(); } }
试试其它关键字
NET支付宝接口
同语言下
.
文件IO 操作类库
.
Check图片类型[JPEG(.jpg 、.jpeg),TIF,GIF,BMP,PNG,P
.
机器名和IP取得(IPV4 IPV6)
.
Tiff转换Bitmap
.
linqHelper
.
MadieHelper.cs
.
RegHelper.cs
.
如果关闭一个窗体后激活另一个窗体的事件或方法
.
创建日志通用类
.
串口辅助开发类
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
dezai
贡献的其它代码
(
1065
)
.
双色球
.
列出所有物理网络适配器
.
快乐数的 Python 实现
.
计算当月还剩天数
.
猜属相
.
二十四小时时钟
.
每日一语
.
很酷的日历
.
超长日历表单
.
最简单的时钟
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3