title: BAD_REQUEST_ERROR - Nodejs Request Method
body: <p>I am working on payment gateway integration and had to call the orders api.  But i keep getting the error </p>
  
  <pre><code>{"error":{"code":"BAD_REQUEST_ERROR","description":"Please provide your api key for authentication purposes."}}
  </code></pre>
  
  <p>My whole section of code</p>
  
  <pre><code>const functions = require('firebase-functions');
      var express = require('express');
      var cors = require('cors');
      var request = require('request');
      const crypto = require('crypto');
      var app = express();
      app.use(cors({origin:true}));
  
      app.post("/",(req,res)=&gt;{
        const amount = req.body.amount;
  
      const key = '----insert your key here----';
      const key_secret = '----- insert key secret here ----';
  
        var options = { method: 'POST',
          url: 'https://api.razorpay.com/v1/orders',
          headers: 
          {
              Authorization: 'Basic' + new Buffer(key + ":" + key_secret).toString("base64")},     
          form: 
          { amount: amount,
            currency: 'INR',
            receipt: "Receipt #20",
            payment_capture : 1
          } 
          };
  
        request(options,  (error, response, body)=&gt; {
            if (error) throw new Error(error);
            res.send(body);
  
          });
      })
  
  
  
      exports.razorpaymentApi = functions.region('asia-east2').https.onRequest(app);
  </code></pre>
  
  <p>I have replaced  <strong>key</strong> and <strong>key_secret</strong> with my original api key and secret. Can you tell me where i am going wrong. Thanks</p>