Skip to content
Create account or Sign in
The Stripe Docs logo
/
Ask AI
Create accountSign in
Get started
Payments
Revenue
Platforms and marketplaces
Money management
Developer resources
APIs & SDKsHelp
Overview
Versioning
Changelog
Upgrade your API version
Upgrade your SDK version
Essentials
SDKs
API
Testing
Stripe CLI
Sample projects
Tools
Stripe Dashboard
Workbench
Developers Dashboard
Stripe Shell
Stripe for Visual Studio Code
Terraform
    Overview
    Install the Stripe Terraform provider
    Supported resources
Features
Workflows
Event Destinations
Stripe health alertsFile uploads
AI solutions
Agent toolkit
Model Context ProtocolBuild agentic AI SaaS Billing workflows
Security and privacy
Security
Stripebot web crawler
Extend Stripe
Build Stripe apps
Use apps from Stripe
Partners
Partner ecosystem
Partner certification
United States
English (United Kingdom)
HomeDeveloper resourcesTerraform

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

FieldDescription
display_nameThe meter’s name. Not visible to the customer.
event_nameThe name of the meter event to record usage for. Corresponds with the event_name field on meter events.
dimension_payload_keysSet of keys that are used to group meter events by. Each key must be present in the event payload.
event_time_windowThe time window which meter events have been pre-aggregated for, if any.
idID of the object.
customer_mapping.event_payload_keyThe key in the meter event payload to use for mapping the event to a customer.
customer_mapping.typeThe method for mapping a meter event to a customer. Must be by_id.
default_aggregation.formulaSpecifies 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_keyThe 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.

resource "stripe_coupon" "launch_discount" { name = "Launch discount" percent_off = 15 duration = "once" }

API reference: Coupons

Coupon fields

FieldDescription
amount_offA positive integer representing the amount to subtract from an invoice total (required if percent_off is not passed).
currencyThree-letter ISO code for the currency of the amount_off parameter (required if amount_off is passed).
durationSpecifies how long the discount is in effect if used on a subscription. Defaults to once.
duration_in_monthsRequired 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.
idID of the object.
max_redemptionsA positive integer specifying the number of times the a customer can redeem a coupon before it’s no longer valid.
metadataSet 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.
nameName of the coupon displayed to customers on invoices or receipts. By default the id is shown if name isn’t set.
percent_offA 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_byUnix timestamp specifying the last time at which a customer can redeem the coupon.
applies_to.productsAn array of Product IDs that this coupon applies discounts to.
currency_options.amount_offA positive integer representing the amount to subtract from an invoice total.
currency_options.keyCurrency option key.
script.configurationThe configuration values of the script. The keys and values are specific to the script implementation.
script.idThe 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

FieldDescription
balanceAn integer amount in cents (or local equivalent) that represents the customer’s current balance.
business_nameBusiness name.
descriptionAn arbitrary string that you can attach to a customer object. It’s displayed alongside the customer in the dashboard.
emailCustomer’s email address. It’s displayed alongside the customer in your dashboard and is useful for searching and tracking.
idID of the object.
individual_nameIndividual name.
invoice_prefixThe prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.
metadataSet 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.
nameThe customer’s full name or business name.
next_invoice_sequenceThe sequence to be used on the customer’s next invoice. Defaults to 1.
phoneThe customer’s phone number.
preferred_localesCustomer’s preferred languages, ordered by preference.
tax_exemptThe customer’s tax exemption. One of none, exempt, or reverse.
test_clockID of the test clock to attach to the customer.
address.cityCity, district, suburb, town or village.
address.countryCountry as freeform text or a two-letter country code.
address.line1Address line 1, such as the street, PO Box, or company name.
address.line2Address line 2, such as the apartment, suite, unit, or building.
address.postal_codeZIP or postal code.
address.stateState, county, province or region.
cash_balance.settings.reconciliation_modeControls how funds transferred by the customer are applied to PaymentIntents and invoices. Valid options are automatic, manual, or merchant_default.
invoice_settings.custom_fieldsCustom fields for invoices.
invoice_settings.default_payment_methodID 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.footerDefault footer to be displayed on invoices for this customer.
invoice_settings.rendering_options.amount_tax_displayHow 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.templateID of the invoice rendering template to use for future invoices.
shipping.nameCustomer name.
shipping.phoneCustomer phone (including extension).
shipping.address.cityCity, district, suburb, town or village.
shipping.address.countryCountry as freeform text or a two-letter country code.
shipping.address.line1Address line 1, such as the street, PO Box, or company name.
shipping.address.line2Address line 2, such as the apartment, suite, unit, or building.
shipping.address.postal_codeZIP or postal code.
shipping.address.stateState, county, province or region.
tax.ip_addressCustomer IP address used for tax.
tax.validate_locationA flag that indicates when Stripe should validate the customer tax location. Defaults to deferred.

Entitlements features

An entitlements feature represents a monetisable 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

FieldDescription
idID of the object.
lookup_keyA unique key you provide as your own system identifier. This can be up to 80 characters.
metadataSet 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.
nameThe 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

FieldDescription
activeWhether the product is available for purchase. Defaults to true.
descriptionThe product’s description, meant to be displayable to the customer.
idID of the object.
imagesA list of up to 8 URLs of images for this product, meant to be displayable to the customer.
metadataSet 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.
nameThe product’s name, meant to be displayable to the customer.
shippableWhether this product is shipped (physical goods).
statement_descriptorAn 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_codeA tax code ID.
typeThe type of the product. Defaults to service if not explicitly specified.
unit_labelA label that represents units of this product.
urlA URL of a publicly-accessible webpage for this product.
marketing_features.nameThe marketing feature name. Up to 80 characters long.
package_dimensions.heightHeight, in inches. Maximum precision is 2 decimal places.
package_dimensions.lengthLength, in inches. Maximum precision is 2 decimal places.
package_dimensions.weightWeight, in ounces. Maximum precision is 2 decimal places.
package_dimensions.widthWidth, 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

FieldDescription
activeWhether the price can be used for new purchases. Defaults to true.
billing_schemeDescribes how to compute the price per period. Either per_unit or tiered.
currencyThree-letter ISO currency code, in lowercase. Must be a supported currency.
idID of the object.
lookup_keyA lookup key used to retrieve prices dynamically from a static string. This can be up to 200 characters.
metadataSet 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.
nicknameA brief description of the price, hidden from customers.
productThe ID of the Product that this Price belongs to.
tax_behaviourSpecifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified.
tiers_modeDefines if the tiering price should be graduated or volume based.
unit_amountA positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
currency_options.keyCurrency option key.
currency_options.tax_behaviorSpecifies whether the price is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified.
currency_options.tiersEach element represents a pricing tier. This parameter requires billing_scheme to be set to tiered.
currency_options.unit_amountA positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
currency_options.custom_unit_amount.enabledPass in true to enable custom_unit_amount, otherwise omit custom_unit_amount.
currency_options.custom_unit_amount.maximumThe maximum unit amount the customer can specify for this item.
currency_options.custom_unit_amount.minimumThe minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount.
currency_options.custom_unit_amount.presetThe starting unit amount which can be updated by the customer.
custom_unit_amount.maximumThe maximum unit amount the customer can specify for this item.
custom_unit_amount.minimumThe minimum unit amount the customer can specify for this item. Must be at least the minimum charge amount.
custom_unit_amount.presetThe starting unit amount which can be updated by the customer.
recurring.intervalSpecifies billing frequency. Either day, week, month, or year.
recurring.interval_countThe number of intervals between subscription billings.
recurring.meterThe meter tracking the usage of a metered price.
recurring.trial_period_daysDefault number of trial days when subscribing a customer to this price using trial_from_plan=true.
recurring.usage_typeConfigures how the quantity per period should be determined. Can be either metered or licensed.
tiers.flat_amountThe flat billing amount for an entire tier, regardless of the number of units in the tier.
tiers.flat_amount_decimalSame as flat_amount, but accepts a decimal value representing an integer in the minor units of the currency.
tiers.unit_amountThe per unit billing amount for each individual unit for which this tier applies.
tiers.up_toThe 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

FieldDescription
display_nameThe name of the shipping rate, meant to be displayable to the customer.
idID of the object.
metadataSet 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_behaviourSpecifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of inclusive, exclusive, or unspecified.
tax_codeA tax code ID.
typeThe type of calculation to use on the shipping rate.
delivery_estimate.maximum.unitA unit of time.
delivery_estimate.maximum.valueMust be greater than 0.
delivery_estimate.minimum.unitA unit of time.
delivery_estimate.minimum.valueMust be greater than 0.
fixed_amount.amountA non-negative integer in cents representing how much to charge.
fixed_amount.currencyThree-letter ISO currency code, in lowercase. Must be a supported currency.
fixed_amount.currency_options.amountA non-negative integer in cents representing how much to charge.
fixed_amount.currency_options.keyCurrency option key.
fixed_amount.currency_options.tax_behaviorSpecifies 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

FieldDescription
activeFlag determining whether the tax rate is active or inactive (archived).
countryTwo-letter country code.
descriptionAn arbitrary string attached to the tax rate for your internal use only. It isn’t visible to your customers.
display_nameThe display name of the tax rate, which is shown to customers.
idID of the object.
inclusiveThis specifies if the tax rate is inclusive or exclusive.
jurisdictionThe jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer’s invoice.
metadataSet 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.
percentageThis represents the tax rate percent out of 100.
stateISO 3166-2 subdivision code, without country prefix.
tax_typeThe 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.

resource "stripe_webhook_endpoint" "primary" { url = "https://example.com/stripe/webhooks" enabled_events = ["payment_intent.succeeded"] }

API reference: Webhook endpoints

Webhook endpoint fields

FieldDescription
api_versionEvents sent to this endpoint are generated with this Stripe Version instead of your account’s default Stripe Version.
descriptionDescription of the webhook endpoint.
enabled_eventsThe list of events to enable for this endpoint.
idID of the object.
metadataSet 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.
urlThe URL of the webhook endpoint.
Was this page helpful?
YesNo
  • Need help? Contact Support.
  • Check out our changelog.
  • Questions? Contact Sales.
  • LLM? Read llms.txt.
  • Powered by Markdoc