public Dictionary<string, string> PayInfo = new Dictionary<string, string>();
//
// GET: /AliPay/
public ActionResult Index()
{
testsign();
GetPayInfo("0.01");
return View();
}
/// <summary>
/// 测试公钥是否对
/// </summary>
/// <returns></returns>
public string testsign()
{
string privtekey = Config.privtekey;//这个就是生成器里面的那个私钥,第一个大框框那里的.
string data = "a=123";//平台上提供的串
string sign = RSAFromPkcs8.sign(data, privtekey, "utf-8");
return sign;
}
/// <summary>
/// 获取支付信息
/// </summary>
/// <param name="_amount"></param>
/// <returns></returns>
public string GetPayInfo(string _amount)//_amount:付款金额
{
string strJson = string.Empty;
try
{
string orderInfo = GetOrderInfoWithOutEncode(_amount);
// 对订单做RSA 签名
string sign = RSAFromPkcs8.sign(orderInfo, Config.privtekey, "utf-8");
//仅需对sign做URL编码