// assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; if (eregi("VERIFIED", $result)) { $out_trade_no = $item_number; $total_fee = $payment_amount; @(list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4)); if ($_ == 'charge') { @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4)); ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'paypal'); } else { $currency = $payment_currency; $service = 'paypal'; $bank = 'PayPal'; ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank); } } function fsockPost($url, $data) { //Parse url $web = parse_url($url); //build post string foreach ($data as $i => $v) { $postdata .= $i . "=" . urlencode($v) . "&"; }
$isLocked = $_REQUEST["isLocked"]; $feeAmt = $_REQUEST["feeAmt"]; $respCode = $_REQUEST["respCode"]; $VerficationCode = $INI['gopay']['code']; $signValue = $_REQUEST["signValue"]; $orderId = preg_replace('/_/', '-', $merOrderNum); $str = "tranCode=[{$tranCode}]merchantID=[{$merchantID}]merOrderNum=[{$merOrderNum}]tranAmt=[{$tranAmt}]ticketAmt=[{$ticketAmt}]tranDateTime=[{$tranDateTime}]currencyType=[{$currencyType}]merURL=[{$merURL}]customerEMail=[{$customerEMail}]authID=[{$authID}]orgOrderNum=[{$orgOrderNum}]orgtranDateTime=[{$orgtranDateTime}]orgtranAmt=[{$orgtranAmt}]orgTxnType=[{$orgTxnType}]orgTxnStat=[{$orgTxnStat}]msgExt=[{$msgExt}]virCardNo=[{$virCardNo}]virCardNoIn=[{$virCardNoIn}]tranIP=[{$tranIP}]isLocked=[{$isLocked}]feeAmt=[{$feeAmt}]respCode=[{$respCode}]VerficationCode=[{$VerficationCode}]"; $newSign = MD5($str); @(list($_, $order_id, $city_id, $_) = explode('-', $orderId, 4)); if (Table::Fetch('pay', $orderId)) { die('SUCCESS'); } if ($newSign == $signValue && $respCode == '0000') { /* charge */ if ($_ == 'charge') { @(list($_, $user_id, $create_time, $_) = explode('-', $orderId, 4)); ZFlow::CreateFromCharge($tranAmt, $user_id, $create_time, 'gopay', $tranCode); Session::Set('notice', "国付宝充值{$tranAmt}元成功!"); redirect(WEB_ROOT . '/credit/index.php'); die('success'); } /* end charge */ $currency = 'CNY'; $service = 'gopay'; $bank = '国付宝'; ZOrder::OnlineIt($order_id, $orderId, $tranAmt, $currency, $service, $bank, $tranCode); //Session::Set('notice', "购买成功!"); redirect(WEB_ROOT . "/order/pay.php?id={$order_id}"); die('success'); } include template('order_return_error');
$v_moneytype = trim($_POST['v_moneytype']); //订单实际支付币种 $remark1 = trim($_POST['remark1' ]); //备注字段1 $remark2 = trim($_POST['remark2' ]); //备注字段2 $v_md5str = trim($_POST['v_md5str' ]); //拼凑后的MD5校验值 /* 重新计算md5的值 */ $text = "{$v_oid}{$v_pstatus}{$v_amount}{$v_moneytype}{$key}"; $md5string = strtoupper(md5($text)); /* 判断返回信息,如果支付成功,并且支付结果可信,则做进一步的处理 */ if ($v_md5str == $md5string) { list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4); if($v_pstatus=="20") { /* charge */ if ( $_ == 'charge' ) { @list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4); ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'chinabank'); die('ok'); } /* end charge */ $currency = 'CNY'; $service = 'chinabank'; $bank = mb_convert_encoding($v_pmode,'UTF-8','GBK'); ZOrder::OnlineIt($order_id, $v_oid, $v_amount, $currency, $service, $bank); die('ok'); } } die('error'); ?>
$sign_type = 'MD5'; $transport = 'http'; $alipay = new AlipayNotify($partner, $security_code, $sign_type, $_input_charset, $transport); $verify_result = $alipay->notify_verify(); $out_trade_no = $_POST['out_trade_no']; $trade_no = strval($_POST['trade_no']); $total_fee = $_POST['total_fee']; @(list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4)); if (Table::Fetch('pay', $out_trade_no)) { die('success'); } if ($_ == 'charge') { if ($verify_result) { if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') { @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4)); ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'alipay', $trade_no); } } die('success'); } if ($verify_result) { //$guarantee = strtoupper($INI['alipay']['guarantee']) == 'Y'; $guaranteewait = strtoupper($INI['alipay']['guaranteesuccess']) == 'N'; $guarantee = $guaranteewait && $_POST['trade_status'] == 'WAIT_SELLER_SEND_GOODS'; if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS' || $guarantee) { $currency = 'CNY'; $service = 'alipay'; $bank = '支付宝'; ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank, $trade_no); die('success'); }
$signData = $merchantId . $payNo . $requestId . $returnCode . $message . $sigTyp . $type . $version . $amount . $banks . $contractName . $invoiceTitle . $mobile . $orderId . $payDate . $reserved . $status; // if($version == "1.0.1") $signData = $merchantId . $payNo . $requestId . $returnCode . $message . $sigTyp . $type . $version . $amount . $banks . $contractName . $invoiceTitle . $mobile . $orderId . $payDate . $reserved . $status . $amtItem; $hash = hmac("", $signData); $newhmac = hmac($signKey, $hash); RecordLog("YGM", "###hmac" . $hmac . "###"); RecordLog("YGM", "###newhmac" . $newhmac . "###"); @(list($_, $order_id, $city_id, $_) = explode('-', $orderId, 4)); if (Table::Fetch('pay', $orderId)) { die('SUCCESS'); } $v_amount = $amount / 100; if ($_ == 'charge') { if ($newhmac == $hmac) { @(list($_, $user_id, $create_time, $_) = explode('-', $orderId, 4)); ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'cmpay'); // 记录日志 RecordMyLog("流水号:" . $payNo); RecordMyLog("支付金额:" . $amount); RecordMyLog("金额明细:" . $amtItem); RecordMyLog("支付银行:" . $banks); RecordMyLog("送货信息:" . $contractName); RecordMyLog("发票抬头:" . $invoiceTitle); RecordMyLog("支付人:" . $mobile); RecordMyLog("支付时间:" . $payDate); RecordMyLog("保留字段:" . $reserved); RecordMyLog("支付结果:" . $status); } die("SUCCESS"); } if ($newhmac == $hmac) {
require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; require_once dirname(dirname(dirname(__FILE__))) . "/cplatform/service/PayService.php"; $_input_charset = 'utf-8'; $partner = $INI['alipay']['mid']; $security_code = $INI['alipay']['sec']; $sign_type = 'MD5'; $transport = 'http'; $alipay = new AlipayNotify($partner, $security_code, $sign_type, $_input_charset, $transport); $verify_result = $alipay->notify_verify(); $out_trade_no = $_POST['out_trade_no']; $total_fee = $_POST['total_fee']; @(list($_, $order_id, $quantity, $_) = explode('-', $out_trade_no, 4)); if ($_ == 'charge') { if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') { @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4)); if (ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'chinabank')) { Phplog::RecordChargeLog("网银充值{$total_fee}元成功!支付订单号:{$out_trade_no}"); } } die('success'); } if ($verify_result) { if ($_POST['trade_status'] == 'TRADE_FINISHED' || $_POST['trade_status'] == 'TRADE_SUCCESS') { $order = Table::Fetch('order', $order_id); if (!$order) { Phplog::RecordOrderFailLog(" 订单不存在 团购订单号:" . $order_id); die("success"); } $is_ok = false; if ($order['state'] == 'unpay') { //查找团购
$remark1 = trim($_POST['remark1']); //备注字段1 $remark2 = trim($_POST['remark2']); //备注字段2 $v_md5str = trim($_POST['v_md5str']); //拼凑后的MD5校验值 /* 重新计算md5的值 */ $text = "{$v_oid}{$v_pstatus}{$v_amount}{$v_moneytype}{$key}"; $md5string = strtoupper(md5($text)); /* 判断返回信息,如果支付成功,并且支付结果可信,则做进一步的处理 */ if ($v_md5str == $md5string) { list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4); if ($v_pstatus == "20") { /* charge */ if ($_ == 'charge') { @(list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4)); $service = 'chinabank'; if (ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, $service)) { Session::Set('notice', "网银在线充值{$v_amount}元成功!"); } redirect(WEB_ROOT . '/credit/index.php'); } /* end charge */ $currency = 'CNY'; $service = 'chinabank'; $bank = mb_convert_encoding($v_pmode, 'UTF-8', 'GBK'); ZOrder::OnlineIt($order_id, $v_oid, $v_amount, $currency, $service, $bank); redirect(WEB_ROOT . "/order/pay.php?id={$order_id}"); } } include template('order_return_error');
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; $key = $INI['tenpay']['sec']; $resHandler = new PayResponseHandler(); $resHandler->setKey($key); if ($resHandler->isTenpaySign()) { $v_oid = $resHandler->getParameter("sp_billno"); $v_amount = moneyit($resHandler->getParameter("total_fee") * 0.01); $pay_result = $resHandler->getParameter("pay_result"); list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4); if ("0" == $pay_result) { /* charge */ if ($_ == 'charge') { @(list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4)); if (ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'tenpay')) { Session::Set('notice', "财付通充值{$v_amount}元成功!"); } redirect(WEB_ROOT . '/credit/index.php'); } /* end charge */ $currency = 'CNY'; $service = 'tenpay'; $bank = '财付通'; ZOrder::OnlineIt($order_id, $v_oid, $v_amount, $currency, $service, $bank); $show = WEB_ROOT . "/order/pay.php?id={$order_id}"; $resHandler->doShow($show); die(0); } } include template('order_return_error');
redirect(WEB_ROOT . '/credit/index.php'); } /* end charge */ $currency = 'CNY'; $service = 'yeepay'; $bank = '易宝'; ZOrder::OnlineIt($order_id, $r6_Order, $r3_Amt, $currency, $service, $bank); redirect(WEB_ROOT . "/order/pay.php?id={$order_id}"); } else { if ($r9_BType == "2") { //如果需要应答机制则必须回写流,以success开头,大小写不敏感. /* charge */ if ($_ == 'charge') { @(list($_, $order_id, $create_time, $_) = explode('-', $r6_Order, 4)); $service = 'yeepay'; if (ZFlow::CreateFromCharge($r3_Amt, $order_id, $create_time, $service)) { Session::Set('notice', "在线充值{$v_amount}元成功!"); } redirect(WEB_ROOT . '/credit/index.php'); } /* end charge */ $currency = 'CNY'; $service = 'yeepay'; $bank = '易宝'; ZOrder::OnlineIt($order_id, $r6_Order, $r3_Amt, $currency, $service, $bank); //redirect(WEB_ROOT . "/order/pay.php?id={$order_id}"); ob_end_clean(); die('SUCCESS'); } } }
$signString = $amount . "|" . $payamount . "|" . $orderid . "|" . $serialno . "|" . $status . "|" . $merid . "|" . $paychannel . "|" . $discount . "|" . $signtype . "|" . $paytime . "|" . $ctype . "|" . $prono . "|" . $prodesc . "|" . $remark1 . "|" . $remark2 . "|" . $ex; if ($signtype == "2") { $md5key = $INI['sdopay']['sec']; $mac2 = md5($signString . "|" . $md5key); $ok = strtoupper($mac) == strtoupper($mac2); } @(list($_, $order_id, $city_id, $_) = explode('-', $orderid, 4)); if (Table::Fetch('pay', $orderid)) { die('OK'); } //echo $order_id; //exit; if ($_ == 'charge') { if ($ok == 1) { @(list($_, $user_id, $create_time, $_) = explode('-', $orderid, 4)); ZFlow::CreateFromCharge($amount, $user_id, $create_time, 'sdopay', $serialno); die("OK"); //必须输出且只能输出"OK" } } if ($ok == 1) { $currency = 'CNY'; $service = 'sdopay'; $bank = '盛付通'; ZOrder::OnlineIt($order_id, $orderid, $amount, $currency, $service, $bank, $serialno); die('OK'); //必须输出且只能输出"OK" } elseif ($ok == 0) { die('bad'); } else { die('ugly, error checking signature');
$transport = 'http'; /* very import, this value is add by my phpframewrok */ unset($_GET['param']); /* end */ $alipay = new AlipayNotify($partner, $security_code, $sign_type, $_input_charset, $transport); $verify_result = $alipay->return_verify(); $out_trade_no = $_GET['out_trade_no']; //获取订单号 $total_fee = $_GET['total_fee']; //获取总价格 @(list($_, $order_id, $city_id, $_) = explode('-', $out_trade_no, 4)); if ($_ == 'charge') { if ($verify_result) { if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') { @(list($_, $user_id, $create_time, $_) = explode('-', $out_trade_no, 4)); if (ZFlow::CreateFromCharge($total_fee, $user_id, $create_time, 'alipay')) { Session::Set('notice', "支付宝充值{$total_fee}元成功!"); } } } redirect(WEB_ROOT . '/credit/index.php'); } if ($verify_result) { if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') { $currency = 'CNY'; $service = 'alipay'; $bank = '支付宝'; ZOrder::OnlineIt($order_id, $out_trade_no, $total_fee, $currency, $service, $bank); redirect(WEB_ROOT . "/order/pay.php?id={$order_id}"); } else { if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {