title: Paypal Ipn integration with asp.net MVC
body: <p><strong>HomeControler/Index.cshtml page is as below</strong>    </p>
  
  <pre><code>&lt;div id="paypalDiv"&gt;
  
          &lt;form id="paypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"&gt;
              &lt;fieldset&gt;
                  &lt;p class="inline-small-label" style="padding-top: 7px;"&gt;
                      &lt;label for="device-id"&gt;&lt;span&gt;User ID&lt;/span&gt;&lt;/label&gt;&lt;/p&gt;
  
                  &lt;input id="custom" class="full-width" type="text" name="custom" value=""&gt;
                  &lt;input class="full-width" type="hidden" name="business" value="sampath-facilitator@inexisconsulting.com"&gt;
                  &lt;input type="hidden" name="cmd" value="_xclick"&gt;
                  &lt;input type="hidden" name="item_name" value="credits"&gt;
                  &lt;input type="hidden" name="item_number" value="40"&gt;
                  &lt;input type="hidden" name="amount" value="2.95"&gt;
                  &lt;input type="hidden" name="no_shipping" value="1"&gt;
                  &lt;input type="hidden" name="return" value="http://localhost:13769"&gt;
                  &lt;input type="hidden" name="notify_url" value="https://localhost:13769/Home/Ipn"&gt;
                  &lt;button class="btn btn-primary submit-button" type="submit"&gt;Pay with PayPal&lt;/button&gt;
              &lt;/fieldset&gt;
  
          &lt;/form&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>HomeControler/Ipn Action method is as below</strong>  </p>
  
  <pre><code>public ActionResult Ipn()
  {
      // Receive IPN request from PayPal and parse all the variables returned
      var formVals = new Dictionary&lt;string, string&gt;();
  
      formVals.Add("cmd", "_notify-validate");
  
      // if you want to use the PayPal sandbox change this from false to true
      string response = GetPayPalResponse(formVals, false);
  
      if (response == "VERIFIED")
      {
          string transactionID = Request["txn_id"];
          string sAmountPaid = Request["mc_gross"];
          string deviceID = Request["custom"];
  
          //validate the order
          Decimal amountPaid = 0;
          Decimal.TryParse(sAmountPaid, out amountPaid);
  
          if (sAmountPaid == "2.95")
          {
              // take the information returned and store this into a subscription table
              // this is where you would update your database with the details of the tran
  
              return View();
  
          }
          else
          {
              // let fail - this is the IPN so there is no viewer
              // you may want to log something here
          }
      }
  
      return View();
  }
  </code></pre>
  
  <p>My question is even after payment has been done, above Ipn action method is not firing.Cannot debug.How could I do that ?</p>