By Rudderstack Team

How to load data from Stripe to Google BigQuery

This post helps you with loading your data from Stripe to BigQuery. You can integrate Stripe to BigQuery with RudderStack, to get analytics-ready data without the manual hassle. This integration will help you focus on what matters and to get more value out of your transaction data.

Extract data from Stripe

Stripe is an API-first product with a unified set of APIs and tools that instantly enables businesses to accept and manage online payments. It is a Web API following the RESTful principles. Stripe tries to use as many as HTTP built-in features as possible to make it accessible to off-the-shelf HTTP clients, and the serialization they support for their responses is JSON. They also have two different types of keys used for authentication, one for testing mode and one for live mode, using the testing mode key, it becomes easy to test every aspect of the API without messing with your real data. For security reasons, the calls you make to the Stripe API have to be over HTTPS only. Plain HTTP and non-authenticated calls fail. In case you want to experiment with the API, do not forget to use your testing mode key.

Currently, Stripe API is built around the following ten core resources:

  • Balance – an object that represents your stripe balance.
  • Charges – to charge a credit or debit card you create a charge
  • Customers – Customer objects allow you to perform recurring charges and track multiple charges associated with the same customer.
  • Dispute – A dispute occurs when a customer questions your charge with their bank or credit card company.
  • Events – Events are our way of letting you know when something interesting happens in your account.
  • File uploads – There are various times when you’ll want to upload files to Stripe (for example, when uploading dispute evidence).
  • Refunds – Refund objects allow you to refund a charge that has previously been created but not yet refunded.
  • Tokens – Tokens can be created with your publishable API key.
  • Transfers – When Stripe sends you money or you initiate a transfer to a bank account
  • Transfer reversals – A previously created transfer can be reversed if it has not yet been paid out.

All of the above resources support CRUD operations by using HTTP verbs on their associated endpoints. As a web API, you can access it using tools like CURL or Postman or your favorite HTTP client for the language or framework of your choice. Some options are the following:

Many libraries wrap around the Stripe API and offer an easier way to interact with it, both community-developed and from Stripe. For more information, you can check the libraries section in the API documentation.

Stripe and any other service you might be using have figured out (hopefully) the optimal model for its operations. Still, when we fetch data out of them we usually want to answer questions or do things that are not part of the context that these services operate in, making these models suboptimal for your analytic needs. For this reason, we should always keep in mind that when we work with data coming from external services, we need to remodel it and bring it to the right form for our needs.

So let’s assume that we want to perform some churn analysis for our company and to do that we need customer data that indicates when they have canceled their subscriptions. To do that we’ll have to request the customer objects that Stripe holds for our company. We can do that with the following command:

curl -u sk_test_BQokikJOvBiI2HlWgH4olfQ2:

and a typical response will look like the following:

{ "object": "list", "url": "/v1/charges", "has_more": false, "data": [