Exemplo n.º 1
0
        global $link;
        header('location:' . $link);
    }
}
// THANH TOÁN THẤT BẠI
function fail()
{
    desession();
    global $link;
    echo '<meta charset="utf-8"/><script>alert("Giao dịch không thành công !"); 
	window.location="' . $link . '";</script>';
}
if ($_SESSION['payment'] == 'nganluong') {
    $obj = new NL_MicroCheckout(MERCHANT_ID, MERCHANT_PASS, URL_WS);
    if ($obj->checkReturnUrlAuto()) {
        $inputs = array('token' => $obj->getTokenCode());
        $result = $obj->getExpressCheckout($inputs);
        if ($result != false) {
            if ($result['result_code'] != '00') {
                fail();
            }
        } else {
            die('<meta charset="utf-8"/>Lỗi kết nối tới cổng thanh toán Ngân Lượng');
        }
    } else {
        die('<meta charset="utf-8"/>Tham số truyền không đúng');
    }
    $code = $_SESSION['code'];
    $pass = $_SESSION['pass'];
    $link = '';
    if (isset($result) && !empty($result)) {
<?
include('database.php');
include('include/lib/nusoap.php');
include('include/nganluong.microcheckout.class.php');

//khai bao
$obj = new NL_MicroCheckout(MERCHANT_ID, MERCHANT_PASS, URL_WS);

if ($obj->checkReturnUrlAuto()) {
	$inputs = array(
		'token'		=> $obj->getTokenCode(),//$token_code,
	);
	$result = $obj->getExpressCheckout($inputs);
	if ($result != false) {
		if ($result['result_code'] != '00') {
			die('Mã lỗi '.$result['result_code'].' ('.$result['result_description'].') ');
		}
	} else {
		die('Lỗi kết nối tới cổng thanh toán Ngân Lượng');
	}
} else {
	die('Tham số truyền không đúng');
}

if (isset($result) && !empty($result)) {
	if ($result['result_code'] == '00') {

		$transaction_info = $result['method_payment_name'];
		$order_code = @$_GET['order_code'];
		$payment_id = $result['transaction_id'];
		$payment_type = $result['transaction_type'];