Table: stripe_coupon - Query Stripe Coupons using SQL
Stripe Coupon is a feature within Stripe that allows you to create, manage, and distribute discount codes for your customers. It provides a flexible way to set up and manage coupons for various Stripe services, including subscriptions, invoices, and more. Stripe Coupon helps you attract new customers, reward loyal ones, or reactivate past customers with discounts and promotions.
Table Usage Guide
The stripe_coupon
table provides insights into coupons within Stripe. As a business owner or marketing manager, explore coupon-specific details through this table, including discount values, duration, and associated metadata. Utilize it to uncover information about coupons, such as those with high discount values, the duration of the coupons, and the verification of redemption limits.
Examples
List all coupons
Explore all the promotional coupons available in your system to understand the various discount schemes you offer. This can help in assessing the effectiveness of your marketing strategies and plan future campaigns.
select *from stripe_coupon;
select *from stripe_coupon;
Coupons that are currently valid
Explore which coupons are currently active. This can be useful for understanding which promotional offers are available for customers at a given time.
select id, namefrom stripe_couponwhere valid;
select id, namefrom stripe_couponwhere valid = 1;
Coupons by popularity
Discover the segments that are most popular based on the number of times they've been redeemed. This can help prioritize marketing efforts and understand customer behavior.
select id, name, times_redeemedfrom stripe_couponorder by times_redeemed desc;
select id, name, times_redeemedfrom stripe_couponorder by times_redeemed desc;
Schema for stripe_coupon
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
amount_off | bigint | Amount (in the currency specified) that will be taken off the subtotal of any invoices for this customer. | |
created | timestamp with time zone | >, >=, =, <, <= | Time at which the coupon was created. |
currency | text | If amount_off has been set, the three-letter ISO code for the currency of the amount to take off. | |
deleted | boolean | True if the customer is marked as deleted. | |
duration | text | One of forever, once, and repeating. Describes how long a customer who applies this coupon will get the discount. | |
duration_in_months | bigint | If duration is repeating, the number of months the coupon applies. Null if coupon duration is forever or once. | |
id | text | = | Unique identifier for the coupon. |
livemode | boolean | Has the value true if the coupon exists in live mode or the value false if the coupon exists in test mode. | |
max_redemptions | bigint | Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid. | |
metadata | jsonb | Set of key-value pairs that you can attach to an coupon. This can be useful for storing additional information about the coupon in a structured format. | |
name | text | The coupon’s full name or business name. | |
percent_off | double precision | Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a $100 invoice $50 instead. | |
redeem_by | timestamp with time zone | Date after which the coupon can no longer be redeemed. | |
times_redeemed | bigint | Number of times this coupon has been applied to a customer. | |
valid | boolean | Taking account of the above properties, whether this coupon can still be applied to a customer. |
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_coupon