Supported resources
Learn about Stripe Terraform provider resources and examples.
Use these examples as starting points for your Terraform configuration. Each resource includes a brief description and a link to the API reference.
Billing meters
Meters specify how to aggregate meter events over a billing period.
resource "stripe_billing_meter" "api_calls" { display_name = "API Calls" event_name = "api_call" default_aggregation { formula = "sum" } value_settings { event_payload_key = "value" } customer_mapping { type = "by_id" event_payload_key = "stripe_customer_id" } }
API reference: Billing meters
Billing meter fields
| Field | Description |
|---|---|
display_ | The meter’s name. Not visible to the customer. |
event_ | The name of the meter event to record usage for. Corresponds with the event_ field on meter events. |
dimension_ | Set of keys that are used to group meter events by. Each key must be present in the event payload. |
event_ | The time window which meter events have been pre-aggregated for, if any. |
id | ID of the object. |
customer_ | The key in the meter event payload to use for mapping the event to a customer. |
customer_ | The method for mapping a meter event to a customer. Must be by_. |
default_ | Specifies how events are aggregated. Allowed values are count to count the number of events, sum to sum each event’s value and last to take the last event’s value in the window. |
value_ | The key in the usage event payload to use as the value for this meter. For example, if the event payload contains usage on a bytes_ field, then set the event_payload_key to “bytes_used”. |
Coupons
A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer.
resource "stripe_coupon" "launch_discount" { name = "Launch discount" percent_off = 15 duration = "once" }
API reference: Coupons
Coupon fields
| Field | Description |
|---|---|
amount_ | A positive integer representing the amount to subtract from an invoice total (required if percent_ is not passed). |
currency | Three-letter ISO code for the currency of the amount_ parameter (required if amount_ is passed). |
duration | Specifies how long the discount is in effect if used on a subscription. Defaults to once. |
duration_ | Required only if duration is repeating, in which case it must be a positive integer that specifies the number of months the discount is in effect. |
id | ID of the object. |
max_ | A positive integer specifying the number of times the a customer can redeem a coupon before it’s no longer valid. |
metadata | Set of key-value pairs that you can attach to an object. This is useful for storing additional information about the object in a structured format. |
name | Name of the coupon displayed to customers on invoices or receipts. By default the id is shown if name isn’t set. |
percent_ | A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon applies (required if amount_ isn’t passed). |
redeem_ | Unix timestamp specifying the last time at which a customer can redeem the coupon. |
applies_ | An array of Product IDs that this coupon applies discounts to. |
currency_ | A positive integer representing the amount to subtract from an invoice total. |
currency_ | Currency option key. |
script. | The configuration values of the script. The keys and values are specific to the script implementation. |
script. | The script implementation ID for this coupon. |
Customers
This object represents a customer of your business.
resource "stripe_customer" "acme" { name = "Acme Corp" email = "billing@acme.example" }
API reference: Customers
Customer fields
| Field | Description |
|---|---|
balance | An integer amount in cents (or local equivalent) that represents the customer’s current balance. |
business_ | Business name. |
description | An arbitrary string that you can attach to a customer object. It’s displayed alongside the customer in the dashboard. |
email | Customer’s email address. It’s displayed alongside the customer in your dashboard and is useful for searching and tracking. |
id | ID of the object. |
individual_ | Individual name. |
invoice_ | The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers. |
metadata | 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 | The customer’s full name or business name. |
next_ | The sequence to be used on the customer’s next invoice. Defaults to 1. |
phone | The customer’s phone number. |
preferred_ | Customer’s preferred languages, ordered by preference. |
tax_ | The customer’s tax exemption. One of none, exempt, or reverse. |
test_ | ID of the test clock to attach to the customer. |
address. | City, district, suburb, town, or village. |
address. | Country as freeform text or a two-letter country code. |
address. | Address line 1, such as the street, PO Box, or company name. |
address. | Address line 2, such as the apartment, suite, unit, or building. |
address. | ZIP or postal code. |
address. | State, county, province, or region. |
cash_ | Controls how funds transferred by the customer are applied to PaymentIntents and invoices. Valid options are automatic, manual, or merchant_. |
invoice_ | Custom fields for invoices. |
invoice_ | ID of a payment method that’s attached to the customer, to be used as the customer’s default payment method for subscriptions and invoices. |
invoice_ | Default footer to be displayed on invoices for this customer. |
invoice_ | How line-item prices and amounts are displayed with respect to tax on invoice PDFs. One of exclude_ or include_. |
invoice_ | ID of the invoice rendering template to use for future invoices. |
shipping. | Customer name. |
shipping. | Customer phone (including extension). |
shipping. | City, district, suburb, town, or village. |
shipping. | Country as freeform text or a two-letter country code. |
shipping. | Address line 1, such as the street, PO Box, or company name. |
shipping. | Address line 2, such as the apartment, suite, unit, or building. |
shipping. | ZIP or postal code. |
shipping. | State, county, province, or region. |
tax. | Customer IP address used for tax. |
tax. | A flag that indicates when Stripe should validate the customer tax location. Defaults to deferred. |
Entitlements features
An entitlements feature represents a monetizable ability or functionality in your system.
resource "stripe_entitlements_feature" "premium_access" { lookup_key = "premium-access" name = "Premium access" }
API reference: Entitlements features
Entitlements feature fields
| Field | Description |
|---|---|
id | ID of the object. |
lookup_ | A unique key you provide as your own system identifier. This can be up to 80 characters. |
metadata | Set of key-value pairs that you can attach to an object. This is useful for storing additional information about the object in a structured format. |
name | The feature’s name, for your own purpose, not meant to be displayable to the customer. |
Products
Products describe the specific goods or services you offer to your customers.
resource "stripe_product" "gold" { name = "Gold plan" }
API reference: Products
Product fields
| Field | Description |
|---|---|
active | Whether the product is available for purchase. Defaults to true. |
description | The product’s description, meant to be displayable to the customer. |
id | ID of the object. |
images | A list of up to 8 URLs of images for this product, meant to be displayable to the customer. |
metadata | Set of key-value pairs that you can attach to an object. This is useful for storing additional information about the object in a structured format. |
name | The product’s name, meant to be displayable to the customer. |
shippable | Whether this product is shipped (physical goods). |
statement_ | An arbitrary string to be displayed on your customer’s credit card or bank statement. The statement description may not include <, >, \, \", ' characters and appear on your customer’s statement in capital letters. Non-ASCII characters are automatically stripped. It must contain at least one letter. Only used for subscription payments. |
tax_ | A tax code ID. |
type | The type of the product. Defaults to service if not explicitly specified. |
unit_ | A label that represents units of this product. |
url | A URL of a publicly-accessible webpage for this product. |
marketing_ | The marketing feature name. Up to 80 characters long. |
package_ | Height, in inches. Maximum precision is 2 decimal places. |
package_ | Length, in inches. Maximum precision is 2 decimal places. |
package_ | Weight, in ounces. Maximum precision is 2 decimal places. |
package_ | Width, in inches. Maximum precision is 2 decimal places. |
Prices
Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products.
resource "stripe_product" "gold" { name = "Gold plan" } resource "stripe_price" "gold_monthly" { product = stripe_product.gold.id currency = "usd" unit_amount = 2000 recurring { interval = "month" } }
API reference: Prices
Price fields
| Field | Description |
|---|---|
active | Whether the price can be used for new purchases. Defaults to true. |
billing_ | Describes how to compute the price per period. Either per_ or tiered. |
currency | Three-letter ISO currency code, in lowercase. Must be a supported currency. |
id | ID of the object. |
lookup_ | A lookup key used to retrieve prices dynamically from a static string. This can be up to 200 characters. |
metadata | 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. |
nickname | A brief description of the price, hidden from customers. |
product | The ID of the Product that this Price belongs to. |
tax_ | Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. |
tiers_ | Defines if the tiering price should be graduated or volume based. |
unit_ | A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. |
currency_ | Currency option key. |
currency_ | Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. |
currency_ | Each element represents a pricing tier. This parameter requires billing_ to be set to tiered. |
currency_ | A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. |
currency_ | Pass in true to enable custom_, otherwise omit custom_. |
currency_ | The maximum unit amount the customer can specify for this item. |
currency_ | The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. |
currency_ | The starting unit amount which can be updated by the customer. |
custom_ | The maximum unit amount the customer can specify for this item. |
custom_ | The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. |
custom_ | The starting unit amount which can be updated by the customer. |
recurring. | Specifies billing frequency. Either day, week, month, or year. |
recurring. | The number of intervals between subscription billings. |
recurring. | The meter tracking the usage of a metered price. |
recurring. | Default number of trial days when subscribing a customer to this price using trial_. |
recurring. | Configures how the quantity per period should be determined. Can be either metered or licensed. |
tiers. | The flat billing amount for an entire tier, regardless of the number of units in the tier. |
tiers. | Same as flat_, but accepts a decimal value representing an integer in the minor units of the currency. |
tiers. | The per unit billing amount for each individual unit for which this tier applies. |
tiers. | The maximum quantity contained in this tier. |
Shipping rates
Shipping rates describe the price of shipping presented to your customers and applied to a purchase.
resource "stripe_shipping_rate" "standard" { display_name = "Standard shipping" type = "fixed_amount" fixed_amount { amount = 500 currency = "usd" } }
API reference: Shipping rates
Shipping rate fields
| Field | Description |
|---|---|
display_ | The name of the shipping rate, meant to be displayable to the customer. |
id | ID of the object. |
metadata | 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. |
tax_ | Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. |
tax_ | A tax code ID. |
type | The type of calculation to use on the shipping rate. |
delivery_ | A unit of time. |
delivery_ | Must be greater than 0. |
delivery_ | A unit of time. |
delivery_ | Must be greater than 0. |
fixed_ | A non-negative integer in cents representing how much to charge. |
fixed_ | Three-letter ISO currency code, in lowercase. Must be a supported currency. |
fixed_ | A non-negative integer in cents representing how much to charge. |
fixed_ | Currency option key. |
fixed_ | Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified. |
Tax rates
Tax rates can be applied to invoices, subscriptions, and Checkout Sessions to collect tax.
resource "stripe_tax_rate" "state_sales_tax" { display_name = "CA Sales Tax" percentage = 7.25 inclusive = false }
API reference: Tax rates
Tax rate fields
| Field | Description |
|---|---|
active | Flag determining whether the tax rate is active or inactive (archived). |
country | Two-letter country code. |
description | An arbitrary string attached to the tax rate for your internal use only. It isn’t visible to your customers. |
display_ | The display name of the tax rate, which is shown to customers. |
id | ID of the object. |
inclusive | This specifies if the tax rate is inclusive or exclusive. |
jurisdiction | The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice. |
metadata | 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. |
percentage | This represents the tax rate percent out of 100. |
state | ISO 3166-2 subdivision code, without country prefix. |
tax_ | The high-level tax type, such as vat or sales_. |
Webhook endpoints
You can configure webhook endpoints via the API to be notified about events that happen in your Stripe account or connected accounts.
resource "stripe_webhook_endpoint" "primary" { url = "https://example.com/stripe/webhooks" enabled_events = ["payment_intent.succeeded"] }
API reference: Webhook endpoints
Webhook endpoint fields
| Field | Description |
|---|---|
api_ | Events sent to this endpoint are generated with this Stripe Version instead of your account’s default Stripe Version. |
description | Description of the webhook endpoint. |
enabled_ | The list of events to enable for this endpoint. |
id | ID of the object. |
metadata | Set of key-value pairs that you can attach to an object. This is useful for storing additional information about the object in a structured format. |
url | The URL of the webhook endpoint. |