This Data Connector allows you to import Stripe objects into Treasure Data.
- Basic knowledge of Treasure Data
- Basic knowledge of Stripe
- (Optional) Stripe Webhooks
Go to Integrations Hub > Catalog and search and select Stripe.

We support the OAuth Authentication Methods:
Select an existing OAuth connection for Stripe, or select the link under OAuth connection to create a new one.

Login to your Stripe account:

And grant access to Treasure Data app:

You will be redirected back to Integrations Hub. Repeat Create a new connection and choose your new OAuth connection.

Internal Testing Purposes: Secret Key —deprecated, replaced by OAuth
Enter Live Secret Key from Stripe > Your Account > Account Settings > API Keys.

After creating the above connection, you will be automatically taken to My Connections tab. Look for the connection you created and select New Transfer. The incremental option is only supported for the event object.

Edit the details and select Next.

Preview your data. If you wish to change anything, select on Advanced Settings or else select on Next.

Select the database and table where you want to transfer the data, as per the following dialog:

Specify the schedule of the data transfer using the dialog below and select Start Transfer.

You see the new data transfer in progress listed under the My Input Transfers tab and a corresponding job are listed in the Jobs section.
You can improve data import performance by using parallel import.
The plugin creates a time range that depends on Start datetime and End datetime and send parallel HTTP requests to Stripe API. If you don't edit the End datetime plugin tries to get the timestamp of the latest record stored in Stripe first and use it as End datetime.
In the following example, the plugin creates 4 time ranges and all time ranges are processed in parallel.
Start datetime: 2016-01-25T00:00:00
End datetime: 2017-05-25T00.00.00
Time splitting
Period for each parallel input: 6
unit: month
Time range 1
gte: 2016-01-25T00:00:00
lt: 2016-01-31T00:00:00 # start_datetime to first end of the month
Time range 2
gte: 2016-01-31T00:00:00 # has 6 month period
lt: 2016-07-31T00.00.00
Time range 3
gte: 2016-07-31T00.00.00.000Z # has 6 month period
lt: 2017-02-28T00.00.00
Time range 4
gte: 2017-02-28T00.00.00
lt: 2017-05-25T00.00.00 # to end_datetime
You can install the newest TD Toolbelt.
$ td --version
0.15.0Prepare configuration file (for eg: load.yml) as follows, with your Stripe account access information.
in:
type: stripe
client_id: xxxxxxxxxxxxx
client_secret: xxxxxxxxxxxxx
refresh_token: xxxxxxxxxxxxx
target: event
incremental: true
start_datetime: 2017-01-01T07:36:22.000Z
formula: gt
out:
mode: replaceThe steps for specifying the import of Stripe Event objects is as follows:
- client_id and client_secret: your Stripe app credentials
- refresh_token: Stripe OAuth2 refresh_token, you need to grant access to your Stripe app, using an Stripe user account
- target: Stripe object you want to import. Supported values: account, application_fee, balance_history, charge, coupon, customer, dispute, file_upload, event, invoice_item, invoice, order, plan, product, refund, subscription, transfer
- start_datetime: import data from this date, format is: yyyy-MM-ddThh:mm:ss.000Z
- formula: Formula to evaluate start_datetime. Supported values: gt(greater than), gte(greater than or equal), lt(less than), lte(less than or equal).
- incremental: should data import be continuous or once, default as true. Incremental is only supported when target is event.
For more details on available out modes, see the Appendix.
You can preview data to be imported using the command td connector:preview.
td connector:preview load.ymlSubmit the load job. It may take a couple of hours depending on the data size. Users need to specify the database and table where their data are stored.
It is recommended to specify the --time-column option, since Treasure Data’s storage is partitioned by time (see also data partitioning). If the option is not given, the Data Connector will choose the first long or timestamp column as the partitioning time. The type of the column specified for --time-column must be either of long or timestamp type.
If your data doesn’t have a time column you may add it using the add_time filter option. For more information, see add_time filter plugin.
td connector:issue load.yml --database td_sample_db --table td_sample_table --time-column updated_dateThe preceding command assumes you have already created database(td_sample_db) and table(td_sample_table). If the database or the table do not exist in TD this command will not succeed, so create the database and table manually or use --auto-create-table option with the td connector:issue command to auto create the database and table:
td connector:issue load.yml --database td_sample_db --table td_sample_table --time-column updated_date --auto-create-tableYou can assign the Time Format column to the "Partitioning Key" with the "--time-column" option.
You can schedule a periodic Data Connector execution for a periodic Stripe import. We manage our scheduler to ensure high availability. By using this feature, you no longer need a cron daemon on your local data center.
A new schedule can be created using the td connector:create command. The name of the schedule, cron-style schedule, the database and table where their data will be stored, and the Data Connector configuration file are required.
$ td connector:create
daily_stripe_import
"10 0 * * *"
td_sample_db
td_sample_table
load.ymlThe cron parameter also accepts these three options: @hourly, @daily and @monthly
By default, the schedule is setup in the UTC timezone. You can set the schedule in a timezone using -t or --timezone option. The --timezone option only supports extended timezone formats like 'Asia/Tokyo', 'America/Los_Angeles' etc. Timezone abbreviations like PST, CST are not supported and may lead to unexpected schedules.
Webhooks can be used to capture events that happen in a Stripe account, instead of through direct API requests.
Login to Stripe account, select Webhooks —> Settings —> Add endpoint

In the URL text box, enter:
http://in.treasuredata.com/postback/v3/event/{td_database}/{td_table}?td_write_key={td_account_write_api_key}
Then select events that you want to ingest into the {td_database}.{td_table} specified in the preceding URL.

You can setup additional endpoints to ingest different types of events into different {td_database}.{td_table}.