-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcallback.php
More file actions
175 lines (118 loc) · 6.13 KB
/
callback.php
File metadata and controls
175 lines (118 loc) · 6.13 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
// following files need to be included
require_once("./lib/config_paytm.php");
require_once("./lib/encdec_paytm.php");
$paytmChecksum = "";
$paramList = array();
$isValidChecksum = "FALSE";
$paramList = $_POST;
$paytmChecksum = isset($_POST["CHECKSUMHASH"]) ? $_POST["CHECKSUMHASH"] : ""; //Sent by Paytm pg
//Verify all parameters received from Paytm pg to your application. Like MID received from paytm pg is same as your application’s MID, TXN_AMOUNT and ORDER_ID are same as what was sent by you to Paytm PG for initiating transaction etc.
$isValidChecksum = verifychecksum_e($paramList, PAYTM_MERCHANT_KEY, $paytmChecksum); //will return TRUE or FALSE string.
?>
<!DOCTYPE html>
<html lang="en">
<!------ Include the below in your HEAD tag ---------->
<?php
include "include/head.php";
?>
<!------ Include the above in your HEAD tag ---------->
<body class="jumbotron">
<!------ Include the below in your NAV tag ---------->
<?php
include "include/nav.php";
?>
<!------ Include the above in your NAV tag ---------->
<?php
if($isValidChecksum == "TRUE") {
if ($_POST["STATUS"] == "TXN_SUCCESS")
{ // if success
echo '<div class="jumbotron text-center">
<i class="fas fa-check-circle" style="font-size: 78px;color:#4bc14e;"></i>
<h1>Thank You for your purchase!</h1>
<small style="padding:10px;background:#ddd;color:#7f7f7f;border-radius:5px;">Transation# '.$_POST["TXNID"].'</small>
<a href="kart.php" class="btn btn-success"><i class="fas fa-arrow-circle-left" ></i> Back</a>
</div>';
?>
<div class="container-fluid">
<div class="row ">
<div class="col-md-4"></div>
<div class="col-md-4">
<h4>Your transation status has been successfully processed.</h4>
<ul class="list-group">
<?php
$i = 0;
if (isset($_POST) && count($_POST)>0 )
{
foreach($_POST as $paramName => $paramValue) {
$i++;
if($i !==3 && $i !==6 && $i !==8 && $i !==10 && $i !==12 && $i !==14) // hidden array values (3=>TXNID,6=>CURRENCYINR,8=>STATUS,10=>RESPMSG,12=>BANKTXNID)
{
echo '<li class="list-group-item">
<small>(Array no. '.$i.')</small>
<strong>'.$paramName.'</strong>
<span class="badge">'.$paramValue.'</span>
</li>';
continue;
}
}
}
?>
</ul>
</div>
</div>
</div>
<?php
}
else {
//if failure
echo '<div class="jumbotron text-center">
<i class="fas fa-times-circle text-danger" style="font-size: 78px;"></i>
<h1>Transaction status failure!</h1>
<a href="kart.php" class="btn btn-success"><i class="fas fa-arrow-circle-left" ></i> Back</a>
</div>';
?>
<div class="container-fluid">
<div class="row ">
<div class="col-md-8" style="margin-left: 300px;">
<h4>Your transation status has been failed.</br>
Paytm Responce code:
<a href="https://developer.paytm.com/assets/Transaction%20response%20codes%20and%20messages.pdf" target="_blank">PDF</a> </h4></br>
<ul class="list-group">
<?php
if (isset($_POST) && count($_POST)>0 )
{
echo '<li class="list-group-item">
<strong>RESPCODE</strong>
<span class="badge">'.$_POST['RESPCODE'].'</span>
</li>';
echo '<li class="list-group-item">
<strong>RESPMSG</strong>
<span class="badge">'.$_POST['RESPMSG'].'</span>
</li>';
}
?>
</ul>
</div>
</div>
</div>
<?php
}
?>
<?php
}
else {
//if checksum not match
echo '<div class="jumbotron text-center">
<i class="fas fa-times-circle text-danger" style="font-size: 78px;"></i>
<h1>Checksum mismatched.!</h1>
<small style="padding:10px;background:#ddd;color:#7f7f7f;border-radius:5px;">Process transaction is suspicious. Someone altered the transaction details.</small>
<a href="kart.php" class="btn btn-success"><i class="fas fa-arrow-circle-left" ></i> Back</a>
</div>';
}
?>
</body>
</html>