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, we’ll show you how to connect the Stripe API to Google Sheets in 5 steps:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install
2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.
In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
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 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 endpoint, or you want to use the same example 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 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.
Crypto API Tutorials: