<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="vi" xml:lang="vi">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Kết quả trả về thành công </title>
</head>
<body>	
<?php 
include 'NL_Checkoutv3.php';
$nlcheckout = new NL_CheckOutV3('45525', '2daa09faf06829a2d97bcde3b8ee2003', '*****@*****.**', 'https://www.nganluong.vn/checkout.api.nganluong.post.php');
$nl_result = $nlcheckout->GetTransactionDetail($_GET['token']);
if ($nl_result) {
    $nl_errorcode = (string) $nl_result->error_code;
    $nl_transaction_status = (string) $nl_result->transaction_status;
    if ($nl_errorcode == '00') {
        if ($nl_transaction_status == '00') {
            //trạng thái thanh toán thành công
            echo "<pre>";
            print_r($nl_result);
            echo "</pre>";
            echo "Cập nhật trạng thái thành công";
        }
    } else {
        echo $nlcheckout->GetErrorMessage($nl_errorcode);
    }
}
?>
</body>	
</html>		
<!-- http://localhost/Codeigniter-Project/home/pay_thank?order_code=ACEMVDWA_1457968979&error_code=00&token=1010012-641c9dcf6127f9bc63f5c661ab0e68fa -->
示例#2
0
 /**
  * [success description]
  * @return [type] [description]
  */
 public function success()
 {
     log_message('gash', 'Nganluong $_GET: ' . json_encode($_GET));
     $token = $this->input->get('token');
     if (empty($token)) {
         log_message('gash', 'NganLuong: not receive token');
         return;
     }
     $order_info = $this->pay_model->get_order_by_tradeseq($token);
     if (empty($order_info)) {
         $msg = $this->recharge_lang['ask_to_contact'];
         $this->CI->payorder->over($msg);
         log_message('gash', 'Nganluong: no token exists. Token: ' . $order_info->tradeseq);
     } else {
         $msg = $this->recharge_lang['ask_to_contact'];
         //初始设置msg为失败
         $merchant_info = $this->pay_model->get_merchant_data_by_id($order_info->merchant_id);
         $this->merchant_id = $merchant_info[0]->merchant_name;
         $this->merchant_pass = $merchant_info[0]->merchant_key;
         $this->receiver = $merchant_info[0]->merchant_key2;
         $nlcheckout = new NL_CheckOutV3($this->merchant_id, $this->merchant_pass, $this->receiver);
         $nl_result = $nlcheckout->GetTransactionDetail($token);
         log_message('gash', 'Nganluong result: ' . json_encode($nl_result));
         if ($nl_result) {
             $nl_errorcode = (string) $nl_result->error_code;
             $nl_transaction_status = (string) $nl_result->transaction_status;
             if ($nl_errorcode == '00') {
                 if ($nl_transaction_status == '00' || $nl_transaction_status == '04') {
                     //transaction success
                     $ret = $this->payorder->update_order_to_get_payment(array('order_sn' => $order_info->order_sn));
                     if ($ret !== true) {
                         log_message('GASH', 'Nganluong: update order to get payment false!');
                     }
                     // offer yuanbao
                     if ($order_info->offer_yuanbao == 1) {
                         log_message('GASH', 'Nganluong error : before offer service, order_status offer_yuanbao is already 1!');
                         return;
                     }
                     $offer_ret = $this->offer_service($order_info->order_sn, $order_info->game_id);
                     // $offer_ret['status']=1;
                     if (!$offer_ret['status']) {
                         log_message('gash', 'Nganluong error: offer yuanbao failed.');
                     } else {
                         $ret = $this->payorder->update_order_to_offer_service(array('order_sn' => $order_info->order_sn));
                         $msg = $this->recharge_lang['recharge_success'];
                         //设置msg为充值成功
                         $order_info = $this->pay_model->get_order_by_tradeseq($token);
                         $this->CI->payorder->over($msg, $order_info->order_sn);
                     }
                     $this->CI->payorder->over($msg);
                 }
             } else {
                 log_message('gash', 'Nganluong error_code:' . json_encode($nlcheckout->GetErrorMessage($nl_errorcode)));
             }
         }
         $this->CI->payorder->over($msg);
     }
 }