www.gusucode.com > citySHOP B2C商城系统 进销存 2.0.6码程序 > upload/payment.php
<?php define('NOROBOT', true); include './include/common.inc.php'; $way = isset($way) ? trim($way) : 0; $oid = isset($id) ? intval($id) : 0; $total = isset($total) ? trim($total) : 0; if (!$way || !$oid || !$total) { showmessage('undefined_action'); } $odid = $oid-$order_start_number; if(!$db->result_first("SELECT oid FROM {$tablepre}orders WHERE oid='$odid'")){ showmessage('订单不存在。'); } echo '请稍候,正在跳转到支付平台...'; if ($way == 'chinabank') { $v_mid = trim($payways['online_pay']['chinabank']['v_mid']); $key = trim($payways['online_pay']['chinabank']['key']); $v_oid = $oid; $v_amount = $total; $v_moneytype = 'CNY'; $v_url = $siteurl .$siteroot. '/onlinepay/chinabank/Receive.php'; $text = $v_amount . $v_moneytype . $v_oid . $v_mid . $v_url . $key; $v_md5info = strtoupper(md5($text)); ?> <script language="javascript"> window.onload = function(){ document.getElementById("payform").submit(); }; </script> <form method="post" id="payform" name="E_FORM" action="https://pay3.chinabank.com.cn/PayGate" style="display:none"> <input type="hidden" name="v_mid" value="<?php echo $v_mid; ?>"> <input type="hidden" name="v_oid" value="<?php echo $v_oid; ?>"> <input type="hidden" name="v_amount" value="<?php echo $v_amount; ?>"> <input type="hidden" name="v_moneytype" value="<?php echo $v_moneytype; ?>"> <input type="hidden" name="v_url" value="<?php echo $v_url; ?>"> <input type="hidden" name="v_md5info" value="<?php echo $v_md5info; ?>"> <input type="hidden" name="remark1" value="<?php echo $mall_uid; ?>"> </form> <?php } elseif ($way == 'alipay') { include (APP_ROOT . './onlinepay/alipay/alipay_service.php'); include (APP_ROOT . './onlinepay/alipay/alipay_config.php'); $parameter = array("service" => "create_direct_pay_by_user", "partner" => $partner, //合作商户号 "return_url" => $return_url, //同步返回 "notify_url" => $notify_url, //异步返回 "_input_charset" => $_input_charset, //字符集,默认为GBK "subject" => $sitename, //商品名称,必填 "body" => $sitename, //商品描述,必填 "out_trade_no" => $timestamp . '_' . $oid, //商品外部交易号,必填,每次测试都须修改 "total_fee" => $total, //商品单价,必填 "payment_type" => "1", // 默认为1,不需要修改 "show_url" => $show_url, //商品相关网站 "seller_email" => $seller_email //卖家邮箱,必填 ); $alipay = new alipay_service($parameter, $security_code, $sign_type); $link = $alipay->create_url(); header('location:' . $link); } elseif($way == '99bill'){ function appendParam($returnStr,$paramId,$paramValue){ if($returnStr!=""){ if($paramValue!=""){ $returnStr.="&".$paramId."=".$paramValue; } }else{ If($paramValue!=""){ $returnStr=$paramId."=".$paramValue; } } return $returnStr; } //$merchantAcctId=trim($payways['online_pay']['99bill']['bh']); //$key=trim($payways['online_pay']['99bill']['key']); $merchantAcctId = '1001153656201'; $key = 'ZUZNJB8MF63GA83J'; $inputCharset='3'; $bgUrl=$siteurl .$siteroot. '/onlinepay/99bill/receive.php'; $version='v2.0'; $language='1'; $signType='1'; $payerName=$mall_user; $payerContactType='1'; $payerContact=''; $orderId=$timestamp . '_' . $oid; $orderAmount=$total*100; $orderTime=date('YmdHis'); $productName=$sitename.'订单'; $productNum='1'; $productId=''; $productDesc=''; $ext1=''; $ext2=''; $payType='00'; $redoFlag='0'; $pid=''; //生成加密签名串 ///请务必按照如下顺序和规则组成加密串! $signMsgVal = ''; $signMsgVal=appendParam($signMsgVal,"inputCharset",$inputCharset); $signMsgVal=appendParam($signMsgVal,"bgUrl",$bgUrl); $signMsgVal=appendParam($signMsgVal,"version",$version); $signMsgVal=appendParam($signMsgVal,"language",$language); $signMsgVal=appendParam($signMsgVal,"signType",$signType); $signMsgVal=appendParam($signMsgVal,"merchantAcctId",$merchantAcctId); $signMsgVal=appendParam($signMsgVal,"payerName",$payerName); $signMsgVal=appendParam($signMsgVal,"payerContactType",$payerContactType); $signMsgVal=appendParam($signMsgVal,"payerContact",$payerContact); $signMsgVal=appendParam($signMsgVal,"orderId",$orderId); $signMsgVal=appendParam($signMsgVal,"orderAmount",$orderAmount); $signMsgVal=appendParam($signMsgVal,"orderTime",$orderTime); $signMsgVal=appendParam($signMsgVal,"productName",$productName); $signMsgVal=appendParam($signMsgVal,"productNum",$productNum); $signMsgVal=appendParam($signMsgVal,"productId",$productId); $signMsgVal=appendParam($signMsgVal,"productDesc",$productDesc); $signMsgVal=appendParam($signMsgVal,"ext1",$ext1); $signMsgVal=appendParam($signMsgVal,"ext2",$ext2); $signMsgVal=appendParam($signMsgVal,"payType",$payType); $signMsgVal=appendParam($signMsgVal,"redoFlag",$redoFlag); $signMsgVal=appendParam($signMsgVal,"pid",$pid); $signMsgVal=appendParam($signMsgVal,"key",$key); $signMsg= strtoupper(md5($signMsgVal)); ?> <script language="javascript"> window.onload = function(){ document.getElementById("payform").submit(); }; </script> <form style="display:none" name="kqPay" id="payform" method="get" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm"> <input type="hidden" name="inputCharset" value="<?php echo $inputCharset; ?>"/> <input type="hidden" name="bgUrl" value="<?php echo $bgUrl; ?>"/> <input type="hidden" name="version" value="<?php echo $version; ?>"/> <input type="hidden" name="language" value="<?php echo $language; ?>"/> <input type="hidden" name="signType" value="<?php echo $signType; ?>"/> <input type="hidden" name="signMsg" value="<?php echo $signMsg; ?>"/> <input type="hidden" name="merchantAcctId" value="<?php echo $merchantAcctId; ?>"/> <input type="hidden" name="payerName" value="<?php echo $payerName; ?>"/> <input type="hidden" name="payerContactType" value="<?php echo $payerContactType; ?>"/> <input type="hidden" name="payerContact" value="<?php echo $payerContact; ?>"/> <input type="hidden" name="orderId" value="<?php echo $orderId; ?>"/> <input type="hidden" name="orderAmount" value="<?php echo $orderAmount; ?>"/> <input type="hidden" name="orderTime" value="<?php echo $orderTime; ?>"/> <input type="hidden" name="productName" value="<?php echo $productName; ?>"/> <input type="hidden" name="productNum" value="<?php echo $productNum; ?>"/> <input type="hidden" name="productId" value="<?php echo $productId; ?>"/> <input type="hidden" name="productDesc" value="<?php echo $productDesc; ?>"/> <input type="hidden" name="ext1" value="<?php echo $ext1; ?>"/> <input type="hidden" name="ext2" value="<?php echo $ext2; ?>"/> <input type="hidden" name="payType" value="<?php echo $payType; ?>"/> <input type="hidden" name="redoFlag" value="<?php echo $redoFlag; ?>"/> <input type="hidden" name="pid" value="<?php echo $pid; ?>"/> </form> <?php }else{ showmessage('undefined_action'); } ?>