Exemple #1
0
 //商户编号
 $op = $jieqiPayset[JIEQI_PAY_TYPE]['op'];
 //请求类型(1-支付)
 $transid = $paylog->getVar('payid');
 //订单编号[商户网站]
 $objid = $jieqiPayset[JIEQI_PAY_TYPE]['objid'];
 //交易商品编码
 $money = $amount;
 //交易金额
 $retweb = $jieqiPayset[JIEQI_PAY_TYPE]['payreturn'];
 //商家接受支付结果的URL
 $param = "op=" . $op . "&unitid=" . $unitid . "&transid=" . $transid . "&objid=" . $objid . "&money=" . $money . "&retweb=" . $retweb;
 // Using My Private Key File (here 100001 is a Test ID)
 //商户证书(私钥)地址(此示例为测试密钥,正式密钥需要到自服务平台下载)
 $filename = JIEQI_ROOT_PATH . '/configs/pay/' . $jieqiPayset[JIEQI_PAY_TYPE]['prikeyfile'];
 $xmlKey = new KeyFile($filename);
 $xmlKey->getCRTPrivateKey($modulus, $p, $q, $dp, $dq, $invq);
 $sign = new Sign();
 $sign->setCRTPrivateKeyFromXML($modulus, $p, $q, $dp, $dq, $invq);
 $signData = $sign->getSign($param);
 //将数据POST到支付网关地址(正式测试时地址改为http://pay.118pay.cn/PhonePay.aspx?)
 $reqURL = $jieqiPayset[JIEQI_PAY_TYPE]['payurl'] . "?" . $param . "&sign=" . $signData;
 // let client redirect to 118PAY Gateway with params & sign
 //echo $reqURL;exit;
 header("Location: {$reqURL}");
 exit;
 /*
 		include_once(JIEQI_ROOT_PATH.'/header.php');
 		include_once(JIEQI_ROOT_PATH.'/lib/template/template.php');
 		$jieqiTpl =& JieqiTpl::getInstance();
 		$jieqiTpl->assign('url_pay', $jieqiPayset[JIEQI_PAY_TYPE]['payurl']);
Exemple #2
0
支付平台返回已经支付(retcode=12)或者支付结果成功(paycode=1 、retcode=0),只表示支付平台库里该订单处于已支付状态
*/
//3-----------判断返回信息,如果支付成功,并且支付结果可信,则做进一步的处理----------------------------
if ($unitid != $myunitid) {
    jieqi_printfail($jieqiLang['pay']['customer_id_error']);
}
if ($retcode == 12 || $paycode == 1 && $retcode == 0) {
    $query_string = $_SERVER['QUERY_STRING'];
    $pos = strpos($query_string, "&sign=");
    if ($pos == false) {
        jieqi_printfail($jieqiLang['pay']['return_checkcode_error']);
    } else {
        $param = substr($query_string, 0, $pos);
    }
    $filename = JIEQI_ROOT_PATH . '/configs/pay/' . $jieqiPayset[JIEQI_PAY_TYPE]['pubkeyfile'];
    $xmlKey = new KeyFile($filename);
    $xmlKey->getPublicKey($modulus, $exp);
    $sign = new Sign();
    $sign->setPublicKeyFromXML($exp, $modulus);
    if (!$sign->VerifySign($param, $signData)) {
        jieqi_printfail($jieqiLang['pay']['return_checkcode_error']);
    } else {
        include_once $jieqiModules['pay']['path'] . '/class/paylog.php';
        $paylog_handler = JieqiPaylogHandler::getInstance('JieqiPaylogHandler');
        $orderid = intval($transid);
        $paylog = $paylog_handler->get($orderid);
        if (is_object($paylog)) {
            $buyname = $paylog->getVar('buyname');
            $buyid = $paylog->getVar('buyid');
            $payflag = $paylog->getVar('payflag');
            $egold = $paylog->getVar('egold');