資源簡介
簡單封裝了微信和支付寶的掃碼支付功能,兩個支付繼承同一套接口,上傳的類庫已經把接口剝離了,調用簡單,如下:
private void Form1_Load(object sender, EventArgs e)
{
PayParament p = new PayParament() //商品屬性
{
Body = "sss",
GoodsTag = "ddd",
OrderId = "365216541",
ProductId = "206542154",
TotalFee = 0.01
};
/*微信:配置WxPayCOnfig.cs相關內容*/
APIFunction weixin = new APIFunction();
weixin.DoSuccessProcess += DoSuccessProcess;
weixin.IGetPayQRCode(p);
/*阿里:配置AliConfig.cs相關內容,替換秘鑰文件*/
AlipayF2F ali = new AlipayF2F();
ali.DoSuccessProcess += DoSuccessProcess;
ali.IGetPayQRCode(p);
}
// 支付成功事件
private void DoSuccessProcess(QueryPayState obj)
{
}

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.IO;
//using?System.Linq;
using?System.Web;
///?
///?Summary?description?for?Config
///?
namespace?PayAPI.Ali
{
????internal?class?AliConfig
????{
????????/*****************************生產環境的測試數據*****************************/
????????internal?static?string?alipay_public_key?=?“rsa\\alipay_rsa_public_key.pem“;
????????//這里要配置沒有經過PKCS8轉換的原始私鑰
????????internal?static?string?merchant_private_key?=?“rsa\\rsa_private_key.pem“;
????????internal?static?string?merchant_public_key?=?“rsa\\rsa_public_key.pem“;
????????internal?static?string?appId?=?““;
????????internal?static?string?serverUrl?=?“https://openapi.alipay.com/gateway.do“;
????????internal?static?string?mapiUrl?=?“https://mapi.alipay.com/gateway.do“;
????????internal?static?string?monitorUrl?=?“http://mcloudmonitor.com/gateway.do“;
????????internal?static?string?pid?=?““;
?????????/*****************************生產環境的測試數據*****************************/
????????/*****************************開發環境的測試數據*****************************
??????????????public?static?string?????alipay_public_key?=?HttpRuntime.AppDomainAppPath.ToString()?+?“Demo\\alipay_rsa_public_key_dev.pem“;
???????????????????//這里要配置沒有經過PKCS8轉換的原始私鑰
??????????????public?static?string?????merchant_private_key?=?HttpRuntime.AppDomainAppPath.ToString()?+?“Demo\\rsa_private_key_dev.pem“;
??????????????public?static?string?????merchant_public_key?=?HttpRuntime.AppDomainAppPath.ToString()?+?“Demo\\rsa_public_key_dev.pem“;
??????????????public?static?string?????appId?=?“2015042200550512“;
??????????????public?static?string?????serverUrl?=?“http://openapi.d7165.alipay.net/gateway.do“;
??????????????public?static?string?????mapiUrl?=?“http://mapi.stable.alipay.net/gateway.do“;
??????????????public?static?string?????pid?=?“2088102146891244“;
?????????*****************************開發環境的測試數據*****************************/
????????internal?static?string?charset?=?“utf-8“;//“utf-8“;
????????internal?static?string?sign_type?=?“RSA“;
????????internal?static?string?version?=?“1.0“;
????????internal?AliConfig()
????????{
????????????//
????????}
????????internal?static?string?getMerchantPublicKeyStr()
????????{
????????????StreamReader?sr?=?new?StreamReader(merchant_public_key);
????????????string?pubkey?=?sr.ReadToEnd();
????????????sr.Close();
????????????if?(pubkey?!=?null)
????????????{
??????????????pubkey=??pubkey.Replace(“-----BEGIN?PUBLIC?KEY-----“?““);
??????????????pubkey?=?pubkey.Replace(“-----END?PUBLIC?KEY-----“?““);
??????????????pubkey?=?pubkey.Replace(“\r“?““);
??????????????pubkey?=?pubkey.Replace(“\n“?““);
????????????}
????????????return?pubkey;
????????}
????????internal?static?string?getMerchantPriveteKeyStr()
????????{
????????????StreamReader?sr?=?new?StreamReader(merchant_private_key);
????????????string?pubkey?=?sr.ReadToEnd();
????????????sr.Close();
????????????if?(pubkey?!
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-06-28?17:19??微信阿里支付\
?????目錄???????????0??2016-06-28?17:28??微信阿里支付\Solution1\
?????目錄???????????0??2016-06-28?17:34??微信阿里支付\Solution1\bin\
?????目錄???????????0??2016-06-28?17:33??微信阿里支付\Solution1\bin\Debug\
?????目錄???????????0??2016-06-28?17:34??微信阿里支付\Solution1\bin\Release\
?????目錄???????????0??2016-06-28?17:19??微信阿里支付\Solution1\PayAPI.Ali\
?????文件????????3481??2016-06-28?17:30??微信阿里支付\Solution1\PayAPI.Ali\AliConfig.cs
?????文件????????5167??2016-06-28?17:21??微信阿里支付\Solution1\PayAPI.Ali\AlipayF2F.cs
?????目錄???????????0??2016-06-28?17:18??微信阿里支付\Solution1\PayAPI.Ali\bin\
?????目錄???????????0??2016-06-28?17:18??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\
?????文件??????832000??2016-03-22?17:46??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\AopSdk.dll
?????文件???????26112??2016-03-22?17:46??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\F2FPayDll.dll
?????文件????????9216??2016-06-14?17:14??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\JTD.Peripherals.PayAPI.Ali.dll
?????文件???????17920??2016-06-14?17:14??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\JTD.Peripherals.PayAPI.Ali.pdb
?????文件????????5120??2016-06-14?17:14??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\JTD.PeripheralsInterface.dll
?????文件????????7680??2016-06-14?17:14??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\JTD.PeripheralsInterface.pdb
?????文件???????38912??2016-06-14?17:14??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\JTD.PeripheralsInterfaceModel.dll
?????文件???????54784??2016-06-14?17:14??微信阿里支付\Solution1\PayAPI.Ali\bin\Debug\JTD.PeripheralsInterfaceModel.pdb
?????目錄???????????0??2016-06-28?17:34??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\
?????文件??????832000??2016-03-22?17:46??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\AopSdk.dll
?????文件???????26112??2016-03-22?17:46??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\F2FPayDll.dll
?????文件????????9216??2016-06-14?16:20??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\JTD.Peripherals.PayAPI.Ali.dll
?????文件???????22016??2016-06-14?16:20??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\JTD.Peripherals.PayAPI.Ali.pdb
?????文件????????5120??2016-06-14?16:20??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\JTD.PeripheralsInterface.dll
?????文件????????7680??2016-06-14?16:20??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\JTD.PeripheralsInterface.pdb
?????文件???????35840??2016-06-14?16:20??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\JTD.PeripheralsInterfaceModel.dll
?????文件???????62976??2016-06-14?16:20??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\JTD.PeripheralsInterfaceModel.pdb
?????目錄???????????0??2016-06-28?17:34??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\Libs\
?????文件??????832000??2016-03-22?17:46??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\Libs\AopSdk.dll
?????文件???????26112??2016-03-22?17:46??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\Libs\F2FPayDll.dll
?????文件????????8192??2016-06-28?17:34??微信阿里支付\Solution1\PayAPI.Ali\bin\Release\PayAPI.Ali.dll
............此處省略194個文件信息
- 上一篇:WPF多點觸摸功能實現
- 下一篇:C#UDP通信+文件傳輸 源碼
評論
共有 條評論