{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"redocly_category":"Integrations","type":"markdown"},"seo":{"title":"Stripe Import Integration","description":"Import Stripe data into Treasure AI using OAuth authentication, with step-by-step guidance for creating connections and transferring Stripe objects.","siteUrl":"https://docs.treasure.ai","lang":"en-US","jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.treasure.ai/","name":"Treasure AI","url":"https://www.treasure.ai/","logo":"https://www.treasure.ai/hubfs/assets/images/logos/primary-logo.svg"},{"@type":"WebSite","@id":"https://docs.treasure.ai/#website","name":"Treasure AI Documentation","url":"https://docs.treasure.ai/","inLanguage":["en","ja"],"publisher":{"@id":"https://www.treasure.ai/"}}]},"llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"stripe-import-integration","__idx":0},"children":["Stripe Import Integration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This Data Connector allows you to import Stripe objects into Treasure Data."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Basic knowledge of Treasure Data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Basic knowledge of Stripe"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["(Optional) ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://stripe.com/docs/webhooks"},"children":["Stripe Webhooks"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"use-treasure-console","__idx":2},"children":["Use Treasure Console"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-new-connection","__idx":3},"children":["Create a New Connection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Go to Integrations Hub > Catalog and search and select Stripe."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133322.f1708963c0ac8dd299ee959b769a54a39b15cf76356100d24b5893fbc65345b0.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We support the OAuth Authentication Methods:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select an existing OAuth connection for Stripe, or select the link under ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["OAuth connection"]}," to create a new one."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133342.a875b907d8c2aa56d61c432ccee952f62378e7081eed99e525ab15cb1085af54.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-new-oauth-connection","__idx":4},"children":["Create a New OAuth Connection"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Login to your Stripe account:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133350.82d72fafa3becdba0d1fdc9d46f64755c0abebc282647bcb9c427f97d21a0f66.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["And grant access to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Treasure Data"]}," app:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133409.e0bf18be978ea7127fcff40cc5b34d52ba8fd94d288614dbdcd6f329984a9519.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You will be redirected back to Integrations Hub. Repeat Create a new connection and choose your new OAuth connection."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133418.35874dd688f32173c32059f02fc3361691877c27ccd171236e3ebb1338ebd154.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Internal Testing Purposes: Secret Key —deprecated, replaced by OAuth"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Enter Live Secret Key from Stripe > Your Account > Account Settings > API Keys."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133427.774f5d51765bb957b76a6cab4a28facdff4a98609859a05cb29cabfab4844b06.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-a-new-transfer","__idx":5},"children":["Create a New Transfer"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After creating the above connection, you will be automatically taken to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://console.treasuredata.com/connections/list"},"children":["My Connections"]}," tab. Look for the connection you created and select New Transfer. The incremental option is only supported for the event object."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191205-052042.d421627101de63282c5920ea15cd9600ec0e204a770542af27a0df7040f5743c.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Edit the details and select ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Next"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133440.1a99949fe468212897207154efde3446e64625b4288e7c39a0c7169c9d4befb2.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Preview your data. If you wish to change anything, select on Advanced Settings or else select on Next."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133521.10a8b688daddbc643113e510c9f3f9d8189ee64c197f495294ef5c165fd5eaac.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Select the database and table where you want to transfer the data, as per the following dialog:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133627.f4a5e23e14b8d06eca32a7cae13a648a5e9c9ba0aa8d4de9a45ef94a7a262064.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Specify the schedule of the data transfer using the dialog below and select ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Start Transfer"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133636.27a41d1bc0e053eca5eb3ae38f5a502276876a78a780c9d760fef9487a78485e.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parallel-data-import","__idx":6},"children":["Parallel Data Import"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can improve data import performance by using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["parallel import"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The plugin creates a time range that depends on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Start datetime"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["End datetime"]}," and send parallel HTTP requests to Stripe API. If you don't edit the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["End datetime"]}," plugin tries to get the timestamp of the latest record stored in Stripe first and use it as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["End datetime"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the following example, the plugin creates 4 time ranges and all time ranges are processed in parallel."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Start datetime: 2016-01-25T00:00:00\nEnd datetime: 2017-05-25T00.00.00\nTime splitting\n  Period for each parallel input: 6\n  unit: month\n\nTime range 1\n  gte: 2016-01-25T00:00:00\n  lt: 2016-01-31T00:00:00 # start_datetime to first end of the month\nTime range 2\n  gte: 2016-01-31T00:00:00 # has 6 month period\n  lt: 2016-07-31T00.00.00\nTime range 3\n  gte: 2016-07-31T00.00.00.000Z # has 6 month period\n  lt: 2017-02-28T00.00.00\nTime range 4\n  gte: 2017-02-28T00.00.00\n  lt: 2017-05-25T00.00.00 # to end_datetime\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133657.4ffb2d73758eeac183b574feb33f56b47978d8c37188e36799538b8e46d7baae.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"use-command-line","__idx":7},"children":["Use Command Line"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"install-td-command-v0119-or-later","__idx":8},"children":["Install ‘td’ command v0.11.9 or later"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can install the newest ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://toolbelt.treasuredata.com/"},"children":["TD Toolbelt"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ td --version\n0.15.0\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"create-configuration-file","__idx":9},"children":["Create Configuration File"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prepare configuration file (for eg: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["load.yml"]},") as follows, with your Stripe account access information."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"in:\n  type: stripe\n  client_id: xxxxxxxxxxxxx\n  client_secret: xxxxxxxxxxxxx\n  refresh_token: xxxxxxxxxxxxx\n  target: event\n  incremental: true\n  start_datetime: 2017-01-01T07:36:22.000Z\n  formula: gt\nout:\n  mode: replace\n","lang":"yaml"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The steps for specifying the import of Stripe ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Event"]}," objects is as follows:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["client_id and client_secret: your Stripe app credentials"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["refresh_token: Stripe OAuth2 refresh_token, you need to grant access to your Stripe app, using an Stripe user account"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["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"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["start_datetime: import data from this date, format is: yyyy-MM-ddThh:mm:ss.000Z"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["formula: Formula to evaluate start_datetime. Supported values: gt(greater than), gte(greater than or equal), lt(less than), lte(less than or equal)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["incremental: should data import be continuous or once, default as true. Incremental is only supported when target is event."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more details on available out modes, see the Appendix."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"preview-data-to-import-optional","__idx":10},"children":["Preview Data to Import (Optional)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can preview data to be imported using the command td connector:preview."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"td connector:preview load.yml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"execute-load-job","__idx":11},"children":["Execute Load Job"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Submit 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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["It is recommended to specify the --time-column option, since Treasure Data’s storage is partitioned by time (see also ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/data-partitioning-in-treasure-data"},"children":["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."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your data doesn’t have a time column you may add it using the add_time filter option. For more information, see ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/add_time-filter-function"},"children":["add_time filter plugin"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"td connector:issue load.yml --database td_sample_db --table td_sample_table --time-column updated_date\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The preceding command assumes you have already created ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["database(td_sample_db)"]}," and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["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 ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.treasuredata.com/smart/project-product-documentation/data-management"},"children":["manually"]}," or use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--auto-create-table"]}," option with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["td connector:issue"]}," command to auto create the database and table:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"td connector:issue load.yml --database td_sample_db --table td_sample_table --time-column updated_date --auto-create-table\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can assign the Time Format column to the \"Partitioning Key\" with the \"--time-column\" option."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"scheduled-execution","__idx":12},"children":["Scheduled Execution"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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 ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cron"]}," daemon on your local data center."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A new schedule can be created using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"$ td connector:create \n    daily_stripe_import \n    \"10 0 * * *\" \n    td_sample_db \n    td_sample_table \n    load.yml\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["cron"]}," parameter also accepts these three options: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@hourly"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@daily"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["@monthly"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, the schedule is setup in the UTC timezone. You can set the schedule in a timezone using -t or --timezone option. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--timezone"]}," option only supports extended timezone formats like 'Asia/Tokyo', 'America/Los_Angeles' etc. Timezone abbreviations like PST, CST are ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["not"]}," supported and may lead to unexpected schedules."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"setup-stripe-webhooks","__idx":13},"children":["Setup Stripe Webhooks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Webhooks can be used to capture events that happen in a Stripe account, instead of through direct API requests."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Login to Stripe account, select Webhooks —> Settings —> Add endpoint"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-133955.0879b08a954ec38e5cfaf929de2e1892b021dda355faea5a5109159d084d7f45.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the URL text box, enter:",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"http://in.treasuredata.com/postback/v3/event/{td_database}/{td_table}?td_write_key={td_account_write_api_key}"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Then select events that you want to ingest into the {td_database}.{td_table} specified in the preceding URL."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/image-20191022-134004.b94faca136abe830b97bb137c603bea498f2b2c0927c4b268ba6b2a283b7d47c.b009b112.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can setup additional endpoints to ingest different types of events into different {td_database}.{td_table}."]}]},"headings":[{"value":"Stripe Import Integration","id":"stripe-import-integration","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Use Treasure Console","id":"use-treasure-console","depth":2},{"value":"Create a New Connection","id":"create-a-new-connection","depth":3},{"value":"Create a New OAuth Connection","id":"create-a-new-oauth-connection","depth":3},{"value":"Create a New Transfer","id":"create-a-new-transfer","depth":3},{"value":"Parallel Data Import","id":"parallel-data-import","depth":3},{"value":"Use Command Line","id":"use-command-line","depth":2},{"value":"Install ‘td’ command v0.11.9 or later","id":"install-td-command-v0119-or-later","depth":3},{"value":"Create Configuration File","id":"create-configuration-file","depth":3},{"value":"Preview Data to Import (Optional)","id":"preview-data-to-import-optional","depth":3},{"value":"Execute Load Job","id":"execute-load-job","depth":3},{"value":"Scheduled Execution","id":"scheduled-execution","depth":3},{"value":"Setup Stripe Webhooks","id":"setup-stripe-webhooks","depth":2}],"frontmatter":{"seo":{"title":"Stripe Import Integration","description":"Import Stripe data into Treasure AI using OAuth authentication, with step-by-step guidance for creating connections and transferring Stripe objects."}},"lastModified":"2026-06-17T07:22:53.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/int/stripe-import-integration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}