Ecshop银联电子支付(ChinaPay)接口配置
/includes/modules/payment/chinapay目录中存放银联密钥,PgPubk.key 是网关公钥;MerPrK_123456789012345_20120227000000.key是私钥,/includes/modules /payment/chinapaynetpayclient_config.php如下:
1 <?php 2 3 /** 4 * ECSHOP 银联电子支付(ChinaPay)接口配置 5 */ 6 7 /*请按照您的实际情况配置以下各参数*/ 8 9 //私钥文件,在chinapay申请商户号时获取,请相应修改此处,可填相对路径,下同 10 define("PRI_KEY", ROOT_PATH . "includes/modules/payment/chinapay/MerPrK_123456789012345_20120227000000.key"); 11 //公钥文件,示例中已经包含 12 define("PUB_KEY", ROOT_PATH . "includes/modules/payment/chinapay/PgPubk.key"); 13 14 /*如您已有生产密钥,请修改以下配置,默认为测试环境*/ 15 16 //支付请求地址(测试) 17 //define("REQ_URL_PAY","http://payment-test.chinapay.com/pay/TransGet"); 18 //支付请求地址(生产) 19 define("REQ_URL_PAY","https://payment.chinapay.com/pay/TransGet"); 20 21 //查询请求地址(测试) 22 //define("REQ_URL_QRY","http://payment-test.chinapay.com/QueryWeb/processQuery.jsp"); 23 //查询请求地址(生产) 24 define("REQ_URL_QRY","http://console.chinapay.com/QueryWeb/processQuery.jsp"); 25 26 //退款请求地址(测试) 27 //define("REQ_URL_REF","http://payment-test.chinapay.com/refund/SingleRefund.jsp"); 28 //退款请求地址(生产) 29 define("REQ_URL_REF","https://bak.chinapay.com/refund/SingleRefund.jsp"); 30 31 function getcwdOL(){ 32 $total = $_SERVER[PHP_SELF]; 33 $file = explode("/", $total); 34 $file = $file[sizeof($file)-1]; 35 return substr($total, 0, strlen($total)-strlen($file)-1); 36 } 37 38 function getSiteUrl(){ 39 //$host = $_SERVER[SERVER_NAME]; 40 //$port = ($_SERVER[SERVER_PORT]=="80")?"":":$_SERVER[SERVER_PORT]"; 41 //return "http://" . $host . $port . getcwdOL(); 42 } 43 44 function traceLog($file, $log){ 45 $f = fopen($file, 'a'); 46 if($f){ 47 fwrite($f, date('Y-m-d H:i:s') . " => $log\n"); 48 fclose($f); 49 } 50 } 51 52 //取得本示例安装位置 53 $site_url = getSiteUrl(); 54 ?>