當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AlipayNotify類代碼示例

本文整理匯總了PHP中AlipayNotify的典型用法代碼示例。如果您正苦於以下問題:PHP AlipayNotify類的具體用法?PHP AlipayNotify怎麽用?PHP AlipayNotify使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了AlipayNotify類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: alipay_notify_app

 /**
  * App支付Notify
  */
 function alipay_notify_app()
 {
     $alipay_config_app = $this->config->item('alipay_config_app');
     $alipayNotify = new AlipayNotify($alipay_config_app);
     $verify_result = $alipayNotify->verifyNotify();
     if ($verify_result) {
         //驗證成功
         $out_trade_no = $_POST['out_trade_no'];
         //支付寶交易號
         $trade_no = $_POST['trade_no'];
         //交易狀態
         $trade_status = $_POST['trade_status'];
         $this->log_result('alipay_notify', "【支付寶回調App】:\n" . json_encode($_POST) . "\n");
         if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
             //判斷該筆訂單是否在商戶網站中已經做過處理
             //如果沒有做過處理,根據訂單號(out_trade_no)在商戶網站的訂單係統中查到該筆訂單的詳細,並執行商戶的業務程序
             //如果有做過處理,不執行商戶的業務程序
             $order = $this->order_model->get_order_info($out_trade_no);
             if ($order['TradeStatus'] != 'TRADE_FINISHED' && $order['TradeStatus'] != 'TRADE_SUCCESS') {
                 $data = array('TradeStatus' => $trade_status, 'TradeNo' => $trade_no, 'PayTime' => time(), 'PayType' => 'alipay');
                 $this->order_model->update_order_info($out_trade_no, $data);
             }
         }
         //——請根據您的業務邏輯來編寫程序(以上代碼僅作參考)——
         echo "success";
         //請不要修改或刪除
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     } else {
         //驗證失敗
         echo "fail";
         //調試用,寫文本函數記錄程序運行情況是否正常
         //logResult("這裏寫入想要調試的代碼變量值,或其他運行的結果記錄");
     }
 }
開發者ID:iyakexi,項目名稱:app-pay-server-demo,代碼行數:37,代碼來源:order.php

示例2: respond

    function respond() {
        
        ini_set("display_errors","On");
        $where = array('ologin_code'=>front::$get['ologin_code']);
        $ologins = ologin::getInstance()->getrows($where);
        $ologin = unserialize_config($ologins[0]['ologin_config']);

        //var_dump($ologin);
        
        $aliapy_config['partner'] = $ologin['alipaylogin_id'];
        $aliapy_config['key'] = $ologin['alipaylogin_key'];
        $aliapy_config['return_url'] = ologin::url(basename(__FILE__,'.php'));
        $aliapy_config['sign_type']    = 'MD5';
        $aliapy_config['input_charset']= 'utf-8';
        $aliapy_config['transport']    = 'http';
        $aliapy_config['cacert']    = getcwd().'/lib/plugins/alipayauth/cacert.pem';
        //var_dump($aliapy_config);
        unset($_GET['case']);unset($_GET['act']);unset($_GET['ologin_code']);unset($_GET['site']);
        require_once("alipayauth/alipay_notify.class.php");
        $alipayNotify = new AlipayNotify($aliapy_config);
        //var_dump($alipayNotify);
        $verify_result = $alipayNotify->verifyReturn();
        //var_dump($verify_result);
        if($verify_result) {//驗證成功
            $user_id = front::$get['user_id'];
            $token = front::$get['token'];
            session::set('access_token',$token);
            session::set("openid",$user_id);
            return array('nickname'=>  front::get('real_name'));
        }
        else {
            echo "驗證失敗";exit;
        }
    }
開發者ID:jiangsuei8,項目名稱:public_php_shl,代碼行數:34,代碼來源:alipaylogin.php

示例3: verifyReturn

 public function verifyReturn()
 {
     require_once "alipay.config.php";
     require_once "lib/alipay_notify.class.php";
     $alipayNotify = new \AlipayNotify($alipay_config);
     return $alipayNotify->verifyReturn();
 }
開發者ID:torry999,項目名稱:lingshi,代碼行數:7,代碼來源:Alipay.class.php

示例4: ValidateNotification

 public function ValidateNotification($txn_id = null)
 {
     parent::ValidateNotification($txn_id);
     $alipay_config = $this->_getConfig();
     $alipayNotify = new AlipayNotify($alipay_config);
     return $alipayNotify->getResponse($txn_id);
 }
開發者ID:openbizx,項目名稱:openbizx-cubix,代碼行數:7,代碼來源:Alipay.php

示例5: actionAlipayOrderReturn

 public function actionAlipayOrderReturn()
 {
     require_once Yii::getAlias('@vendor') . "/payment/alipay/alipay.config.php";
     require_once Yii::getAlias('@vendor') . "/payment/alipay/lib/alipay_notify.class.php";
     $alipayNotify = new \AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyReturn();
     if ($verify_result) {
         $out_trade_no = $_GET['out_trade_no'];
         $trade_no = $_GET['trade_no'];
         $trade_status = $_GET['trade_status'];
         $model = Order::findOne(['order_sn' => $out_trade_no]);
         if ($model) {
             if ($trade_status === 'TRADE_SUCCESS' || $trade_status === 'TRADE_FINISHED') {
                 if ($model->pay()) {
                     $this->_sendMsg($model);
                     Yii::info("訂單支付成功!訂單號:{$out_trade_no}");
                 } else {
                     Yii::error("訂單支付失敗!訂單號:{$out_trade_no}");
                     Yii::$app->session->setFlash('danger', '訂單支付失敗!');
                 }
             } elseif ($trade_status === 'TRADE_CLOSED') {
                 Yii::$app->session->setFlash('warning', '訂單未支付!');
             }
         }
     } else {
         throw new ForbiddenHttpException('參數非法。');
     }
     return $this->redirect(['/order/detail', 'order' => $model->order_sn]);
 }
開發者ID:daixianceng,項目名稱:xiaoego.com,代碼行數:29,代碼來源:PaymentController.php

示例6: notify

 public function notify($req)
 {
     require_once __DIR__ . '/mobiAlipay/lib/alipay_notify.class.php';
     //計算得出通知驗證結果
     $alipayNotify = new AlipayNotify($this->mobiAlipayConfig);
     $verifyResult = $alipayNotify->verifyNotify();
     if ($verifyResult) {
         //商戶訂單號
         $out_trade_no = $req['out_trade_no'];
         //支付寶交易號
         $trade_no = $req['trade_no'];
         //交易狀態
         $trade_status = $req['trade_status'];
         if ($req['trade_status'] == 'TRADE_FINISHED' || $req['trade_status'] == 'TRADE_SUCCESS') {
             //處理訂單狀態
             $uid = (new \Mall\Mdu\OrderModule())->setOrderStatus($out_trade_no, $_SERVER['REQUEST_TIME']);
             if ($uid != 0) {
                 (new \Mall\Mdu\OrderLogsModule())->addOrderLogBySn($out_trade_no, $this->di['sysconfig']['orderActType']['successPayment'], $uid, '用戶', '支付成功');
                 echo 'success';
             } else {
                 echo 'fail';
             }
         }
     } else {
         echo "fail";
     }
 }
開發者ID:nicklos17,項目名稱:littlemall,代碼行數:27,代碼來源:MobiAlipayClass.php

示例7: notify

 function notify()
 {
     //計算得出通知驗證結果
     $alipayNotify = new AlipayNotify($this->alipay_config);
     $verify_result = $alipayNotify->verifyNotify();
     $this->log('deposit/notify ' . 'verify:' . ($verify_result ? 'true' : 'false') . ' ' . json_encode($_POST, JSON_UNESCAPED_UNICODE));
     if ($verify_result) {
         //驗證成功
         //商戶訂單號
         $out_trade_no = $_POST['out_trade_no'];
         //支付寶交易號
         $trade_no = $_POST['trade_no'];
         //交易狀態
         $trade_status = $_POST['trade_status'];
         $deposit_id = intval($out_trade_no);
         if (!$deposit_id) {
             echo "fail";
             return FALSE;
         }
         $record = DB::fetch_first('SELECT * FROM ' . DB::table('user_deposit') . ' WHERE ' . DB::implode(array('id' => $deposit_id)));
         if (!$record) {
             echo "fail";
             return FALSE;
         }
         if ($record['status'] == TRADE_FINISHED) {
             echo "success";
             return TRUE;
         }
         switch ($trade_status) {
             case 'WAIT_BUYER_PAY':
                 DB::update('user_deposit', array('trade_no' => $trade_no, 'status' => WAIT_BUYER_PAY, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
                 break;
             case 'TRADE_CLOSED':
                 DB::update('user_deposit', array('status' => TRADE_CLOSED, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
                 break;
             case 'WAIT_SELLER_SEND_GOODS':
                 $this->send_goods($record, $trade_no);
                 DB::update('user_deposit', array('status' => WAIT_BUYER_CONFIRM, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
                 break;
             case 'WAIT_BUYER_CONFIRM_GOODS':
                 DB::update('user_deposit', array('status' => WAIT_BUYER_CONFIRM, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
                 break;
             case 'TRADE_SUCCESS':
                 DB::update('user_deposit', array('status' => TRADE_UNSUPPORTED, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
                 break;
             case 'TRADE_FINISHED':
                 DB::update('user_deposit', array('status' => TRADE_FINISHED, 'updatetime' => TIMESTAMP), array('id' => $deposit_id));
                 if ($record && $record['uid']) {
                     DB::query('UPDATE ' . DB::table('user_status') . ' SET ' . DB::quote_field('balance') . ' = ' . DB::quote_field('balance') . ' + ' . $record['price'] . ' WHERE ' . DB::implode(array('uid' => $record['uid'])));
                 }
                 break;
         }
         $this->log('deposit/notify id:' . $deposit_id . ' ' . $trade_status);
         echo "success";
         return TRUE;
     } else {
         echo "fail";
         return FALSE;
     }
 }
開發者ID:huiwei19,項目名稱:oursustc-php,代碼行數:60,代碼來源:alipay.php

示例8: actionNotifyUrl

 public function actionNotifyUrl()
 {
     //計算得出通知驗證結果
     $alipayNotify = new \AlipayNotify($this->alipayConfig());
     $verify_result = $alipayNotify->verifyNotify();
     if ($verify_result) {
         //驗證成功
         if ($_REQUEST['trade_status'] == 'TRADE_FINISHED') {
             //退款日期超過可退款期限後(如三個月可退款),支付寶係統發送該交易狀態通知
             echo '退款';
         } else {
             if ($_REQUEST['trade_status'] == 'TRADE_SUCCESS') {
                 //付款完成後,支付寶係統發送該交易狀態通知
                 if (ChargeOrder::getInstance()->setOrderStatus($_REQUEST['out_trade_no'])) {
                     // 設置訂單狀態
                     return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
                 } else {
                     // 設置訂單狀態失敗
                     return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
                 }
             } else {
                 // 未付款
                 return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
             }
         }
         echo "success";
         //請不要修改或刪除
     } else {
         //驗證失敗
         echo "fail";
         return $this->redirect('http://wechat.baihey.com/wap/site/main#/charge_order?orderId=' . $_REQUEST['out_trade_no'] . '&payType=4');
     }
 }
開發者ID:xswolf,項目名稱:baihey,代碼行數:33,代碼來源:ChargeController.php

示例9: return_url

 public function return_url()
 {
     import("@.ORG.Alipay.AlipayNotify");
     $alipayNotify = new AlipayNotify($this->setconfig());
     $verify_result = $alipayNotify->verifyReturn();
     if ($verify_result) {
         //商戶訂單號
         $out_trade_no = $_GET['out_trade_no'];
         //支付寶交易號
         $trade_no = $_GET['trade_no'];
         //交易狀態
         $trade_status = $_GET['trade_status'];
         if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') {
             $indent = M('Indent')->field('id,price')->where(array('index_id' => $out_trade_no))->find();
             if ($indent !== false) {
                 //$back=M('Users')->where(array('id'=>$indent['uid']))->setInc('money',$indent['price']);
                 $back = M('Indent')->where(array('id' => $indent['id']))->setField('status', 1);
                 if ($back != false) {
                     $this->success('充值成功', U('Home/Index/index'));
                 } else {
                     $this->error('充值失敗,請在線客服,為您處理', U('Home/Index/index'));
                 }
             } else {
                 $this->error('訂單不存在', U('Home/Index/index'));
             }
         } else {
             $this->error('請勿重複操作', U('Home/Index/index'));
         }
     } else {
         $this->error('充值失敗 ,請在線客服,為您處理', U('Home/Index/index'));
     }
 }
開發者ID:dlpc,項目名稱:wxshoppingmall,代碼行數:32,代碼來源:AlipayAction.class.php

示例10: alipayNotify

 /**
  * 支付寶回調
  */
 public static function alipayNotify()
 {
     vendor('Alipay.Notify', COMMON_PATH . 'Vendor');
     $alipay_config = C('ALIPAY');
     $AlipayNotify = new \AlipayNotify($alipay_config);
     return $AlipayNotify->verifyNotify();
 }
開發者ID:Orchild,項目名稱:mt,代碼行數:10,代碼來源:Payment.class.php

示例11: return_url

 public function return_url()
 {
     import("@.ORG.Alipay.AlipayNotify");
     $alipayNotify = new AlipayNotify($this->setconfig());
     $verify_result = $alipayNotify->verifyReturn();
     if ($verify_result) {
         $out_trade_no = $this->_get('out_trade_no');
         $trade_no = $this->_get('trade_no');
         $trade_status = $this->_get('trade_status');
         if ($this->_get('trade_status') == 'TRADE_FINISHED' || $this->_get('trade_status') == 'TRADE_SUCCESS') {
             $product_cart_model = M('product_cart');
             $order = $product_cart_model->where(array('orderid' => $out_trade_no))->find();
             if (!$this->wecha_id) {
                 $this->wecha_id = $order['wecha_id'];
             }
             $sepOrder = 0;
             if (!$order) {
                 $order = $product_cart_model->where(array('id' => $out_trade_no))->find();
                 $sepOrder = 1;
             }
             if ($order) {
                 if ($order['paid'] == 1) {
                     exit('該訂單已經支付,請勿重複操作');
                 }
                 if (!$sepOrder) {
                     $product_cart_model->where(array('orderid' => $out_trade_no))->setField('paid', 1);
                 } else {
                     $product_cart_model->where(array('id' => $out_trade_no))->setField('paid', 1);
                 }
                 $member_card_create_db = M('Member_card_create');
                 $userCard = $member_card_create_db->where(array('token' => $this->token, 'wecha_id' => $this->wecha_id))->find();
                 $member_card_set_db = M('Member_card_set');
                 $thisCard = $member_card_set_db->where(array('id' => intval($userCard['cardid'])))->find();
                 $set_exchange = M('Member_card_exchange')->where(array('cardid' => intval($thisCard['id'])))->find();
                 $arr['token'] = $this->token;
                 $arr['wecha_id'] = $this->wecha_id;
                 $arr['expense'] = $order['price'];
                 $arr['time'] = time();
                 $arr['cat'] = 99;
                 $arr['staffid'] = 0;
                 $arr['score'] = intval($set_exchange['reward']) * $order['price'];
                 M('Member_card_use_record')->add($arr);
                 $userinfo_db = M('Userinfo');
                 $thisUser = $userinfo_db->where(array('token' => $thisCard['token'], 'wecha_id' => $arr['wecha_id']))->find();
                 $userArr = array();
                 $userArr['total_score'] = $thisUser['total_score'] + $arr['score'];
                 $userArr['expensetotal'] = $thisUser['expensetotal'] + $arr['expense'];
                 $userinfo_db->where(array('token' => $thisCard['token'], 'wecha_id' => $arr['wecha_id']))->save($userArr);
                 $this->redirect(U('Product/my', array('token' => $order['token'], 'wecha_id' => $order['wecha_id'], 'success' => 1)));
             } else {
                 exit('訂單不存在:' . $out_trade_no);
             }
         } else {
             exit('付款失敗');
         }
     } else {
         exit('不存在的訂單');
     }
 }
開發者ID:yakrsa,項目名稱:football,代碼行數:59,代碼來源:AlipaytypeAction.class.php

示例12: verifyAlipayNotify

function verifyAlipayNotify(array $alipayConfig)
{
    $alipayConfig = getAlipayConfig($alipayConfig);
    $alipayNotify = new AlipayNotify($alipayConfig);
    $verifyResult = (bool) $alipayNotify->verifyNotify();
    echo $verifyResult ? 'success' : 'fail';
    return $verifyResult;
}
開發者ID:omusico,項目名稱:ThinkSNS-4,代碼行數:8,代碼來源:alipay.php

示例13: check

 function check($result)
 {
     require_once "alipay/config.php";
     require_once "alipay/lib/alipay_notify.class.php";
     $alipayNotify = new \AlipayNotify($alipay_config);
     $verify_result = $alipayNotify->verifyReturn($result);
     return $verify_result;
 }
開發者ID:xingluxin,項目名稱:jianshen,代碼行數:8,代碼來源:AliPay.class.php

示例14: callback

 /**
  * 支付寶回調
  * @param unknown $aParams
  * @return Ambigous <驗證結果, boolean>
  */
 public static function callback($aParams)
 {
     require_once LIB_PATH . '/Payment/Alipay/alipay_service.class.php';
     require_once LIB_PATH . '/Payment/Alipay/alipay_notify.class.php';
     $alipay_config = Yaf_G::getConf('aliapy_config', null, 'alipay');
     $alipayNotify = new AlipayNotify($alipay_config);
     return $alipayNotify->verifyNotify($aParams);
 }
開發者ID:pancke,項目名稱:yyaf,代碼行數:13,代碼來源:Alipay.php

示例15: endPay

 function endPay($PassageInfo, $OrderInfo)
 {
     /* 商戶號 */
     $partner = $PassageInfo['StagePartnerId'];
     /* 密鑰 */
     $key = $PassageInfo['StageSecureCode'];
     require "AliPayClass/notify_url.php";
     //計算得出通知驗證結果
     $alipayNotify = new AlipayNotify($aliapy_config);
     $verify_result = $alipayNotify->verifyNotify();
     if ($verify_result) {
         //驗證成功
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
         //請在這裏加上商戶的業務邏輯程序代
         //——請根據您的業務邏輯來編寫程序(以下代碼僅作參考)——
         //獲取支付寶的通知返回參數,可參考技術文檔中服務器異步通知參數列表
         $out_trade_no = $_REQUEST['out_trade_no'];
         //獲取訂單號
         $trade_no = $_REQUEST['trade_no'];
         //獲取支付寶交易號
         $total_fee = $_REQUEST['total_fee'];
         //獲取總價格
         if ($OrderInfo['OrderId'] == $out_trade_no && $total_fee == $OrderInfo['Coin']) {
             $Pay['OrderId'] = $OrderInfo['OrderId'];
             $Pay['PayUserId'] = $OrderInfo['PayUserId'];
             $Pay['AcceptUserId'] = $OrderInfo['AcceptUserId'];
             $Pay['PassageId'] = $OrderInfo['PassageId'];
             $Pay['AppId'] = $OrderInfo['AppId'];
             $Pay['PartnerId'] = $OrderInfo['PartnerId'];
             $Pay['SubPassageId'] = $OrderInfo['SubPassageId'];
             $Pay['Amount'] = $OrderInfo['Amount'];
             $Pay['Coin'] = $OrderInfo['Coin'];
             $Pay['Credit'] = $OrderInfo['Credit'];
             $Pay['PayIP'] = $OrderInfo['PayIP'];
             $Pay['PayTime'] = $OrderInfo['PayTime'];
             $Pay['UserSourceId'] = $OrderInfo['UserSourceId'];
             $Pay['UserSourceDetail'] = $OrderInfo['UserSourceDetail'];
             $Pay['UserSourceProjectId'] = $OrderInfo['UserSourceProjectId'];
             $Pay['UserSourceActionId'] = $OrderInfo['UserSourceActionId'];
             $Pay['UserRegTime'] = $OrderInfo['UserRegTime'];
             $Pay['PayedTime'] = strtotime($_REQUEST['notify_time']);
             $Pay['StageOrder'] = $trade_no;
             $Pay['comment'] = json_encode(array('buyer_email' => $_REQUEST['buyer_email'], 'buyer_id' => $_REQUEST['buyer_id']));
             return $Pay;
         } else {
             return false;
         }
         //——請根據您的業務邏輯來編寫程序(以上代碼僅作參考)——
         echo "success";
         //請不要修改或刪除
         /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     } else {
         //驗證失敗
         echo "fail";
         //調試用,寫文本函數記錄程序運行情況是否正常
         //logResult("這裏寫入想要調試的代碼變量值,或其他運行的結果記錄");
     }
 }
開發者ID:eappl,項目名稱:prototype,代碼行數:58,代碼來源:AliTel.php


注:本文中的AlipayNotify類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。