Search API Connector Documentation

Print

Import Stripe Data to Google Sheets

In this guide, we’ll walk through how to pull transactions from the Stripe API directly into Google Sheets, using the API Connector add-on for Google Sheets. Stripe is of course a popular payment processor known for its fantastic APIs.

There are 2 ways to connect to the Stripe API:

  • Preset “Connect” button (OAuth) premium
  • Personal API key. Please check the appendix for detailed instructions to retrieve your key.

Contents

Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the Stripe API

If you haven’t connected API Connector to Stripe before, you’ll first need to initiate the connection as follows:

  1. Open up Google Sheets and click Add-ons > API Connector > Manage Connections.
  2. In the list of available connections, find Stripe and click Connect.
    stripe-img7
  3. You’ll be asked to authorize the connection. Click Connect.
    stripe-img8
  4. Once you connect the account, you’ll be returned to your Google Sheet and can verify that the connection is active on the Connections screen.

Part 2: Create Your Stripe API Request URL

We’ll first follow the Stripe API documentation to request a list of transactions.

  • Base URL: https://api.stripe.com/v1
  • Endpoint: /charges
  • Parameters: ?limit=#_OF_RECORDS

The ‘limit’ parameter is optional but we’ll include it to show how parameters work. Putting it all together, we get the full API Request URL:

https://api.stripe.com/v1/charges?limit=100

Part 3: Pull Stripe API Data into Sheets

Now let’s grab that Stripe data!

  1. Open up Google Sheets and click Add-ons > API Connector > Open.
  2. In the Create screen, enter the Request URL we just created
    stripe-img3
  3. Under OAuth, choose Stripe
    stripe-img9
  4. We don’t need any headers so just leave that section blank.
  5. Create a new tab and click ‘Set current’ to use that tab as your data destination.
  6. Name your request and click Run. A moment later you’ll see your charges data populate your Google Sheet:
    stripe-img5

Part 4: More Example API URLs

You can check the documentation for the full list of available API requests, but if you just want to jump in, you can play around with the URLs you enter in the API URL path field. Try the following (one at a time):

https://api.stripe.com/v1/products
https://api.stripe.com/v1/customers
https://api.stripe.com/v1/balance
https://api.stripe.com/v1/payouts
https://api.stripe.com/v1/refunds

Part 5: Handle Pagination

  1. By default, Stripe will only return 10 records at a time. To retrieve more, use the ‘limit’ and ‘starting_after’ parameters as described in the documentation, like this:
    page 1:
    https://api.stripe.com/v1/charges?limit=100
    page 2:
    https://api.stripe.com/v1/charges?limit=100&starting_after=ch_1F2EjwIdg4lVxlj2DhB3fQ4S
    The ‘limit’ value can be between 1 and 100, while the ‘starting_after’ parameter should take the name of an object ID value in your report.

  2. You can run these request URLs manually, or loop through them automatically using pagination handling (paid feature), like this:
    • API URL: enter your request URL as usual, making sure to include limit=100
    • Pagination type: cursor
    • Next token parameter: starting_after
    • Next token field: data.id
    • Number of pages: enter the number of pages you’d like to fetchstripe-img6

Appendix: Connect with a Stripe API Key

  1. As an alternative to connecting via OAuth, you can connect with your own API key. Log in to Stripe and click Developers > API keys from the left-hand menu
    stripe-img1
  2. On this page, you’ll see that API keys have already been automatically created for you. You can choose between test data and real data; they work exactly the same way. (If you want to use live data, simply toggle the ‘Viewing Test Data’ option). Click to reveal the secret token:
    stripe-img2
  3. Once you have your key, use it by entering a key-value pair in the Headers section, where Key = Authorization, Value = Bearer YOUR_SECRET_TOKEN. Leave OAuth set to None.
    stripe-img4
Previous Import Strava Data to Google Sheets
Next Import SurveyMonkey Data to Google Sheets

8 thoughts on “Import Stripe Data to Google Sheets”

  1. Hi, I used the API connector to get my Stripe charges into a g-sheet. all works fine but the amounts are somehow coming in a wrong format. e.g. a payment of EUR 11,25 is flowing in as 1125,00. Strange enough, it looks as payments >EUR 100,00 are formatted correctly. Does anyone have a hint?

    Reply
    • Hi Guy, can you please try changing the locale of your sheet to United States to see if that resolves the issue? Locale is located under File > Spreadsheet Settings. Please let me know if that fixes the problem.

      Reply
  2. Dear Ana,
    thank you very much for your great support. I could solve the issue by dividing by 100. Fantastic tool.
    Guy

    Reply
  3. Hi Ana,
    is there an issue with the API “balance”. All APIs seem to be working fine but for “balance” I always get this error message, even though I am using the same parameters as for the other requests:

    Completed with errors
    – Server responded with an error (400) show response{ “error”: { “code”: “parameter_unknown”, “doc_url”: “https://stripe.com/docs/error-codes/parameter-unknown”, “message”: “Received unknown parameter: limit”, “param”: “limit”, “type”: “invalid_request_error” } }

    Reply
    • I’m not sure, I tested and it worked fine for me, but I only have 2 promotion codes in my account.
      “Failed to run request” means that the request timed out, so I suppose you might run into this issue if you have a very large number of promotion codes, do you think that’s the case here?

      Reply

Leave a Comment

Table of Contents