EBS Payment Gateway Integration In ASP.net C#

Full code of EBS payment Gateway Integration in .net

Create Page name as pay.aspx and paste code


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="pay.aspx.cs" Inherits="new_pay_pay" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="Formvalidation.css"></link>
    <script type="text/javascript" src="FormValidation.js"></script>
    <style type="text/css">
        h1
        {
            font-family: 'Gentium Book Basic';
            font-size: 24pt;
            color: #08185A;
            font-weight: 100;
            margin-bottom: 0.1em;
        }
        h2.co
        {
            font-family: Arial,sans-serif;
            font-size: 24pt;
            color: #FFFFFF;
            margin-top: 0.1em;
            margin-bottom: 0.1em;
            font-weight: 100;
        }
        h3.co
        {
            font-family: Arial,sans-serif;
            font-size: 16pt;
            color: #000000;
            margin-top: 0.1em;
            margin-bottom: 0.1em;
            font-weight: 100;
        }
        h3
        {
            font-family: Arial,sans-serif;
            font-size: 30pt;
            color: #08185A;
        }
        body
        {
            font-family: Gentium Book Basic;
            font-size: 40pt;
            color: #08185A;
            margin-top: 0px;
        }
        th
        {
            font-size: 15px;
            background: #008080;
            color: #FFFFFF;
            font-weight: bold;
            height: 30px;
        }
        td
        {
            font-size: 15px;
        }
        .pageTitle
        {
            font-size: 24px;
        }
        #mode
        {
            width: 126px;
        }
    </style>
    <script language="JavaScript" type="text/javascript">
        function a2() {
            document.getElementById('a1').style.display = "none";
        }

        function checkit() {


            var value = document.getElementById('channel').value;

            if (value == '0') {
                document.getElementById('a1').style.display = "none";
            }
            else {
                document.getElementById('a1').style.display = "inline";

            }
        }

    </script>
</head>
<body onload="a2()" style="background-color: lightgray; margin-left: 300px; margin-right: 300px;
    margin-top: 0px;">
    <center>
        <div style="background-color:white;">
    <form runat="server" name="frmTransaction" id="frmTransaction" onsubmit="return validateForm()" autocomplete="on" >
        <div>
           
            <h1>EBS - Version 3</h1>
           
            <table width="700" style="text-align:left; ">

                 <tr>
                    <th colspan="2">Request Details</th>
                </tr>
                <tr>
                    <td class="fieldName" width="50%">*Account Id</td>
                    <td align="left" width="50%"><input id="account_id" name="account_id" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName">*Channel</td>
                    <td align="left">
                        <select id="channel" name="channel" runat="server" onchange ="checkit()">
                            <option value="0" selected>Standard</option>
                            <option value="2">Direct</option>
                        </select>
                    </td>
                </tr>
              <tr>
                    <td class="fieldName" width="50%">*Currency</td>
                    <td align="left" width="50%"> <select id="currency" name="currency" runat="server" onchange ="checkit()">
                            <option value="INR" selected>INR</option>
                            <option value="GBP">GBP</option>
                         <option value="EUR">EUR</option>
                            <option value="USD">USD</option>
                        </select>

                </tr>
               
                <tr>
                    <td class="fieldName">*Return URL</td>
                    <td align="left"><input id="return_url" name="return_url" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName">*Mode</td>
                   <td align="left"><input id="mode" name="mode" type="text" value="LIVE" runat="server" readonly="true"/></td>
                </tr>

                <tr>
    <td class="fieldName"><span class="error">*</span>Secure Hash Algorithm</td>
    <td align="left"> <select id="algo" name="algo" runat="server">
      <option value="MD5">MD5</option>
      <option value="SHA1">SHA1</option>   
      <option value="SHA512">SHA512</option>
    </select></td>
               
                <tr>
                    <th colspan="2">Transaction Details</th>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Reference Number</td>
                    <td align="left" width="50%"><input id="reference_no" name="reference_no" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Sale Amount</td>
                    <td align="left" width="50%"><input id="amount" name="amount" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                     <td class="fieldName"><span class="error">*</span>Description</td>
                    <td align="left" width="50%"><input id="description" name="description" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <th colspan="2">Billing Address</th>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span> Name</td>
                    <td align="left"><input id="name" name="name" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Address</td>
                    <td align="left"><input id="address" name="address" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>City</td>
                    <td align="left"><input id="city" name="city" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName">*State/Province</td>
                    <td align="left"><input id="state" name="state" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>ZIP/Postal Code</td>
                    <td align="left"><input id="postal_code" name="postal_code" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Country</td>
                    <td align="left">
                        <select name="country" id="country" runat="server">
                            <option value=""></option>
                            <option value="ABW">Aruba</option>
                            <option value="AFG">Afghanistan</option>
                            <option value="AGO">Angola</option>
                            <option value="AIA">Anguilla</option>
                            <option value="ALA">Ã…land Islands</option>
                            <option value="ALB">Albania</option>
                            <option value="AND">Andorra</option>
                            <option value="ANT">Netherlands Antilles</option>
                            <option value="ARE">United Arab Emirates</option>
                            <option value="ARG">Argentina</option>
                            <option value="ARM">Armenia</option>
                            <option value="ASM">American Samoa</option>
                            <option value="ATA">Antarctica</option>
                            <option value="ATF">French Southern Territories</option>
                            <option value="ATG">Antigua and Barbuda</option>
                            <option value="AUS">Australia</option>
                            <option value="AUT">Austria</option>
                            <option value="AZE">Azerbaijan</option>
                            <option value="BDI">Burundi</option>
                            <option value="BEL">Belgium</option>
                            <option value="BEN">Benin</option>
                            <option value="BFA">Burkina Faso</option>
                            <option value="BGD">Bangladesh</option>
                            <option value="BGR">Bulgaria</option>
                            <option value="BHR">Bahrain</option>
                            <option value="BHS">Bahamas</option>
                            <option value="BIH">Bosnia and Herzegovina</option>
                            <option value="BLM">Saint Barthélemy</option>
                            <option value="BLR">Belarus</option>
                            <option value="BLZ">Belize</option>
                            <option value="BMU">Bermuda</option>
                            <option value="BOL">Bolivia</option>
                            <option value="BRA">Brazil</option>
                            <option value="BRB">Barbados</option>
                            <option value="BRN">Brunei Darussalam</option>
                            <option value="BTN">Bhutan</option>
                            <option value="BVT">Bouvet Island</option>
                            <option value="BWA">Botswana</option>
                            <option value="CAF">Central African Republic</option>
                            <option value="CAN">Canada</option>
                            <option value="CCK">Cocos (Keeling) Islands</option>
                            <option value="CHE">Switzerland</option>
                            <option value="CHL">Chile</option>
                            <option value="CHN">China</option>
                            <option value="CIV">Côte d`Ivoire</option>
                            <option value="CMR">Cameroon</option>
                            <option value="COD">Congo, the Democratic Republic of the</option>
                            <option value="COG">Congo</option>
                            <option value="COK">Cook Islands</option>
                            <option value="COL">Colombia</option>
                            <option value="COM">Comoros</option>
                            <option value="CPV">Cape Verde</option>
                            <option value="CRI">Costa Rica</option>
                            <option value="CUB">Cuba</option>
                            <option value="CXR">Christmas Island</option>
                            <option value="CYM">Cayman Islands</option>
                            <option value="CYP">Cyprus</option>
                            <option value="CZE">Czech Republic</option>
                            <option value="DEU">Germany</option>
                            <option value="DJI">Djibouti</option>
                            <option value="DMA">Dominica</option>
                            <option value="DNK">Denmark</option>
                            <option value="DOM">Dominican Republic</option>
                            <option value="DZA">Algeria</option>
                            <option value="ECU">Ecuador</option>
                            <option value="EGY">Egypt</option>
                            <option value="ERI">Eritrea</option>
                            <option value="ESH">Western Sahara</option>
                            <option value="ESP">Spain</option>
                            <option value="EST">Estonia</option>
                            <option value="ETH">Ethiopia</option>
                            <option value="FIN">Finland</option>
                            <option value="FJI">Fiji</option>
                            <option value="FLK">Falkland Islands (Malvinas)</option>
                            <option value="FRA">France</option>
                            <option value="FRO">Faroe Islands</option>
                            <option value="FSM">Micronesia, Federated States of</option>
                            <option value="GAB">Gabon</option>
                            <option value="GBR">United Kingdom</option>
                            <option value="GEO">Georgia</option>
                            <option value="GGY">Guernsey</option>
                            <option value="GHA">Ghana</option>
                            <option value="GIN">N Guinea</option>
                            <option value="GIB">Gibraltar</option>
                            <option value="GLP">Guadeloupe</option>
                            <option value="GMB">Gambia</option>
                            <option value="GNB">Guinea-Bissau</option>
                            <option value="GNQ">Equatorial Guinea</option>
                            <option value="GRC">Greece</option>
                            <option value="GRD">Grenada</option>
                            <option value="GRL">Greenland</option>
                            <option value="GTM">Guatemala</option>
                            <option value="GUF">French Guiana</option>
                            <option value="GUM">Guam</option>
                            <option value="GUY">Guyana</option>
                            <option value="HKG">Hong Kong</option>
                            <option value="HMD">Heard Island and McDonald Islands</option>
                            <option value="HND">Honduras</option>
                            <option value="HRV">Croatia</option>
                            <option value="HTI">Haiti</option>
                            <option value="HUN">Hungary</option>
                            <option value="IDN">Indonesia</option>
                            <option value="IMN">Isle of Man</option>
                            <option value="IND" selected="selected">India</option>
                            <option value="IOT">British Indian Ocean Territory</option>
                            <option value="IRL">Ireland</option>
                            <option value="IRN">Iran, Islamic Republic of</option>
                            <option value="IRQ">Iraq</option>
                            <option value="ISL">Iceland</option>
                            <option value="ISR">Israel</option>
                            <option value="ITA">Italy</option>
                            <option value="JAM">Jamaica</option>
                            <option value="JEY">Jersey</option>
                            <option value="JOR">Jordan</option>
                            <option value="JPN">Japan</option>
                            <option value="KAZ">Kazakhstan</option>
                            <option value="KEN">Kenya</option>
                            <option value="KGZ">Kyrgyzstan</option>
                            <option value="KHM">Cambodia</option>
                            <option value="KIR">Kiribati</option>
                            <option value="KNA">Saint Kitts and Nevis</option>
                            <option value="KOR">Korea, Republic of</option>
                            <option value="KWT">Kuwait</option>
                            <option value="LAO">Lao People`s Democratic Republic</option>
                            <option value="LBN">Lebanon</option>
                            <option value="LBR">Liberia</option>
                            <option value="LBY">Libyan Arab Jamahiriya</option>
                            <option value="LCA">Saint Lucia</option>
                            <option value="LIE">Liechtenstein</option>
                            <option value="LKA">Sri Lanka</option>
                            <option value="LSO">Lesotho</option>
                            <option value="LTU">Lithuania</option>
                            <option value="LUX">Luxembourg</option>
                            <option value="LVA">Latvia</option>
                            <option value="MAC">Macao</option>
                            <option value="MAF">Saint Martin (French part)</option>
                            <option value="MAR">Morocco</option>
                            <option value="MCO">Monaco</option>
                            <option value="MDA">Moldova</option>
                            <option value="MDG">Madagascar</option>
                            <option value="MDV">Maldives</option>
                            <option value="MEX">Mexico</option>
                            <option value="MHL">Marshall Islands</option>
                            <option value="MKD">Macedonia, the former Yugoslav Republic of</option>
                            <option value="MLI">Mali</option>
                            <option value="MLT">Malta</option>
                            <option value="MMR">Myanmar</option>
                            <option value="MNE">Montenegro</option>
                            <option value="MNG">Mongolia</option>
                            <option value="MNP">Northern Mariana Islands</option>
                            <option value="MOZ">Mozambique</option>
                            <option value="MRT">Mauritania</option>
                            <option value="MSR">Montserrat</option>
                            <option value="MTQ">Martinique</option>
                            <option value="MUS">Mauritius</option>
                            <option value="MWI">Malawi</option>
                            <option value="MYS">Malaysia</option>
                            <option value="MYT">Mayotte</option>
                            <option value="NAM">Namibia</option>
                            <option value="NCL">New Caledonia</option>
                            <option value="NER">Niger</option>
                            <option value="NFK">Norfolk Island</option>
                            <option value="NGA">Nigeria</option>
                            <option value="NIC">Nicaragua</option>
                            <option value="NOR">R Norway</option>
                            <option value="NIU">Niue</option>
                            <option value="NLD">Netherlands</option>
                            <option value="NPL">Nepal</option>
                            <option value="NRU">Nauru</option>
                            <option value="NZL">New Zealand</option>
                            <option value="OMN">Oman</option>
                            <option value="PAK">Pakistan</option>
                            <option value="PAN">Panama</option>
                            <option value="PCN">Pitcairn</option>
                            <option value="PER">Peru</option>
                            <option value="PHL">Philippines</option>
                            <option value="PLW">Palau</option>
                            <option value="PNG">Papua New Guinea</option>
                            <option value="POL">Poland</option>
                            <option value="PRI">Puerto Rico</option>
                            <option value="PRK">Korea, Democratic People`s Republic of</option>
                            <option value="PRT">Portugal</option>
                            <option value="PRY">Paraguay</option>
                            <option value="PSE">Palestinian Territory, Occupied</option>
                            <option value="PYF">French Polynesia</option>
                            <option value="QAT">Qatar</option>
                            <option value="REU">Réunion</option>
                            <option value="ROU">Romania</option>
                            <option value="RUS">Russian Federation</option>
                            <option value="RWA">Rwanda</option>
                            <option value="SAU">Saudi Arabia</option>
                            <option value="SDN">Sudan</option>
                            <option value="SEN">Senegal</option>
                            <option value="SGP">Singapore</option>
                            <option value="SGS">South Georgia and the South Sandwich Islands</option>
                            <option value="SHN">Saint Helena</option>
                            <option value="SJM">Svalbard and Jan Mayen</option>
                            <option value="SLB">Solomon Islands</option>
                            <option value="SLE">Sierra Leone</option>
                            <option value="SLV">El Salvador</option>
                            <option value="SMR">San Marino</option>
                            <option value="SOM">Somalia</option>
                            <option value="SPM">Saint Pierre and Miquelon</option>
                            <option value="SRB">Serbia</option>
                            <option value="STP">Sao Tome and Principe</option>
                            <option value="SUR">Suriname</option>
                            <option value="SVK">Slovakia</option>
                            <option value="SVN">Slovenia</option>
                            <option value="SWE">Sweden</option>
                            <option value="SWZ">Swaziland</option>
                            <option value="SYC">Seychelles</option>
                            <option value="SYR">Syrian Arab Republic</option>
                            <option value="TCA">Turks and Caicos Islands</option>
                            <option value="TCD">Chad</option>
                            <option value="TGO">Togo</option>
                            <option value="THA">Thailand</option>
                            <option value="TJK">Tajikistan</option>
                            <option value="TKL">Tokelau</option>
                            <option value="TKM">Turkmenistan</option>
                            <option value="TLS">Timor-Leste</option>
                            <option value="TON">Tonga</option>
                            <option value="TTO">Trinidad and Tobago</option>
                            <option value="TUN">Tunisia</option>
                            <option value="TUR">Turkey</option>
                            <option value="TUV">Tuvalu</option>
                            <option value="TWN">Taiwan, Province of China</option>
                            <option value="TZA">Tanzania, United Republic of</option>
                            <option value="UGA">Uganda</option>
                            <option value="UKR">Ukraine</option>
                            <option value="UMI">United States Minor Outlying Islands</option>
                            <option value="URY">Uruguay</option>
                            <option value="USA">United States</option>
                            <option value="UZB">Uzbekistan</option>
                            <option value="VAT">Holy See (Vatican City State)</option>
                            <option value="VCT">Saint Vincent and the Grenadines</option>
                            <option value="VEN">Venezuela</option>
                            <option value="VGB">Virgin Islands, British</option>
                            <option value="VIR">Virgin Islands, U.S.</option>
                            <option value="VNM">Viet Nam</option>
                            <option value="VUT">Vanuatu</option>
                            <option value="WLF">Wallis and Futuna</option>
                            <option value="WSM">Samoa</option>
                            <option value="YEM">Yemen</option>
                            <option value="ZAF">South Africa</option>
                            <option value="ZMB">Zambia</option>
                            <option value="ZWE">Zimbabwe</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Email</td>
                    <td align="left"><input id="email" name="email" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Telephone</td>
                    <td align="left"><input id="phone" name="phone" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <th colspan="2">Shipping Details</th>
                </tr>
             <tr>
                    <td class="fieldName"><span class="error">*</span>Ship Name</td>
                    <td align="left"><input id="ship_name" name="ship_name" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Ship Address</td>
                    <td align="left"><input id="ship_address" name="ship_address" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName"><span class="error">*</span>Ship City</td>
                    <td align="left"><input id="ship_city" name="ship_city" type="text" value="" runat="server" /></td>
                </tr>
                <tr>
                    <td class="fieldName">*Ship State</td>
                    <td align="left"><input id="ship_state" name="ship_state" type="text" value="" runat="server" /></td>
                </tr>
                 <tr>
                    <td class="fieldName"><span class="error">*</span>Ship Country</td>
                    <td align="left">
                        <select name="ship_country" id="ship_country" runat="server">
                            <option value=""></option>
                            <option value="ABW">Aruba</option>
                            <option value="AFG">Afghanistan</option>
                            <option value="AGO">Angola</option>
                            <option value="AIA">Anguilla</option>
                            <option value="ALA">Ã…land Islands</option>
                            <option value="ALB">Albania</option>
                            <option value="AND">Andorra</option>
                            <option value="ANT">Netherlands Antilles</option>
                            <option value="ARE">United Arab Emirates</option>
                            <option value="ARG">Argentina</option>
                            <option value="ARM">Armenia</option>
                            <option value="ASM">American Samoa</option>
                            <option value="ATA">Antarctica</option>
                            <option value="ATF">French Southern Territories</option>
                            <option value="ATG">Antigua and Barbuda</option>
                            <option value="AUS">Australia</option>
                            <option value="AUT">Austria</option>
                            <option value="AZE">Azerbaijan</option>
                            <option value="BDI">Burundi</option>
                            <option value="BEL">Belgium</option>
                            <option value="BEN">Benin</option>
                            <option value="BFA">Burkina Faso</option>
                            <option value="BGD">Bangladesh</option>
                            <option value="BGR">Bulgaria</option>
                            <option value="BHR">Bahrain</option>
                            <option value="BHS">Bahamas</option>
                            <option value="BIH">Bosnia and Herzegovina</option>
                            <option value="BLM">Saint Barthélemy</option>
                            <option value="BLR">Belarus</option>
                            <option value="BLZ">Belize</option>
                            <option value="BMU">Bermuda</option>
                            <option value="BOL">Bolivia</option>
                            <option value="BRA">Brazil</option>
                            <option value="BRB">Barbados</option>
                            <option value="BRN">Brunei Darussalam</option>
                            <option value="BTN">Bhutan</option>
                            <option value="BVT">Bouvet Island</option>
                            <option value="BWA">Botswana</option>
                            <option value="CAF">Central African Republic</option>
                            <option value="CAN">Canada</option>
                            <option value="CCK">Cocos (Keeling) Islands</option>
                            <option value="CHE">Switzerland</option>
                            <option value="CHL">Chile</option>
                            <option value="CHN">China</option>
                            <option value="CIV">Côte d`Ivoire</option>
                            <option value="CMR">Cameroon</option>
                            <option value="COD">Congo, the Democratic Republic of the</option>
                            <option value="COG">Congo</option>
                            <option value="COK">Cook Islands</option>
                            <option value="COL">Colombia</option>
                            <option value="COM">Comoros</option>
                            <option value="CPV">Cape Verde</option>
                            <option value="CRI">Costa Rica</option>
                            <option value="CUB">Cuba</option>
                            <option value="CXR">Christmas Island</option>
                            <option value="CYM">Cayman Islands</option>
                            <option value="CYP">Cyprus</option>
                            <option value="CZE">Czech Republic</option>
                            <option value="DEU">Germany</option>
                            <option value="DJI">Djibouti</option>
                            <option value="DMA">Dominica</option>
                            <option value="DNK">Denmark</option>
                            <option value="DOM">Dominican Republic</option>
                            <option value="DZA">Algeria</option>
                            <option value="ECU">Ecuador</option>
                            <option value="EGY">Egypt</option>
                            <option value="ERI">Eritrea</option>
                            <option value="ESH">Western Sahara</option>
                            <option value="ESP">Spain</option>
                            <option value="EST">Estonia</option>
                            <option value="ETH">Ethiopia</option>
                            <option value="FIN">Finland</option>
                            <option value="FJI">Fiji</option>
                            <option value="FLK">Falkland Islands (Malvinas)</option>
                            <option value="FRA">France</option>
                            <option value="FRO">Faroe Islands</option>
                            <option value="FSM">Micronesia, Federated States of</option>
                            <option value="GAB">Gabon</option>
                            <option value="GBR">United Kingdom</option>
                            <option value="GEO">Georgia</option>
                            <option value="GGY">Guernsey</option>
                            <option value="GHA">Ghana</option>
                            <option value="GIN">N Guinea</option>
                            <option value="GIB">Gibraltar</option>
                            <option value="GLP">Guadeloupe</option>
                            <option value="GMB">Gambia</option>
                            <option value="GNB">Guinea-Bissau</option>
                            <option value="GNQ">Equatorial Guinea</option>
                            <option value="GRC">Greece</option>
                            <option value="GRD">Grenada</option>
                            <option value="GRL">Greenland</option>
                            <option value="GTM">Guatemala</option>
                            <option value="GUF">French Guiana</option>
                            <option value="GUM">Guam</option>
                            <option value="GUY">Guyana</option>
                            <option value="HKG">Hong Kong</option>
                            <option value="HMD">Heard Island and McDonald Islands</option>
                            <option value="HND">Honduras</option>
                            <option value="HRV">Croatia</option>
                            <option value="HTI">Haiti</option>
                            <option value="HUN">Hungary</option>
                            <option value="IDN">Indonesia</option>
                            <option value="IMN">Isle of Man</option>
                            <option value="IND" selected="selected">India</option>
                            <option value="IOT">British Indian Ocean Territory</option>
                            <option value="IRL">Ireland</option>
                            <option value="IRN">Iran, Islamic Republic of</option>
                            <option value="IRQ">Iraq</option>
                            <option value="ISL">Iceland</option>
                            <option value="ISR">Israel</option>
                            <option value="ITA">Italy</option>
                            <option value="JAM">Jamaica</option>
                            <option value="JEY">Jersey</option>
                            <option value="JOR">Jordan</option>
                            <option value="JPN">Japan</option>
                            <option value="KAZ">Kazakhstan</option>
                            <option value="KEN">Kenya</option>
                            <option value="KGZ">Kyrgyzstan</option>
                            <option value="KHM">Cambodia</option>
                            <option value="KIR">Kiribati</option>
                            <option value="KNA">Saint Kitts and Nevis</option>
                            <option value="KOR">Korea, Republic of</option>
                            <option value="KWT">Kuwait</option>
                            <option value="LAO">Lao People`s Democratic Republic</option>
                            <option value="LBN">Lebanon</option>
                            <option value="LBR">Liberia</option>
                            <option value="LBY">Libyan Arab Jamahiriya</option>
                            <option value="LCA">Saint Lucia</option>
                            <option value="LIE">Liechtenstein</option>
                            <option value="LKA">Sri Lanka</option>
                            <option value="LSO">Lesotho</option>
                            <option value="LTU">Lithuania</option>
                            <option value="LUX">Luxembourg</option>
                            <option value="LVA">Latvia</option>
                            <option value="MAC">Macao</option>
                            <option value="MAF">Saint Martin (French part)</option>
                            <option value="MAR">Morocco</option>
                            <option value="MCO">Monaco</option>
                            <option value="MDA">Moldova</option>
                            <option value="MDG">Madagascar</option>
                            <option value="MDV">Maldives</option>
                            <option value="MEX">Mexico</option>
                            <option value="MHL">Marshall Islands</option>
                            <option value="MKD">Macedonia, the former Yugoslav Republic of</option>
                            <option value="MLI">Mali</option>
                            <option value="MLT">Malta</option>
                            <option value="MMR">Myanmar</option>
                            <option value="MNE">Montenegro</option>
                            <option value="MNG">Mongolia</option>
                            <option value="MNP">Northern Mariana Islands</option>
                            <option value="MOZ">Mozambique</option>
                            <option value="MRT">Mauritania</option>
                            <option value="MSR">Montserrat</option>
                            <option value="MTQ">Martinique</option>
                            <option value="MUS">Mauritius</option>
                            <option value="MWI">Malawi</option>
                            <option value="MYS">Malaysia</option>
                            <option value="MYT">Mayotte</option>
                            <option value="NAM">Namibia</option>
                            <option value="NCL">New Caledonia</option>
                            <option value="NER">Niger</option>
                            <option value="NFK">Norfolk Island</option>
                            <option value="NGA">Nigeria</option>
                            <option value="NIC">Nicaragua</option>
                            <option value="NOR">R Norway</option>
                            <option value="NIU">Niue</option>
                            <option value="NLD">Netherlands</option>
                            <option value="NPL">Nepal</option>
                            <option value="NRU">Nauru</option>
                            <option value="NZL">New Zealand</option>
                            <option value="OMN">Oman</option>
                            <option value="PAK">Pakistan</option>
                            <option value="PAN">Panama</option>
                            <option value="PCN">Pitcairn</option>
                            <option value="PER">Peru</option>
                            <option value="PHL">Philippines</option>
                            <option value="PLW">Palau</option>
                            <option value="PNG">Papua New Guinea</option>
                            <option value="POL">Poland</option>
                            <option value="PRI">Puerto Rico</option>
                            <option value="PRK">Korea, Democratic People`s Republic of</option>
                            <option value="PRT">Portugal</option>
                            <option value="PRY">Paraguay</option>
                            <option value="PSE">Palestinian Territory, Occupied</option>
                            <option value="PYF">French Polynesia</option>
                            <option value="QAT">Qatar</option>
                            <option value="REU">Réunion</option>
                            <option value="ROU">Romania</option>
                            <option value="RUS">Russian Federation</option>
                            <option value="RWA">Rwanda</option>
                            <option value="SAU">Saudi Arabia</option>
                            <option value="SDN">Sudan</option>
                            <option value="SEN">Senegal</option>
                            <option value="SGP">Singapore</option>
                            <option value="SGS">South Georgia and the South Sandwich Islands</option>
                            <option value="SHN">Saint Helena</option>
                            <option value="SJM">Svalbard and Jan Mayen</option>
                            <option value="SLB">Solomon Islands</option>
                            <option value="SLE">Sierra Leone</option>
                            <option value="SLV">El Salvador</option>
                            <option value="SMR">San Marino</option>
                            <option value="SOM">Somalia</option>
                            <option value="SPM">Saint Pierre and Miquelon</option>
                            <option value="SRB">Serbia</option>
                            <option value="STP">Sao Tome and Principe</option>
                            <option value="SUR">Suriname</option>
                            <option value="SVK">Slovakia</option>
                            <option value="SVN">Slovenia</option>
                            <option value="SWE">Sweden</option>
                            <option value="SWZ">Swaziland</option>
                            <option value="SYC">Seychelles</option>
                            <option value="SYR">Syrian Arab Republic</option>
                            <option value="TCA">Turks and Caicos Islands</option>
                            <option value="TCD">Chad</option>
                            <option value="TGO">Togo</option>
                            <option value="THA">Thailand</option>
                            <option value="TJK">Tajikistan</option>
                            <option value="TKL">Tokelau</option>
                            <option value="TKM">Turkmenistan</option>
                            <option value="TLS">Timor-Leste</option>
                            <option value="TON">Tonga</option>
                            <option value="TTO">Trinidad and Tobago</option>
                            <option value="TUN">Tunisia</option>
                            <option value="TUR">Turkey</option>
                            <option value="TUV">Tuvalu</option>
                            <option value="TWN">Taiwan, Province of China</option>
                            <option value="TZA">Tanzania, United Republic of</option>
                            <option value="UGA">Uganda</option>
                            <option value="UKR">Ukraine</option>
                            <option value="UMI">United States Minor Outlying Islands</option>
                            <option value="URY">Uruguay</option>
                            <option value="USA">United States</option>
                            <option value="UZB">Uzbekistan</option>
                            <option value="VAT">Holy See (Vatican City State)</option>
                            <option value="VCT">Saint Vincent and the Grenadines</option>
                            <option value="VEN">Venezuela</option>
                            <option value="VGB">Virgin Islands, British</option>
                            <option value="VIR">Virgin Islands, U.S.</option>
                            <option value="VNM">Viet Nam</option>
                            <option value="VUT">Vanuatu</option>
                            <option value="WLF">Wallis and Futuna</option>
                            <option value="WSM">Samoa</option>
                            <option value="YEM">Yemen</option>
                            <option value="ZAF">South Africa</option>
                            <option value="ZMB">Zambia</option>
                            <option value="ZWE">Zimbabwe</option>
                        </select>
                    </td>
                </tr>

                  <tr>
                    <td class="fieldName"><span class="error">*</span>Ship Phone</td>
                    <td align="left"><input id="ship_phone" name="ship_phone" type="text" value="" runat="server" /></td>
                </tr>
                  <tr>
                    <td class="fieldName"><span class="error">*</span>Ship Postal Code</td>
                    <td align="left"><input id="ship_postal_code" name="ship_postal_code" type="text" value="" runat="server" /></td>
                </tr>
                     
                <tr>
                    <td valign="top" align="center" colspan="2">
                        <span class="error">*</span> <span>denotes required field</span>
                    </td>
                </tr>
                <tr>
                    <td valign="top" align="center" colspan="2">
                        <asp:Button ID="submitted" runat="server" Text="Submit" onclick="submitted_Click" OnClientClick="cardvalidate();    " />
                        <input id="submitted1" name="submit1" value="Submit" type="submit" runat="server" visible="false" />&nbsp;
                        <input value="Reset" type="reset" />
                       
                    </td>
                </tr>

   </table>
        </div>

                       
                      <div id="a1">
                                      <table width="700" style="text-align:left;">  
                            <tr>
                    <th colspan="2" id="a">Card details</th>
                </tr>
                <tr>
                    <td class="fieldName" width="50%">*Name on Card</td>
                    <td align="left" width="50%"><input id="name_on_card" name="name_on_card" type="text" value="" runat="server" /></td>
                </tr>

                     <tr>
                    <td class="fieldName" width="50%">*Card Number</td>
                    <td align="left" width="50%"><input id="card_number" name="card_number" type="text" value="" runat="server" /></td>
                </tr>
               
              <tr>
                    <td class="fieldName" width="50%">*Card Expiry</td>
                    <td align="left" width="50%"><input id="card_expiry" name="card_expiry" type="text" value="" runat="server"/></td>
                </tr>
                       <tr>
                    <td class="fieldName" width="50%">*CVV</td>
                    <td align="left" width="50%"><input id="card_cvv" name="card_cvv" type="password" value="" runat="server"/></td>
                </tr></table>
                
               </div>
                      

</form>
            </div>
        </center>
</body>
</html>

Paste code in pay.aspx.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections.Specialized;

public partial class new_pay_pay : System.Web.UI.Page
{
    protected void submitted_Click(object sender, EventArgs e)
    {

        string Url = "hash.aspx";
        string Method = "post";
        string FormName = "form1";

        NameValueCollection FormFields = new NameValueCollection();

        FormFields.Add("account_id", account_id.Value);
        FormFields.Add("channel", channel.Value);
        FormFields.Add("currency", currency.Value);
        FormFields.Add("reference_no", reference_no.Value);
        FormFields.Add("amount", amount.Value);
        FormFields.Add("description", description.Value);
        FormFields.Add("name", name.Value);
        FormFields.Add("address", address.Value);
        FormFields.Add("city", city.Value);
        FormFields.Add("state", state.Value);
        FormFields.Add("postal_code", postal_code.Value);
        FormFields.Add("country", country.Value);
        FormFields.Add("email", email.Value);
        FormFields.Add("phone", phone.Value);
        FormFields.Add("mode", mode.Value);
        FormFields.Add("return_url", return_url.Value);
        FormFields.Add("ship_name", ship_name.Value);
        FormFields.Add("ship_address", ship_address.Value);
        FormFields.Add("ship_city", ship_city.Value);
        FormFields.Add("ship_state", ship_state.Value);
        FormFields.Add("ship_country", ship_country.Value );
        FormFields.Add("ship_phone", ship_phone.Value);
        FormFields.Add("algo", algo.Value);
        FormFields.Add("ship_postal_code", ship_postal_code.Value);
        if (channel.Value == "2")
        {


            FormFields.Add("name_on_card", name_on_card.Value);
            FormFields.Add("card_number", card_number.Value);
            FormFields.Add("card_expiry", card_expiry.Value);
            FormFields.Add("card_cvv", card_cvv.Value);
        }
        else
        {
            FormFields.Add("name_on_card", "null");
            FormFields.Add("card_number", "null");
            FormFields.Add("card_expiry", "null");
            FormFields.Add("card_cvv", "null");
        }
        Response.Clear();
        Response.Write("<html><head>");
        Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
        Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, Method, Url));
        for (int i = 0; i < FormFields.Keys.Count; i++)
        {
            Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\">", FormFields.Keys[i], FormFields[FormFields.Keys[i]]));
        }
        Response.Write("</form>");
        Response.Write("</body></html>");
        Response.End();

    }

    protected void Page_Load(object sender, EventArgs e)
    {
        submitted.OnClientClick = "return validateForm()";

    }
}


Create page Hash.aspx leave it blank on code behind past code.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography;
using System.Text;
using System.Collections;

public partial class new_pay_hash : System.Web.UI.Page
{

    static int Compare1(KeyValuePair<string, string> a, KeyValuePair<string, string> b)
    {
        return a.Key.CompareTo(b.Key);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        string name = Request.Form["algo"];
        if (Request.HttpMethod == "POST")
        {

            //Response.Write(name);

            string hashValue = "ebskey"; //Pass your Registered secret key available from EBS secure portal
            string V3URL = "https://secure.ebs.in/pg/ma/payment/request";

            string HashData = hashValue;

            List<KeyValuePair<string, string>> postparamslist = new List<KeyValuePair<string, string>>();

            for (int i = 0; i < Request.Form.Keys.Count; i++)
            {
                KeyValuePair<string, string> postparam = new KeyValuePair<string, string>(Request.Form.Keys[i], Request.Form[i]);

                if (Request.Form.Keys[i] != "V3URL" && Request.Form.Keys[i] != "submitted")
                    postparamslist.Add(postparam);
            }

            postparamslist.Sort(Compare1);

            foreach (KeyValuePair<string, string> param in postparamslist)
            {
                HashData += "|" + param.Value;
            }

            string hashedvalue = "";

            if (hashValue.Length > 0)
            {

                hashedvalue += computeHash(HashData, name);
            }



            string FormName = "form1";
            string Method = "post";

            Response.Clear();
            Response.Write("<html><head>");
            Response.Write("<META HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"no-store, no-cache, must-revalidate\" />");
            Response.Write("<META HTTP-EQUIV=\"PRAGMA\" CONTENT=\"no-store, no-cache, must-revalidate\" />");
            Response.Write(string.Format("</head><body onload=\"document.{0}.submit()\">", FormName));
            Response.Write(string.Format("<form name=\"{0}\" method=\"{1}\" action=\"{2}\" >", FormName, Method, V3URL));

            foreach (KeyValuePair<string, string> param in postparamslist)
            {
                Response.Write(string.Format("<input name=\"{0}\" type=\"hidden\" value=\"{1}\" />", param.Key, param.Value));
            }
            // Response.Write("<input type=\"hidden\" name=\"response\" value=" + md5HashData + " />");
            Response.Write("<input type=\"hidden\" name=\"secure_hash\" value=" + hashedvalue + " />");
            Response.Write("</form>");
            Response.Write("</body></html>");
            Response.End();

        }
    }

    static string computeHash(string input, string name)
    {

        byte[] data = null;
        switch (name)
        {

            case "MD5":
                data = HashAlgorithm.Create("MD5").ComputeHash(Encoding.ASCII.GetBytes(input));
                break;
            case "SHA1":
                data = HashAlgorithm.Create("SHA1").ComputeHash(Encoding.ASCII.GetBytes(input));
                break;
            case "SHA512":
                data = HashAlgorithm.Create("SHA512").ComputeHash(Encoding.ASCII.GetBytes(input));
                break;
            default:
                break;
        }

        StringBuilder sBuilder = new StringBuilder();

        for (int i = 0; i < data.Length; i++)
        {
            sBuilder.Append(data[i].ToString("x2"));
        }

        return sBuilder.ToString().ToUpper();

    }
}


Now create page response.aspx  in code behind past code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography;
using System.Text;
using System.Collections;
public partial class new_pay_Response : System.Web.UI.Page
{
    static int Compare1(KeyValuePair<string, string> a, KeyValuePair<string, string> b)
    {
        return a.Key.CompareTo(b.Key);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        List<KeyValuePair<string, string>> postparamslist = new List<KeyValuePair<string, string>>();

        if (Request.HttpMethod == "GET")
        {

            for (int i = 0; i < Request.QueryString.Keys.Count; i++)
            {
                KeyValuePair<string, string> postparam = new KeyValuePair<string, string>(Request.QueryString.Keys[i], Request.QueryString[i]);


                postparamslist.Add(postparam);
            }


        }


        else
        {

            for (int i = 0; i < Request.Form.Keys.Count; i++)
            {
                KeyValuePair<string, string> postparam = new KeyValuePair<string, string>(Request.Form.Keys[i], Request.Form[i]);


                postparamslist.Add(postparam);
            }
        }

        postparamslist.Sort(Compare1);


        string HashData = "your secret key here"; //Pass Your SecretKey Here
        string resp_hd = Request.Params["SecureHash"];
        int rc = Convert.ToInt32(Request.Params["ResponseCode"]);
        string rflag = Request.Params["IsFlagged"];

        foreach (KeyValuePair<string, string> param in postparamslist)
        {
            if (param.Key != "SecureHash" && param.Value != "")
                HashData += "|" + param.Value;
        }

        string hashedvalue = "";




        hashedvalue += computeHash(HashData);

        if (hashedvalue == resp_hd)
        {
            if (rc == 0)
            {
                if (rflag == "NO")
                    Response.Write("<center>Your Transaction was successful</center>");
                else
                    Response.Write("<center>Your payment is kept on hold</center>");
            }
            else if (rc == 1)
                Response.Write("<center>Your payment is pending</center>"); //ResponseCode '1' is only applcable for NEFT/Challan based payments
            else
                Response.Write("<center>Your transaction failed</center>");
        }

        else
            Response.Write("<center>Hash Validation Failed!</center>");



        Response.Write("<center><table>");
        Response.Write("<tr><th colspan=\"2\">Transaction Details</th></tr>");

        foreach (KeyValuePair<string, string> param in postparamslist)
        {

            Response.Write("<tr><td>" + param.Key + "</td><td>" + param.Value + "</td></tr>");

        }

        Response.Write("</table></center>");





    }
    static string computeHash(string input)
    {

        byte[] data = null;

     
        data = HashAlgorithm.Create("SHA512").ComputeHash(Encoding.ASCII.GetBytes(input));


        StringBuilder sBuilder = new StringBuilder();

        for (int i = 0; i < data.Length; i++)
        {
            sBuilder.Append(data[i].ToString("x2"));
        }

        return sBuilder.ToString().ToUpper();

    }
}




Account ID - 5880
Secret key – ebskey
mode - TEST


Following Card no can be used for testing phase

Card No        : 4111111111111111
Exp Date      : 07/2020
CVV              : 123
Name of the Issuing Bank: EBS


Follow or leave a comment if you have liked it or its helpful for you.




Comments

  1. please add code for response.aspx ..above response.aspx code is same as hash.aspx code

    ReplyDelete
    Replies
    1. Hi Sorry for the inconvenience, i have updated now you can check.

      Delete

Post a Comment

Popular posts from this blog

Disable right click, Inspect Element and page source using JavaScript in Html and asp.net

Select distinct value from data table in SQL