How to load data from Chargebee to Google BigQuery

Blendo Team

This post will help you with syncing your Chargebee data to Google BigQuery. By doing this you will be able to perform advanced analytics on a system that is designed for this kind of data payloads, like Google BigQueryAlternatively, you can simplify the process of syncing data from Chargebee to Google BigQuery by using Blendo, where the whole process will be handled by Blendo and you can focus on what matters, the analysis of your subscription and financial data.

Access your data on Chargebee

The first step in loading your Chargebee data to any kind of data warehouse solution is to access your data and start extracting it.

Chargebee has a well designed API that can be used to access the platform programmatically. It is built around more than 20 different resources, something that indicates the richness of the platform and the API. These resources include things like Customers and Events. So, in the data, you will find from typical pages that do not change that often like customers, to time series data like events. You need to account the different types of data that are included and design your database schema accordingly.

Chargebee as any other REST API can be accessed over the web with HTTP requests. They also offer and maintain a large number of different SDKs for some of the most popular languages and frameworks.

You will need more time to read this post than integrating Chargebee to BigQuery.

Effortlessly Sync All Your Chargebee Data to BigQuery

In addition to the above, the things that you have to keep in mind when dealing with an API like the one Chargebee has, are:

  1. Rate limits. Every API has some rate limits that you have to respect.
  2. Authentication. You authenticate on Chargebee using an API key.
  3. Paging and dealing with a big amount of data. Platforms like Chargebee tend to generate a lot of data, as financial transactions and subscription management involve many different events that can happen. Pulling big volumes of data out of an API might be difficult, especially when you consider and respect any rate limits that the API has.

About Chargebee

Chargebee is a subscription management and invoicing platform. You can use it to create many different types of subscriptions and scale the infrastructure needed easily. It also connects with a large number of payment gateways, so it also simplifies a lot the process of switching from one payment vendor to the other.  

Platforms like Chargebee hold a lot of valuable data about your company, the buying behavior of your customers can be found here and there’s a wealth of data waiting to be analyzed. By using data from Chargebee you can calculate important KPIs like the churn rate and Lifetime Value of your customers.

Transform and prepare your Chargebee data

After you have accessed your data on Chargebee, you will have to transform it based on two main factors,

  1. The limitations of the database that the data will be loaded onto
  2. The type of analysis that you plan to perform

Each system has specific limitations on the data types and data structures that it supports. If for example, you want to push data into Google BigQuery, then you can send nested data like JSON directly. But when you are dealing with tabular data stores, like Microsoft SQL Server, this is not an option. Instead, you will have to flatten out your data before loading into the database.

Also, you have to choose the right data types. Again, depending on the system that you will send the data to and the data types that the API exposes to you, you will have to make the right choices. These choices are important because they can limit the expressivity of your queries and limit your analysts on what they can do directly out of the database.

Chargebee has a very rich data model, where many of the resources that you can access might have to flatten out and be pushed in more than one tables. Also, there is a wealth of time series data that is useful in understanding the behavior of your customer.

For the above reasons, you should model your database carefully before moving forward with the loading of data from Chargebee into it.

Load data from Chargebee to Google BigQuery

If you want to load Chargebee data to Google BigQuery, you have to use one of the following supported data sources.

  1. Google Cloud Storage
  2. Sent data directly to BigQuery with a POST request
  3. Google Cloud Datastore Backup
  4. Streaming insert
  5. App Engine log files
  6. Cloud Storage logs


From the above list of sources, 5 and 6 are not applicable in our case.

For Google Cloud Storage, you first have to load your data into it, there are a few options on how to do this, for example, you can use the console directly as it is described here and do not forget to follow the best practices.

Another option is to post your data through the JSON API, as we see again APIs play an important role in both the extraction but also the loading of data into our data warehouse. In its simplest case, it’s just a matter of one HTTP POST request using a tool like CURL or Postman.

After you have loaded your data into Google Cloud Storage, you have to create a Load Job for BigQuery to actually load the data into it, this Job should point to the source data in Cloud Storage that have to be imported, this happens by providing source URIs that point to the appropriate objects.

The best way to load data from Chargebee to Google BigQuery and possible alternatives

So far we just scraped the surface of what can be done with Google BigQuery and how to load data into it. The way to proceed relies heavily on the data you want to load, from which service they are coming from and the requirements of your use case.

Things can get even more complicated if you want to integrate data coming from different sources. A possible alternative, instead of writing, hosting and maintaining a flexible data infrastructure, is to use a product like Blendo that can handle this kind of problems automatically for you.

Blendo integrates with multiple sources or services like databases, CRM, email campaigns, analytics and more.  Quickly and safely move all your data from Chargebee into Google BigQuery and start generating insights from your data.

Help your sales and executive team take ownership of the insights of your payments' data that live in Chargebee.

Blendo is the easiest way to automate powerful data integrations.

Try Blendo free for 14 days. No credit card required.