Table: stripe_customer - Query Stripe Customers using SQL
Stripe is a technology company that builds economic infrastructure for the internet. Businesses of every size from new startups to public companies use the software to accept payments and manage their businesses online. Stripe combines a payments platform with applications that put revenue data at the heart of business operations.
Table Usage Guide
The stripe_customer
table provides insights into customer data within Stripe. As a financial analyst, you can explore customer-specific details through this table, including payment methods, transactions, and associated metadata. Utilize it to uncover information about customers, such as their payment history, preferred payment methods, and transaction patterns.
Examples
List all customers
Explore all customer data to gain insights into your customer base and understand their activity and behavior better. This can assist in creating targeted marketing strategies and improving customer service.
select *from stripe_customer;
select *from stripe_customer;
Customers added in the last week
Discover the segments that represent new customers by identifying those who have been added in the past week. This can help businesses understand recent growth patterns and tailor their marketing efforts accordingly.
select id, name, createdfrom stripe_customerwhere created > (current_timestamp - interval '7 days')order by created desc;
select id, name, createdfrom stripe_customerwhere created > (strftime('%s', 'now') - 7 * 24 * 60 * 60)order by created desc;
All customers with a credit on their account
Discover the segments that consist of customers who have a credit balance on their account. This is useful to identify potential areas for revenue recovery or customer engagement.
select id, name, balance, currencyfrom stripe_customerwhere balance < 0;
select id, name, balance, currencyfrom stripe_customerwhere balance < 0;
All customers with an outstanding balance to add to their next invoice
Gain insights into customers who have a pending balance, which will be added to their next invoice. This helps in understanding the financial standing of the customers and planning future billing accordingly.
select id, name, balance, currencyfrom stripe_customerwhere balance > 0;
select id, name, balance, currencyfrom stripe_customerwhere balance > 0;
Schema for stripe_customer
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The Stripe account ID. |
address | jsonb | The customer’s address. | |
balance | bigint | Current balance, if any, being stored on the customer. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that will be added to their next invoice. The balance does not refer to any unpaid invoices; it solely takes into account amounts that have yet to be successfully applied to any invoice. This balance is only taken into account as invoices are finalized. | |
created | timestamp with time zone | >, >=, =, <, <= | Time at which the object was created. |
currency | text | Three-letter ISO code for the currency the customer can be charged in for recurring billing purposes. | |
default_source | jsonb | ID of the default payment source for the customer. | |
deleted | boolean | True if the customer is marked as deleted. | |
delinquent | boolean | When the customer’s latest invoice is billed by charging automatically, delinquent is true if the invoice’s latest charge failed. When the customer’s latest invoice is billed by sending an invoice, delinquent is true if the invoice isn’t paid by its due date. If an invoice is marked uncollectible by dunning, delinquent doesn’t get reset to false. | |
description | text | An arbitrary string attached to the object. Often useful for displaying to users. | |
discount | jsonb | Describes the current discount active on the customer, if there is one. | |
text | = | The customer’s email address. | |
id | text | = | Unique identifier for the customer. |
invoice_prefix | text | The prefix for the customer used to generate unique invoice numbers. | |
invoice_settings | jsonb | The customer’s default invoice settings. | |
livemode | boolean | Has the value true if the object exists in live mode or the value false if the object exists in test mode. | |
metadata | jsonb | Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. | |
name | text | The customer’s full name or business name. | |
next_invoice_sequence | bigint | The suffix of the customer’s next invoice number, e.g., 0001. | |
phone | text | The customer’s phone number. | |
preferred_locales | jsonb | The customer’s preferred locales (languages), ordered by preference. | |
shipping | jsonb | Mailing and shipping address for the customer. Appears on invoices emailed to this customer. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tax_exempt | text | Describes the customer’s tax exemption status. One of none, exempt, or reverse. | |
tax_ids | jsonb | The customer’s tax IDs. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- stripe
You can pass the configuration to the command with the --config
argument:
steampipe_export_stripe --config '<your_config>' stripe_customer