title: How to get "balance transactions" from Stripe API via UrlFetchApp
body: <p>I am trying to get the transaction details from Stripe API "The balance transaction object" with a Google Apps Script app. I have studied another question to get my code:</p>
  
  <p><a href="https://stackoverflow.com/questions/58635015/how-to-integrate-stripe-payments-with-google-apps-script">How to integrate Stripe payments with Google Apps Script</a></p>
  
  <p>And I have read the following Strip documentation:</p>
  
  <p><a href="https://stripe.com/docs/api/balance_transactions" rel="nofollow noreferrer">https://stripe.com/docs/api/balance_transactions</a></p>
  
  <p>My code is:</p>
  
  <pre><code>function callStripe() {
    var url = "https://api.stripe.com/v1/balance_transactions";
  
    var params = {
      method: "GET",
      headers: {Authorization: "Basic " + Utilities.base64Encode("sk_test_XXX:")},
      payload: {id: "txn_1GryACFHk3f0sLjYo9FDDSM1", source: "ch_1GryABFHk3f0sLjY88wmWPFy"}
    };
    var res = UrlFetchApp.fetch(url, params);
    Logger.log(res.getContentText())
  }
  </code></pre>
  
  <p>When I ran the function, I got the following error:</p>
  
  <blockquote>
    <p>Exception: Request failed for <a href="https://api.stripe.com" rel="nofollow noreferrer">https://api.stripe.com</a> returned code 404. Truncated server response: { "error": { "message": "Unrecognized request URL (POST: /v1/balance_transactions). Please see <a href="https://stripe.com/docs" rel="nofollow noreferrer">https://stripe.com/docs</a> or we can help at http... (use muteHttpExceptions option to examine full response) (line 59, file "Stripe")</p>
  </blockquote>
  
  <p>Line 59 is referring to the <code>var res = UrlFetchApp.fetch(url, params);</code></p>