title: How to get rid of validation error with paypal-rest-sdk?
body: <p>I am using the paypal-rest-sdk to practice using the paypal checkout. I've set up a small test and whenever I click submit in my form I get a "localhost refused to connect" error in Chrome. I've turned off my proxy and cleared my history and cache. I've also double checked my client and secret keys from Paypal. I'm not sure what I am doing wrong. Here's my code:</p>
  
  <p>app.js:</p>
  
  <pre class="lang-js prettyprint-override"><code>const express = require('express');
  const ejs = require('ejs');
  const paypal = require('paypal-rest-sdk');
  
  paypal.configure({
      'mode': 'sandbox', //sandbox or live
      'client_id': 'xxxxxxxx',
      'client_secret': 'xxxxxxx'
    });
  
  const app = express();
  
  app.set('view engine', 'ejs');
  
  app.get('/', (req, res) =&gt; res.render('index'));
  
  // create the json obj for the transaction with the order details
  app.post('/pay', (req, res) =&gt; {
      const create_payment_json = {
          "intent": "sale",
          "payer": {
              "payment_method": "paypal"
          },
          "redirect_urls": {
              "return_url": "http://localhost:3000/success",
              "cancel_url": "http://localhost:3000/cancel"
          },
          "transactions": [{
              "item_list": {
                  "items": [{
                      "name": "Red Sox Hat",
                      "sku": "001",
                      "price": "25.00",
                      "currency": "USD",
                      "quantity": 1
                  }]
              },
              "amount": {
                  "currency": "USD",
                  "total": "1.00"
              },
              "description": "This is the payment description."
          }]
      };
  
      // pass in the object we've created and now create the actual payment
      paypal.payment.create(create_payment_json, function (error, payment) {
          if (error) {
              console.log(error);
              throw error;
          } else {
              console.log("Create Payment Response");
              console.log(payment);
              res.send('test');
          }
      });
  });
  
  app.listen(3000, () =&gt; console.log('Server Started'));
  </code></pre>
  
  <p>here is what the terminal outputs from the error:</p>
  
  <pre><code>  response:
     { name: 'VALIDATION_ERROR',
       details: [ [Object] ],
       message: 'Invalid request - see details',
       information_link: 'https://developer.paypal.com/docs/api/payments/#errors',
       debug_id: 'fb61fe9c14b46',
       httpStatusCode: 400 },
    httpStatusCode: 400 }
  </code></pre>
  
  <p>I expect the message of 'test' to appear on the screen when the pay route is rendered so that I know the connection works, but so far all I've gotten is "ERR_CONNECTION_REFUSED" from Chrome. Please let me know what I am doing wrong. Thanks in advance.</p>