建行聚合支付
网上C# 的资料比较少,整理下来,欢迎沟通
1. 商户到银行
页面js可直接实现
var URL;
var tmp;
var tmp0;
CCBPaymentURL= "@ViewBag.CCBPaymentURL"; //"https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain?CCB_IBSVersion=V6" config或者appsetting信息
MERCHANTID = "@ViewBag.MERCHANTID";
POSID = "@ViewBag.POSID";
BRANCHID = "@ViewBag.BRANCHID";
CURCODE = "@ViewBag.CURCODE"; //"01"
TXCODE = "@ViewBag.TXCODE"; //"530550"
REMARK1 = \'\';
REMARK2 = \'\';
PUB = "@ViewBag.PUB"; //商户后台下载的 商户公钥后30位
tmp = \'MERCHANTID=\' + MERCHANTID + \'&POSID=\' + POSID + \'&BRANCHID=\' + BRANCHID + \'&ORDERID=\' + ORDERID;
tmp += \'&PAYMENT=\' + PAYMENT + \'&CURCODE=\' + CURCODE + \'&TXCODE=\' + TXCODE
+ \'&REMARK1=\' + REMARK1;
tmp += \'&REMARK2=\' + REMARK2;
tmp += \'&RETURNTYPE=2\';
tmp += \'&TIMEOUT=\'
tmp0 = tmp;
tmp += \'&PUB=\' + PUB;
URL = CCBPaymentURL+ \'&\' + tmp0 + \'&MAC=\' + hex_md5(tmp) ;
2. 银行回调商户地址通知支付结果
string requestqueryString = Request.QueryString.ToString().Replace("?",""); // 拿到回调的参数串
string remove = "";
var requestqueryStrings = requestqueryString.Split("&");
foreach (var item in requestqueryStrings)
{
var items = item.Split("=");
if(items[0] == "SIGN")
{
remove = item;
}
}
string initString = requestqueryString.Replace("&"+remove, ""); //回调的参数串去除SIGN信息 参与验签
RSASig rsa = new RSASig();
rsa.setPublicKey(AllPUB); //AllPUB 商户后台下载的 商户公钥全部(不要截取后30位,是全部) config或者appsetting信息
bool result = rsa.verifySigature(Request.Query["SIGN"], initString);
string success = Request.Query["SUCCESS"];
if (result && success == "Y")
{
//todo 处理 支付订单状态更改
}