How to integrate Paytm to asp.net site
You will need to create an Checksum on your server. Kindly refer the dll file for the attachment. Usage of CheckSum API:
· Add provided “paytm.dll” as a “Reference” in your project.
· Import namespace “paytm” in your Class with statement “using paytm”.
· Now Generate CheckSum API as well as Verify CheckSum API are available as follows:
o String CheckSum.generateCheckSum(String masterKey, Dictionary<String, String> parameters)
o Boolean CheckSum.verifyCheckSum(String masterKey, Dictionary<String, String> parameters, StringcheckSum)
· For Generating CheckSum, use following snippet code:
String masterKey = “merchantKey” ;
Dictionary<String, String> parameters = new Dictionary<string, string>();
parameters.Add("CHANNEL_ID", "WEB");
parameters.Add("TXN_AMOUNT", "1");
String checkSum = CheckSum.generateCheckSum(masterKey, parameters);
· For Verifying CheckSum, use following snippet code
String masterKey = “merchantKey” ;
Dictionary<String, String> parameters = new Dictionary<string,string>();
parameters.Add("CHANNEL_ID", "WEB"); parameters.Add("TXN_AMOUNT", "1");
String checkSum = "CheckSumProvided" ;
Boolean success = CheckSum.verifyCheckSum(masterKey, parameters, checkSum);step-2
String masterKey = "mn7aZS_yRfUvIDSH";
string orderid = "D" + DateTime.Now.Ticks.ToString();
Dictionary<String, String> parameters = new Dictionary<string, string>();
parameters.Add("MID", "NET4U191715600977433");
parameters.Add("ORDER_ID", orderid);
parameters.Add("CUST_ID", "455451");
parameters.Add("CHANNEL_ID", "WEB");
parameters.Add("TXN_AMOUNT", "2");
parameters.Add("INDUSTRY_TYPE_ID", "Retail");
parameters.Add("WEBSITE", "net4u");
String checkSum = CheckSum.generateCheckSum(masterKey, parameters);
StringBuilder ppForm = new StringBuilder();
{
ppForm.AppendFormat(@"<form name='frmPP' id='frmPP' action='https://pguat.paytm.com/oltp-web/processTransaction' method='post'>
<input type='hidden' name='MID' value='NET4U191715600977433'>
<input type='hidden' name='ORDER_ID' value='" + orderid + "'>");
ppForm.AppendFormat(@" <input type='hidden' name='CUST_ID' value='455451'>
<input type='hidden' name='TXN_AMOUNT' value='2'>
<input type='hidden' name='CHANNEL_ID' value='WEB'>
<input type='hidden' name='INDUSTRY_TYPE_ID' value='Retail'>
<input type='hidden' name='WEBSITE' value='net4u'>
<input type='hidden' name='CHECKSUMHASH' value='" + checkSum + "'>");
ppForm.AppendFormat(@" <input type='submit'>
</form>");
}
Response.Write(ppForm.ToString());
Comments
Post a Comment