# 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. ```hcl 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](https://docs.stripe.com/api/billing/meter.md) ### Billing meter fields | Field | Description | | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `display_name` | The meter’s name. Not visible to the customer. | | `event_name` | The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events. | | `dimension_payload_keys` | Set of keys that are used to group meter events by. Each key must be present in the event payload. | | `event_time_window` | The time window which meter events have been pre-aggregated for, if any. | | `id` | ID of the object. | | `customer_mapping.event_payload_key` | The key in the meter event payload to use for mapping the event to a customer. | | `customer_mapping.type` | The method for mapping a meter event to a customer. Must be `by_id`. | | `default_aggregation.formula` | 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_settings.event_payload_key` | 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_used` 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. ```hcl resource "stripe_coupon" "launch_discount" { name = "Launch discount" percent_off = 15 duration = "once" } ``` API reference: [Coupons](https://docs.stripe.com/api/coupons.md) ### Coupon fields | Field | Description | | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `amount_off` | A positive integer representing the amount to subtract from an invoice total (required if `percent_off` isn’t passed). | | `currency` | Three-letter ISO code for the currency of the `amount_off` parameter (required if `amount_off` is passed). | | `duration` | Specifies how long the discount is in effect if used on a subscription. Defaults to `once`. | | `duration_in_months` | 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_redemptions` | 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. You can use it to store 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_off` | A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon applies (required if `amount_off` isn’t passed). | | `redeem_by` | Unix timestamp specifying the last time at which a customer can redeem the coupon. | | `applies_to.products` | An array of Product IDs that this coupon applies discounts to. | | `currency_options.amount_off` | A positive integer representing the amount to subtract from an invoice total. | | `currency_options.key` | Three-letter [ISO currency code](https://docs.stripe.com/currencies.md), in lowercase (for example, `usd`, `eur`). Specifies the currency for the `amount_off` value. | | `script.configuration` | The configuration values of the script. The keys and values are specific to the script implementation. | | `script.id` | The script implementation ID for this coupon. | ## Customers This object represents a customer of your business. ```hcl resource "stripe_customer" "acme" { name = "Acme Corp" email = "billing@acme.example" } ``` API reference: [Customers](https://docs.stripe.com/api/customers.md) ### Customer fields | Field | Description | | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `balance` | An integer amount in cents (or local equivalent) that represents the customer’s current balance. | | `business_name` | 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 displays alongside the customer in your dashboard and you can use it for searching and tracking. | | `id` | ID of the object. | | `individual_name` | Individual name. | | `invoice_prefix` | 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_invoice_sequence` | The sequence to be used on the customer’s next invoice. Defaults to 1. | | `phone` | The customer’s phone number. | | `preferred_locales` | Customer’s preferred languages, ordered by preference. | | `tax_exempt` | The customer’s tax exemption. One of `none`, `exempt`, or `reverse`. | | `test_clock` | ID of the test clock to attach to the customer. | | `address.city` | City, district, suburb, town, or village. | | `address.country` | Country as freeform text or a two-letter country code. | | `address.line1` | Address line 1, such as the street, PO Box, or company name. | | `address.line2` | Address line 2, such as the apartment, suite, unit, or building. | | `address.postal_code` | ZIP or postal code. | | `address.state` | State, county, province, or region. | | `cash_balance.settings.reconciliation_mode` | Controls how funds transferred by the customer are applied to PaymentIntents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. | | `invoice_settings.custom_fields` | Custom fields for invoices. | | `invoice_settings.default_payment_method` | 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_settings.footer` | Default footer to be displayed on invoices for this customer. | | `invoice_settings.rendering_options.amount_tax_display` | How line-item prices and amounts are displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. | | `invoice_settings.rendering_options.template` | ID of the invoice rendering template to use for future invoices. | | `shipping.name` | Customer name. | | `shipping.phone` | Customer phone (including extension). | | `shipping.address.city` | City, district, suburb, town, or village. | | `shipping.address.country` | Country as freeform text or a two-letter country code. | | `shipping.address.line1` | Address line 1, such as the street, PO Box, or company name. | | `shipping.address.line2` | Address line 2, such as the apartment, suite, unit, or building. | | `shipping.address.postal_code` | ZIP or postal code. | | `shipping.address.state` | State, county, province, or region. | | `tax.ip_address` | Customer IP address used for tax. | | `tax.validate_location` | 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. ```hcl resource "stripe_entitlements_feature" "premium_access" { lookup_key = "premium-access" name = "Premium access" } ``` API reference: [Entitlements features](https://docs.stripe.com/api/entitlements/feature.md) ### Entitlements feature fields | Field | Description | | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ | | `id` | ID of the object. | | `lookup_key` | 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. You can use it to store 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. ```hcl resource "stripe_product" "gold" { name = "Gold plan" } ``` API reference: [Products](https://docs.stripe.com/api/products.md) ### 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. You can use it to store 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_descriptor` | An arbitrary string to be displayed on your customer’s credit card or bank statement. The statement description might 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_code` | A tax code ID. | | `type` | The type of the product. Defaults to `service` if not explicitly specified. | | `unit_label` | A label that represents units of this product. | | `url` | A URL of a publicly-accessible webpage for this product. | | `marketing_features.name` | The marketing feature name. Up to 80 characters long. | | `package_dimensions.height` | Height, in inches. Maximum precision is 2 decimal places. | | `package_dimensions.length` | Length, in inches. Maximum precision is 2 decimal places. | | `package_dimensions.weight` | Weight, in ounces. Maximum precision is 2 decimal places. | | `package_dimensions.width` | 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. ```hcl 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](https://docs.stripe.com/api/prices.md) ### Price fields | Field | Description | | --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `active` | Whether the price can be used for new purchases. Defaults to `true`. | | `billing_scheme` | Describes how to compute the price per period. Either `per_unit` or `tiered`. | | `currency` | Three-letter ISO currency code, in lowercase. Must be a supported currency. | | `id` | ID of the object. | | `lookup_key` | 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_behavior` | Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. | | `tiers_mode` | Defines if the tiering price should be `graduated` or `volume` based. | | `unit_amount` | A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. | | `currency_options.key` | Three-letter [ISO currency code](https://docs.stripe.com/currencies.md), in lowercase (for example, `usd`, `eur`). Specifies the currency for the pricing options in this entry. | | `currency_options.tax_behavior` | Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. | | `currency_options.tiers` | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. | | `currency_options.unit_amount` | A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. | | `currency_options.custom_unit_amount.enabled` | Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. | | `currency_options.custom_unit_amount.maximum` | The maximum unit amount the customer can specify for this item. | | `currency_options.custom_unit_amount.minimum` | The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. | | `currency_options.custom_unit_amount.preset` | The starting unit amount which can be updated by the customer. | | `custom_unit_amount.maximum` | The maximum unit amount the customer can specify for this item. | | `custom_unit_amount.minimum` | The minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount. | | `custom_unit_amount.preset` | The starting unit amount which can be updated by the customer. | | `recurring.interval` | Specifies billing frequency. Either `day`, `week`, `month`, or `year`. | | `recurring.interval_count` | The number of intervals between subscription billings. | | `recurring.meter` | The meter tracking the usage of a metered price. | | `recurring.trial_period_days` | Default number of trial days when subscribing a customer to this price using `trial_from_plan=true`. | | `recurring.usage_type` | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. | | `tiers.flat_amount` | The flat billing amount for an entire tier, regardless of the number of units in the tier. | | `tiers.flat_amount_decimal` | Same as `flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. | | `tiers.unit_amount` | The per unit billing amount for each individual unit for which this tier applies. | | `tiers.up_to` | The maximum quantity contained in this tier. | ## Promotion codes A promotion code represents a customer-redeemable code for an underlying promotion. You can create multiple codes for a single promotion. If you enable promotion codes in your [customer portal configuration](https://docs.stripe.com/customer-management/configure-portal.md), then customers can redeem a code themselves when updating a subscription in the portal. ```hcl resource "stripe_coupon" "summer_sale" { name = "Summer Sale" percent_off = 20 duration = "once" } resource "stripe_promotion_code" "summer20" { code = "SUMMER20" promotion { type = "coupon" coupon = stripe_coupon.summer_sale.id } restrictions { first_time_transaction = true minimum_amount = 5000 minimum_amount_currency = "usd" currency_options { key = "eur" minimum_amount = 4500 } } } ``` API reference: [Promotion codes](https://docs.stripe.com/api/promotion_codes.md) ### Promotion code fields | Field | Description | | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `active` | Whether the promotion code is currently active. | | `code` | The customer-facing code that’s unique (regardless of case) across all active promotion codes for a specific customer. Stripe generates a value if you don’t provide one. Valid characters include: - Lower case letters (a-z) - Upper case letters (A-Z) - Digits (0-9) | | `customer` | The customer who can use this promotion code. Omit this value to make the promotion code available to all customers. | | `customer_account` | The customer-configured account that can use this promotion. Omit this value to make the promotion code available to all customer-configured accounts. | | `expires_at` | The timestamp when this promotion code expires. This value must be before the coupon’s `redeems_by` value, if set. | | `id` | The promotion code object’s unique ID, automatically generated by Stripe. This is a read-only value. | | `max_redemptions` | A positive integer specifying the number of times customers can redeem the promotion code. This value must be equal to or less than the coupon’s `max_redemptions`, if set. | | `metadata` | A set of key-value pairs you can define to store additional information with the promotion code and use in other actions. | | `promotion.coupon` | If promotion `type` is `coupon`, the coupon for this promotion code. | | `promotion.type` | Specifies the type of promotion. | | `restrictions.first_time_transaction` | Whether or not only customers without any successful payments or invoices can redeem the promotion code. | | `restrictions.minimum_amount` | The minimum purchase amount required to redeem this promotion code. | | `restrictions.minimum_amount_currency` | The three-letter [ISO code](https://docs.stripe.com/currencies.md)representing the `minimum_amount` currency. | | `restrictions.currency_options.key` | The three-letter, lower-case [ISO currency code](https://docs.stripe.com/currencies.md) (for example, `usd` or `eur`) identifying a currency that has its own restrictions. | | `restrictions.currency_options.minimum_amount` | An alternative minimum purchase amount required to redeem this promotion code for purchases in the currency specified by `key`. | ## Shipping rates Shipping rates describe the price of shipping presented to your customers and applied to a purchase. ```hcl resource "stripe_shipping_rate" "standard" { display_name = "Standard shipping" type = "fixed_amount" fixed_amount { amount = 500 currency = "usd" } } ``` API reference: [Shipping rates](https://docs.stripe.com/api/shipping_rates.md) ### Shipping rate fields | Field | Description | | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `display_name` | 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_behavior` | Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. | | `tax_code` | A tax code ID. | | `type` | The type of calculation to use on the shipping rate. | | `delivery_estimate.maximum.unit` | A unit of time. | | `delivery_estimate.maximum.value` | Must be greater than 0. | | `delivery_estimate.minimum.unit` | A unit of time. | | `delivery_estimate.minimum.value` | Must be greater than 0. | | `fixed_amount.amount` | A non-negative integer in cents representing how much to charge. | | `fixed_amount.currency` | Three-letter ISO currency code, in lowercase. Must be a supported currency. | | `fixed_amount.currency_options.amount` | A non-negative integer in cents representing how much to charge. | | `fixed_amount.currency_options.key` | Three-letter [ISO currency code](https://docs.stripe.com/currencies.md), in lowercase (for example, `usd`, `eur`). Specifies the currency for the `amount` value in this entry. | | `fixed_amount.currency_options.tax_behavior` | 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. ```hcl resource "stripe_tax_rate" "state_sales_tax" { display_name = "CA Sales Tax" percentage = 7.25 inclusive = false } ``` API reference: [Tax rates](https://docs.stripe.com/api/tax_rates.md) ### 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_name` | 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_type` | The high-level tax type, such as `vat` or `sales_tax`. | ## Webhook endpoints You can configure webhook endpoints via the API to be notified about events that happen in your Stripe account or connected accounts. ```hcl resource "stripe_webhook_endpoint" "primary" { url = "https://example.com/stripe/webhooks" enabled_events = ["payment_intent.succeeded"] } ``` API reference: [Webhook endpoints](https://docs.stripe.com/api/webhook_endpoints.md) ### Webhook endpoint fields | Field | Description | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | `api_version` | 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_events` | 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. You can use it to store additional information about the object in a structured format. | | `url` | The URL of the webhook endpoint. | ## Event destinations Set up an event destination to receive events from Stripe across multiple destination types, including webhook endpoints and Amazon EventBridge. Event destinations support filtering by event type and routing from connected accounts. ```hcl resource "stripe_v2_core_event_destination" "primary" { name = "Primary webhook" type = "webhook_endpoint" event_payload = "snapshot" enabled_events = ["v1.payment_intent.succeeded"] webhook_endpoint { url = "https://example.com/stripe/webhooks" } } ``` API reference: [Event destinations](https://docs.stripe.com/api/v2/core/event_destinations.md) ### Event destination fields | Field | Description | | ----------------------------------- | ---------------------------------------------------------------------------------------- | | `enabled_events` | The list of events to enable for this destination. | | `event_payload` | Payload type of events being subscribed to. | | `name` | Event destination name. | | `type` | Event destination type. | | `amazon_eventbridge.aws_account_id` | The AWS account ID. It’s required if the `type` is `amazon_eventbridge`. | | `amazon_eventbridge.aws_region` | The region of the AWS event source. It’s required if the `type` is `amazon_eventbridge`. | | `description` | An optional description of what the event destination is used for. | | `events_from` | Where events should be routed from. | | `id` | ID of the object. | | `metadata` | Metadata. | | `snapshot_api_version` | If using the snapshot event payload, the API version events are rendered as. | | `webhook_endpoint.url` | The URL of the webhook endpoint. It’s required if the `type` is `webhook_endpoint`. |