这两天初步实现了支付宝手机网站支付
新建应用、秘钥之类的步骤略过
下载SDK,.net下载地址,
https://openhome.alipay.com/doc/sdkDownload.resource?sdkType=NET
下载了demo,alipay.wap.create.direct.pay.by.user-CSHARP-UTF-8
step1:在项目中添加引用AopSdk
step2:按照说明调用方法
代码中是沙箱环境地址和appid和公钥之类的信息
开发文档中关于实现过程,各种参数说明写的很细致
public void doNetPost() //pc网站
{
//https://openapi.alipay.com/gateway.do
IAopClient client = new DefaultAopClient("https://openapi.alipaydev.com/gateway.do", "2016091200495813",
"MIIEpQIBAAKCAQEA7Zxixzb1hUT5c1r3DK3OoEZ9H8Gev9MPZ/jcjbmurqn/qvRfzL3C0zjaN2uzl3HdIJefwtRpgJ9ql5cBFdvCSkFGDUI4RBLIz91jGmzPun1KQlo0ICvyUo+OfHWPXDUVNQJFFi8FtzrsL1DjxDxpUtmRV5yGHKjAjSMRFfflcYpTWynzdnACQUQAOujZgSnol7PbSGOlPznRtTR+yYtcKiDRNx5S8IL/IxD1/i55y7kiZfnoV0fGI40wxpWw7c62R+YTm37sAtDwEqdfDaOzTdnla2nZYcA2dJLpaqMkJN88XnQ+cTb5CwHunvnOPZJN2ZIb3kAuGzxsZs8padcA9wIDAQABAoIBAQDHxT/XNgHedks0DTrAUjDy19DDLkqGBLFjPPxRu9d9yjfGR4dz3+c5JwdwqQBpR7YefNw5NdUt6tn3cWHcOtNzEsYOx6n+sbxb50o3IVzU8hnJB4Xjto8ZktC9GynY4FhgJPRo3kfz8Xo5ncyhZBk5KurjuhmXZtncz6rByZYCiibzOGXqKH7L30pEc55H1BrebMsTBLOt9uPKU0lRRNOtwdsKRVKTaeqn4uQ1OkjX5t5gi8yvLLubt5oxbquE3Pa/BDf7j2E+zwF54GAmCxQ2CjXlGojOqqZCxAOciHzRFLg9wyIf4ZSLeNbEA3uKEZVQEGwm8D1RmboDg3AHSZ+BAoGBAP68LMsFOrCxfUFl09+LxD2mZUbMGnVjo9wgwVoZiWwGW85UtWkYc/5Hfc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GuAu9e5ohkJHTVDGT165lGySxupAU3jZWxR2oXSyBGgoGWGYjCk3maNmfx2Exoxim029UajOJJxIjxBe4wyI+b41YchcQk+5Zw+uaZUht2iaCWWgduw+SjMonhVX1hd8FwIDAQAB"
, "GBK", false);
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
request.BizContent = "{" +
" \"body\":\"Iphone6 16G\"," +
" \"subject\":\"Iphone6 16G\"," +
" \"out_trade_no\":\"20150320010101001\"," +
" \"total_amount\":88.88," +
" \"product_code\":\"FAST_INSTANT_TRADE_PAY\"" +
" }";
AlipayTradePagePayResponse response = client.pageExecute(request);
string form = response.Body;
Response.Write(form);
}
public void doMobilePost()//手机网站
{
//
//https://openapi.alipay.com/gateway.do
IAopClient client = new DefaultAopClient("https://openapi.alipaydev.com/gateway.do", "2016091200495813",
"MIIEpQIBAAKCAQEA7Zxixzb1hUT5c1r3DK3OoEZ9H8Gev9MPZ/jcjbmurqn/qvRfzL3C0zjaN2uzl3HdIJefwtRpgJ9ql5cBFdvCSkFGDUI4RBLIz91jGmzPun1KQlo0ICvyUo+OfHWPXDUVNQJFFi8FtzrsL1DjxDxpUtmRV5yGHKjAjSMRFfflcYpTWynzdnACQUQAOujZgSnol7PbSGOlPznRtTR+yYtcKiDRNx5S8IL/IxD1/i55y7kiZfnoV0fGI40wxpWw7c62R+YTm37sAtDwEqdfDaOzTdnla2nZYcA2dJLpaqMkJN88XnQ+cTb5CwHunvnOPZJN2ZIb3kAuGzxsZs8padcA9wIDAQABAoIBAQDHxT/XNgHedks0DTrAUjDy19DDLkqGBLFjPPxRu9d9yjfGR4dz3+c5JwdwqQBpR7YefNw5NdUt6tn3cWHcOtNzEsYOx6n+sbxb50o3IVzU8hnJB4Xjto8ZktC9GynY4FhgJPRo3kfz8Xo5ncyhZBk5KurjuhmXZtncz6rByZYCiibzOGXqKH7L30pEc55H1BrebMsTBLOt9uPKU0lRRNOtwdsKRVKTaeqn4uQ1OkjX5t5gi8yvLLubt5oxbquE3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yeZ8G58RHcCuthg0GznaM1Ch3TqkvdkTx56QjlcRYFsOE7TNXJ5AkcOG+23Q4AizstvtfVvqQm1nsfYwZLizR8vPDAWge0zNpHO10/lK+K6E/gik+OcExhf38j1oMoKcDiHbzSB80hXX3FszfvSVtICgpoQBsiGuAu9e5ohkJHTVDGT165lGySxupAU3jZWxR2oXSyBGgoGWGYjCk3maNmfx2Exoxim029UajOJJxIjxBe4wyI+b41YchcQk+5Zw+uaZUht2iaCWWgduw+SjMonhVX1hd8FwIDAQAB"
, "GBK", false);
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
request.BizContent = "{" +
" \"body\":\"Iphone6 16G\"," +
" \"subject\":\"Iphone6 16G\"," +
" \"out_trade_no\":\"20150320010101001\"," +
" \"total_amount\":88.88," +
" \"product_code\":\"FAST_INSTANT_TRADE_PAY\"" +
" }";
AlipayTradeWapPayResponse response = client.pageExecute(request);
string form = response.Body;
Response.Write(form);
}
2017-02-15
点击查看更多内容
11人点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦