Stripe

Knowi enables visualization, analysis, and reporting automation from your Stripe payment data.

Connect your Stripe account to pull charges, customers, subscriptions, invoices, payouts, balance transactions, and refunds into Knowi for analytics and dashboards ? no manual exports or CSV files needed.

Overview

Connect directly to Stripe using your API secret key. Knowi handles authentication, cursor-based pagination, and data extraction automatically.

Prerequisites

You need a Stripe Secret API Key to connect. This is different from the Publishable Key (which starts with pk_).

Find or Create a Stripe API Key

  1. Log in to your Stripe Dashboard.

  2. Navigate to Developers > API keys (or go to dashboard.stripe.com/apikeys).

  3. You have two options:

    Option A ? Use the default Secret Key (quickest):

    • Under Standard keys, click Reveal test key (or Reveal live key for production)
    • Copy the key ? it starts with sk_test_ (test mode) or sk_live_ (production)

    Option B ? Create a Restricted Key (recommended for security):

    • Click Create restricted key
    • Name it (e.g., "Knowi Analytics Read-Only")
    • Set permissions to Read for the resources you need: Charges, Customers, Subscriptions, Invoices, PaymentIntents, Payouts, Balance, Refunds
    • Click Create key and copy it ? it starts with rk_test_ or rk_live_

Test vs Live mode: Toggle the Test mode switch in the top right of the Stripe Dashboard. Test mode uses test data and sk_test_ keys. Live mode uses real data and sk_live_ keys. Start with test mode to verify the integration works.

Connect in Knowi

  1. Log in to Knowi and navigate to Queries from the left sidebar.

  2. Click New Datasource (the + icon), then search for Stripe in the datasource selector.

  3. Fill in the form:

    a. Datasource Name: A label for this connection (e.g., "Stripe Production" or "Stripe Test")

    b. Secret Key: Paste your Stripe secret key (starts with sk_test_, sk_live_, rk_test_, or rk_live_)

  4. Click Test Connection to verify. You should see "Connection Successful".

  5. Click Save to store the datasource.

Security Note: Use restricted API keys when possible. Knowi only needs read access to your Stripe data. Never share or commit your secret keys to version control.

Collections

After connecting, select a collection from the dropdown to query your Stripe data.

Charges

Retrieves a list of charges. Returns charge ID, amount, currency, status, customer, payment method details, and timestamps.

Optional Filters: * Status - Filter by Succeeded, Pending, or Failed. * Customer ID - Filter charges for a specific customer (e.g., cus_ABC123). * Created After / Created Before - Unix timestamps. Use Knowi date tokens like {$c9_today-30d:epoch}.

Default Cloud9QL:

select data;
select expand(data);
select id, amount/100 as amount, currency, status, customer, created, payment_method_details.type as payment_type order by created desc;

Note: Stripe stores amounts in cents. Divide by 100 to get the dollar amount.

Customers

Retrieves a list of customers. Returns customer ID, email, name, currency, and creation date.

Optional Filters: * Email - Filter by exact email address. * Created After / Created Before - Unix timestamps for date filtering.

Default Cloud9QL:

select data;
select expand(data);
select id, email, name, created, currency, default_source, delinquent order by created desc;

Subscriptions

Retrieves a list of subscriptions. Returns subscription ID, customer, status, current period, pricing, and cancellation details.

Optional Filters: * Status - Filter by Active, Past Due, Unpaid, Canceled, Incomplete, Incomplete Expired, Trialing, or Paused. * Customer ID - Filter subscriptions for a specific customer.

Default Cloud9QL:

select data;
select expand(data);
select id, customer, status, current_period_start, current_period_end, items.data[0].price.unit_amount/100 as price, items.data[0].price.currency as currency, cancel_at_period_end, created order by created desc;

Invoices

Retrieves a list of invoices. Returns invoice ID, customer, status, amounts, currency, and hosted invoice URL.

Optional Filters: * Status - Filter by Draft, Open, Paid, Uncollectible, or Void. * Customer ID - Filter invoices for a specific customer. * Created After / Created Before - Unix timestamps for date filtering.

Default Cloud9QL:

select data;
select expand(data);
select id, customer, status, amount_due/100 as amount_due, amount_paid/100 as amount_paid, currency, created, due_date, hosted_invoice_url order by created desc;

Payment Intents

Retrieves a list of payment intents. Returns intent ID, amount, currency, status, customer, and payment method.

Optional Filters: * Created After / Created Before - Unix timestamps for date filtering.

Default Cloud9QL:

select data;
select expand(data);
select id, amount/100 as amount, currency, status, customer, payment_method, created order by created desc;

Payouts

Retrieves a list of payouts. Returns payout ID, amount, currency, status, arrival date, type, and method.

Optional Filters: * Status - Filter by Paid, Pending, In Transit, Canceled, or Failed. * Arrival After / Arrival Before - Unix timestamps for arrival date filtering.

Default Cloud9QL:

select data;
select expand(data);
select id, amount/100 as amount, currency, status, arrival_date, type, method, created order by created desc;

Balance Transactions

Retrieves a list of balance transactions. Returns transaction ID, amount, fee, net, currency, type, and description.

Optional Filters: * Type - Filter by Charge, Refund, Adjustment, Payout, Stripe Fee, or Transfer. * Created After / Created Before - Unix timestamps for date filtering.

Default Cloud9QL:

select data;
select expand(data);
select id, amount/100 as amount, fee/100 as fee, net/100 as net, currency, type, status, created, description order by created desc;

Refunds

Retrieves a list of refunds. Returns refund ID, amount, currency, charge ID, status, and reason.

Optional Filters: * Charge ID - Filter refunds for a specific charge (e.g., ch_ABC123). * Created After / Created Before - Unix timestamps for date filtering.

Default Cloud9QL:

select data;
select expand(data);
select id, amount/100 as amount, currency, charge, status, reason, created order by created desc;

Custom Endpoint

For power users who need to access any Stripe API resource not covered by the predefined collections.

Required Parameters: * Resource - The Stripe API resource path (e.g., products, prices, coupons, disputes, events, transfers).

Refer to the Stripe API Reference for available resources.

Querying

After selecting a collection, click Preview to see the data. Use the Cloud9QL editor to transform and filter the results.

Common transformations:

Date Filtering

Stripe uses Unix timestamps (seconds since epoch) for date fields. When configuring date filters, use Knowi date tokens:

Scheduling

Once your query is configured, you can schedule it to run automatically (e.g., every hour, daily) to keep your dashboards up to date. Knowi handles cursor-based pagination automatically ? all pages are fetched until the data is complete.

Notes