title: Unable to send Post Request on Google Apps Script
body: <p>I am trying to send a post request to verify a transaction. I sent the same post request with <a href="https://www.getpostman.com/" rel="nofollow noreferrer">Postman</a> and I got a response as shown below:</p>
  
  <p><a href="https://i.stack.imgur.com/Wv2jL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wv2jL.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/idWAA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/idWAA.png" alt="enter image description here"></a></p>
  
  <p>Apps Script Code.gs:</p>
  
  <pre><code>function postRequest() {
      var url = "https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaidx/api/v2/verify";
      var options = {
          "method": "post",
          "headers": {
              "Content-Type": "application/json"
          },
          "payload": {
              "SECKEY": "FLWSECK-e6db11d1f8a6208de8cb2f94e293450e-X",
              "txref": "MC-1520443531487"
          }
      };
  
      const response = UrlFetchApp.fetch(url, options);
  
      Logger.log(JSON.stringify(response));
  }
  </code></pre>
  
  <p>Apps Script Error Response: </p>
  
  <blockquote>
    <p>Request failed for
    <a href="https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaidx/api/v2/verify" rel="nofollow noreferrer">https://ravesandboxapi.flutterwave.com/flwv3-pug/getpaidx/api/v2/verify</a>
    returned code 400. </p>
    
    <p>Truncated server response: SyntaxError: Unexpected token S<br> &nbsp;
    &nbsp;at parse
    (/app/node_modules/body-parser/lib/types/json.js:83:15)<br> &nbsp;
    &nbsp;at /app/node_mod... (use muteHttpExceptions option to examine
    full response) (line 299, file "Code")</p>
  </blockquote>
  
  <p><strong>What am I doing wrong or How do I send a post request in Google Apps Script?</strong></p>