-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathCallback.aspx.cs
More file actions
52 lines (47 loc) · 1.57 KB
/
Callback.aspx.cs
File metadata and controls
52 lines (47 loc) · 1.57 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using paytm;
public partial class Callback : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String merchantKey = "MPcGd0ghcT%jAOghhgUD5A"; // Replace the with the Merchant Key provided by Paytm at the time of registration.
Dictionary<string, string> parameters = new Dictionary<string, string>();
string paytmChecksum = "";
foreach (string key in Request.Form.Keys)
{
parameters.Add(key.Trim(), Request.Form[key].Trim());
}
if (parameters.ContainsKey("CHECKSUMHASH"))
{
paytmChecksum = parameters["CHECKSUMHASH"];
parameters.Remove("CHECKSUMHASH");
}
if (CheckSum.verifyCheckSum(merchantKey, parameters, paytmChecksum))
{
string paytmStatus = parameters["STATUS"];
string txnId = parameters["TXNID"];
pTxnId.InnerText = "Transaction Id : " + txnId;
if (paytmStatus == "TXN_SUCCESS")
{
h1Message.InnerText = "Your payment is success";
}
else if (paytmStatus == "PENDING")
{
h1Message.InnerText = "Payment is pending !";
}
else if (paytmStatus == "TXN_FAILURE")
{
h1Message.InnerText = "Payment Failure !";
}
}
else
{
Response.Write("Checksum MisMatch");
}
}
}