forked from littlewind/demo-vnpay-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vnpay_return.php
106 lines (102 loc) · 4.02 KB
/
vnpay_return.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<title>VNPAY RESPONSE</title>
<!-- Bootstrap core CSS -->
<link href="/vnpay_php/assets/bootstrap.min.css" rel="stylesheet"/>
<!-- Custom styles for this template -->
<link href="/vnpay_php/assets/jumbotron-narrow.css" rel="stylesheet">
<script src="/vnpay_php/assets/jquery-1.11.3.min.js"></script>
</head>
<body>
<?php
require_once("./config.php");
$vnp_SecureHash = $_GET['vnp_SecureHash'];
$inputData = array();
foreach ($_GET as $key => $value) {
if (substr($key, 0, 4) == "vnp_") {
$inputData[$key] = $value;
}
}
unset($inputData['vnp_SecureHashType']);
unset($inputData['vnp_SecureHash']);
ksort($inputData);
$i = 0;
$hashData = "";
foreach ($inputData as $key => $value) {
if ($i == 1) {
$hashData = $hashData . '&' . $key . "=" . $value;
} else {
$hashData = $hashData . $key . "=" . $value;
$i = 1;
}
}
//$secureHash = md5($vnp_HashSecret . $hashData);
$secureHash = hash('sha256',$vnp_HashSecret . $hashData);
?>
<!--Begin display -->
<div class="container">
<div class="header clearfix">
<h3 class="text-muted">VNPAY RESPONSE</h3>
</div>
<div class="table-responsive">
<div class="form-group">
<label >Mã đơn hàng:</label>
<label><?php echo $_GET['vnp_TxnRef'] ?></label>
</div>
<div class="form-group">
<label >Số tiền:</label>
<label><?php echo $_GET['vnp_Amount'] ?></label>
</div>
<div class="form-group">
<label >Nội dung thanh toán:</label>
<label><?php echo $_GET['vnp_OrderInfo'] ?></label>
</div>
<div class="form-group">
<label >Mã phản hồi (vnp_ResponseCode):</label>
<label><?php echo $_GET['vnp_ResponseCode'] ?></label>
</div>
<div class="form-group">
<label >Mã GD Tại VNPAY:</label>
<label><?php echo $_GET['vnp_TransactionNo'] ?></label>
</div>
<div class="form-group">
<label >Mã Ngân hàng:</label>
<label><?php echo $_GET['vnp_BankCode'] ?></label>
</div>
<div class="form-group">
<label >Thời gian thanh toán:</label>
<label><?php echo $_GET['vnp_PayDate'] ?></label>
</div>
<div class="form-group">
<label >Kết quả:</label>
<label>
<?php
if ($secureHash == $vnp_SecureHash) {
if ($_GET['vnp_ResponseCode'] == '00') {
echo "GD Thanh cong";
} else {
echo "GD Khong thanh cong";
}
} else {
echo "Chu ky khong hop le";
}
?>
</label>
</div>
</div>
<p>
</p>
<footer class="footer">
<p>© VNPAY 2015</p>
</footer>
</div>
</body>
</html>