Stripe is an online payment processing software for internet businesses. Stripe’s payment APIs power commerce for businesses of all types and sized from startups all the way to Fortune 500 companies.
In this tutorial, I’ll show you how to connect the Stripe API to Google Sheets in 5 steps:
To pull data from the Stripe API to Google Sheets easily and without writing any code, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs (including the Stripe API), save API requests, schedule API requests, and more. Click here if you want to learn more about Apipheny.
1. Install Apipheny by clicking the Install button on this page.
2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons option in the top menu. In the add-ons menu, you should see Apipheny.
Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets, as you can see in this screenshot:
Next, log in to your Stripe account.
Every account comes with separate keys for testing and for running live transactions.
Each account has four keys, organized as two pairs. One pair of keys is publishable (for test mode) and one pair of keys is secret (for live mode).
Your API keys are always available in the Dashboard > Developers > API keys:
On the API keys page, click the “Reveal test key token” button to display your API secret key.
Copy and paste your secret key in a safe location because you will need it in the next steps.
In this section, we’ll show you how to browse the Stripe API documentation to find the exact Stripe API URL that retrieves the specific information you need from your Stripe account, also known as an endpoint.
If you already know your Stripe API URL/endpoint, or you want to use the same example Stripe API URL as us, just skip to Step 4.
To choose your endpoint, first open the Stripe API documentation page: https://stripe.com/docs/api
The menu on the left of that page contains a “Get started guide” and a list named “CORE RESOURCES”, which contains a list of categories, and each category has its own endpoints:
If you click on an API category, the page will scroll to that category’s section, which contains a list of associated endpoints for that API category.
For example, when clicking the “Customers” API category, the page scrolls to an introduction section and a list of the 5 available endpoints for this category:
An example Stripe API endpoint is List all Customers, and this is what the whole API URL for this endpoint looks like:
https://api.stripe.com/v1/customers
Each endpoint’s documentation contains descriptions of the endpoint’s purpose, the available parameters, and the expected response.
On a separate column on the right, you can find the CURL request to the endpoint and an example response:
All API calls to the Stripe API should be made with this base URL:
https://api.stripe.com/v1/
All Stripe API endpoints should be appended to this base URL.
Now go back to your Google Sheet and make sure that the Apipheny add-on is open, on the “Import” tab.
With the Import Tab open, enter these details into the add-on:
Method: At the top of the Apipheny add-on, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 3, we explained how you can find the Stripe REST API endpoint that you need. Now copy and paste your complete Stripe API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query (if applicable).
For this example, we are using the Balance endpoint that returns your Stripe balance. This is what the whole URL looks like:
https://api.stripe.com/v1/balance
If you want to follow the same example as us, just copy and paste this API URL into Apipheny, where it says “API URL”.
Headers: In the “Headers” section of Apipheny, add one row with the following key and value:
Key: Authorization Value: Bearer <your_secret_key>
Replace “<your_ secret _key>” with the value of your token that you got in Step 2. Don’t forget to put the word “Bearer” before your key, with a space between “Bearer” and “your_ secret _key”, like this:
Finally, to pull Stripe data into your Google Sheet, click the Run button at the bottom of the Apipheny add-on and then wait for the Stripe API data to be imported into your Google Sheet.
After making a successful request to the Stripe API, try querying a different Stripe API endpoint, or try using one of the more advanced features in the Apipheny add-on, such as:
If you want to get Stripe data into Google Data Studio, just follow the same steps above and then connect your Google Sheet to Google Data Studio.
Related articles:
Meelad Mashaw