$order_description = ''; $tax_amount = 0; $fee_shipping = 0; $return_url = "http://{$domain}/payment-info/{$order_code}/"; $cancel_url = urlencode("http://{$domain}/payment-error/"); $buyer_fullname = $_POST['buyer_fullname']; $buyer_email = $_POST['buyer_email']; $buyer_mobile = $_POST['buyer_mobile']; $buyer_address = ''; if ($payment_method != '' && $buyer_email != "" && $buyer_mobile != "" && $buyer_fullname != "" && filter_var($buyer_email, FILTER_VALIDATE_EMAIL)) { /*insert database*/ $expire_date = time() + 60 * 1 * 1 * 1; setcookie('error_thanhtoan', $result[1], $expire_date, "/", ""); $tc->insert_khachhang($order_code, $buyer_fullname, $_POST['country'], 'U', $buyer_email, $buyer_mobile, $_SERVER['REMOTE_ADDR'], '', '00', 'TTQT', $row_detail['id']); if ($payment_method == "VISA") { $nl_result = $nlcheckout->VisaCheckout($order_code, $total_amount, $payment_type, $order_description, $tax_amount, $fee_shipping, $discount_amount, $return_url, $cancel_url, $buyer_fullname, $buyer_email, $buyer_mobile, $buyer_address, $array_items); } elseif ($payment_method == "NL") { $nl_result = $nlcheckout->NLCheckout($order_code, $total_amount, $payment_type, $order_description, $tax_amount, $fee_shipping, $discount_amount, $return_url, $cancel_url, $buyer_fullname, $buyer_email, $buyer_mobile, $buyer_address, $array_items); } elseif ($payment_method == "ATM_ONLINE" && $bank_code != '') { $nl_result = $nlcheckout->BankCheckout($order_code, $total_amount, $bank_code, $payment_type, $order_description, $tax_amount, $fee_shipping, $discount_amount, $return_url, $cancel_url, $buyer_fullname, $buyer_email, $buyer_mobile, $buyer_address, $array_items); } $tc->update_khachhang_guidi($order_code, (string) $nl_result->checkout_url . '&lang=en'); if ($nl_result->error_code == '00') { //Cập nhât order với token $nl_result->token để sử dụng check hoàn thành sau này //https://www.nganluong.vn/checkout.api.nganluong.post.php?cur_code=usd&function=SetExpressCheckout&version=3.1&merchant_id=24338&receiver_email=hoannet@gmail.com&merchant_password=f1bfd514f667cebd7595218b5a40d5b1&order_code=228&total_amount=0.1&payment_method=VISA&payment_type=&order_description=&tax_amount=0&fee_shipping=0&discount_amount=0&return_url=http://smiletouristvietnam.com/book/successpayment&cancel_url=http://smiletouristvietnam.com/book/successpayment&buyer_fullname=&buyer_email=&buyer_mobile=&buyer_address=&total_item=1&item_name1=228&item_quantity1=1&item_amount1=0.1&item_url1=http://nganluong.vn/ $script = '<script type="text/javascript"> <!-- window.location = "' . (string) $nl_result->checkout_url . '&lang=en" //--> </script>'; } else {