title: Getting exception on webhook from Stripe
body: <p>I'm trying to set up a webhook from Stripe to handle the <code>payment_intent.succeeded</code> event, but I get an exception. This is my code from the Node backend (I have extracted all the relevant parts I hope. Let me know if anything else is needed):</p>
  
  <p>const stripeWebHookSecret = 'whsec_WA0Rh4vAD3z0rMWy4kv2p6XXXXXXXXXX';</p>
  
  <pre><code>import express from 'express';
  const app = express();
  app.use(bodyParser.urlencoded({ extended:true }));
  app.use(bodyParser.json());
  app.use(session({ &lt;some params here&gt; }));
  
  const openRouter = express.Router();
  
  registerOpenPaymentRoutes(openRouter);
  
  app.use('/open', openRouter);
  </code></pre>
  
  <p>And the implementation of <code>registerOpenPaymentRoutes</code> looks like this:</p>
  
  <pre><code>export const registerOpenPaymentRoutes = (router) =&gt; {
      router.post('/payment/intent/webhook', bodyParser.raw({type: 'application/json'}), (req, res) =&gt; {
          let signature = req.headers['stripe-signature'];
          try {
              let event = stripe.webhooks.constructEvent(req.body, signature, stripeWebHookSecret);
              switch(event.type){
                  case 'payment_intent.succeeded':
                      let intent = event.data.object;
                      res.json({ message: 'Everything went smooth!', intent });
                  default:
                      res.status(400).json({ error: 'Event type not supported' });
              }
          }
          catch (error){
              res.status(400).json({ message: `Wrong signature`, signature, body: req.body, error });
          }
      });
  }
  </code></pre>
  
  <p>So far so good.When I fire a test webhook event from the Stripe dashboard, I hit the endpoint, but get the result from the catch block. The error message is as follows:</p>
  
  <pre><code>No signatures found matching the expected signature for payload. Are you passing the raw request body you received from Stripe? https://github.com/stripe/stripe-node#webhook-signing"
  </code></pre>
  
  <p>I'm returning the signature with the error message as well as you see above, and the signature looks like this:</p>
  
  <p><code>"t=1557911017,v1=bebf499bcb35198b8bfaf22a68b8879574298f9f424e57ef292752e3ce21914d,v0=23402bb405bfd6bd2a13c310cfecda7ae1905609923d801fa4e8b872a4f82894"</code></p>
  
  <p>As far as I understand from the documentation, what is needed to get the raw request body as mentioned are the <code>bodyParser.raw({type: 'application/json'})</code>argument to the router that I already have there.</p>
  
  <p>Can anyone see the missing part?</p>