title: In IPN service of Paypal payment gateway, body of the notification request is undefined
body: <p>I am trying to integrate IPN service of Paypal payment gateway in node js using "paypal-rest-sdk" and "paypal-ipn". Everything works fine except IPN service. When the IPN API hit my server,the body of request seems undefined, it throws req.body is undefined error. I have just created IPN request url in My sandbox Merchant account.</p>
  
  <p>Steps which i follwed,</p>
  
  <p>1) logged in to <a href="https://www.sandbox.paypal.com/in/signin" rel="nofollow noreferrer">https://www.sandbox.paypal.com/in/signin</a></p>
  
  <p>2) Clicked on Profile and settings in menu tab.</p>
  
  <p>3) Then Selling tools-> Instant payment notifications Update-></p>
  
  <p>4) Click Choose IPN settings button,</p>
  
  <p>5) Enabled the IPN message and enter the url</p>
  
  <p>6) Clicked save button, That's all</p>
  
  <p>I think this is all we need to do. right?</p>
  
  <p>As i mentioned above, i am using "paypal-ipn" to handle the IPN servcie.
  As i am using express js, i followed the configuration as mentioned in following url.
  <a href="https://www.npmjs.com/package/paypal-ipn" rel="nofollow noreferrer">https://www.npmjs.com/package/paypal-ipn</a></p>
  
  <p>Code</p>
  
  <pre><code>const express = require('express');
  const ejs = require('ejs');
  const paypal = require('paypal-rest-sdk');
  const ipn = require('paypal-ipn');
  
  paypal.configure({
    'mode': 'sandbox', //sandbox or live
    'client_id': 'XXXXXXXXXXXXXXXXXXXXXXXXXX',
    'client_secret': 'XXXXXXXXXXXXX'
  });
  
  const app = express();
  
  app.set('view engine', 'ejs');
  
  app.get('/', (req, res) =&gt; res.render('index_page'));
  
  app.post('/pay', (req, res) =&gt; {
    const create_payment_json = {
      "intent": "sale",
      "payer": {
          "payment_method": "paypal"
      },
      "redirect_urls": {
          "return_url": "http://bef4cbb1.ngrok.io/success",
          "cancel_url": "http://bef4cbb1.ngrok.io/cancel",
      },
      "transactions": [{
          "item_list": {
              "items": [{
                  "name": "Shirt",
                  "quantity": "001",
                  "price": "50.00",
                  "currency": "USD",
                  "quantity": 1
              }]
          },
          "amount": {
              "currency": "USD",
              "total": "50.00"
          },
          "description": "Hat for the best team ever"
      }]
  };
  
  paypal.payment.create(create_payment_json, function (error, payment) {
    if (error) {
        throw error;
    } else {
        console.log(payment); 
        for(let i = 0;i &lt; payment.links.length;i++){
          if(payment.links[i].rel === 'approval_url'){
            res.redirect(payment.links[i].href);
          }
        }
    }
  });
  
  });
  
  app.get('/success', (req, res) =&gt; {
    const payerId = req.query.PayerID;
    const paymentId = req.query.paymentId;
  
    const execute_payment_json = {
      "payer_id": payerId,
      "transactions": [{
          "amount": {
              "currency": "USD",
              "total": "50.00"
          }
      }]
    };
  
    paypal.payment.execute(paymentId, execute_payment_json, function (error, payment) {
      if (error) {
          console.log(error.response);
          throw error;
      } else {
          console.log("-------Response--------"+JSON.stringify(payment));
          res.redirect("/payment_success");
      }
  });
  });
  
  
  app.post('/paymnet_details_notification', (req, res) =&gt; {
       console.log("-----success_notification-- start---");
       ipn.verify(req.body, function(error,payment){
          if (error) {
              console.log("-----success_notification-- error---");
              console.log(error.response);
              throw error;
          } else {
              console.log("-----success_notification- success----");
          }
       });
      return "Data notification received"
  });
  
  
  
  app.get('/payment_success', (req, res) =&gt; res.render('payment_success'));
  
  app.get('/payment_failed', (req, res) =&gt; res.render('payment_failed'));
  
  app.get('/cancel', (req, res) =&gt; res.render('cancel'));
  
  app.listen(3000, () =&gt; console.log('Server Started'));
  </code></pre>