Stripe: Create a plan
Stripe plans.postPlans: arguments, response, policy and SDK examples.
← Plans operations · Get started
Operation stripe.postplans
Provider route: POST /v1/plans. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["plans"]["postPlans"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.plans.postPlans(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_stripe import StripeIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.plans.post_plans(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | string | Optional | Minimum length: 1 Maximum length: 255 |
body | object | Required within parent | Additional keys: not allowed |
body.active | boolean | Optional | Whether the plan is currently available for new subscriptions. Defaults to `true`. |
body.amount | integer | Optional | A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis. |
body.amount_decimal | string | Optional | Same as `amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set. Format: decimal |
body.billing_scheme | string | Optional | Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. One of: per_unit, tiered |
body.currency | string | Required within parent | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
body.expand | array | Optional | Specifies which fields in the response should be expanded. |
body.expand[] | string | Each item | Maximum length: 5000 |
body.id | string | Optional | An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can use the same plan ID in live mode and in your sandboxes. Maximum length: 5000 |
body.interval | string | Required within parent | Specifies billing frequency. Either `day`, `week`, `month` or `year`. One of: day, month, week, year |
body.interval_count | integer | Optional | The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks). |
body.metadata | JSON | Optional | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
body.metadata (anyOf 1) | object | Alternative | Additional keys: see wildcard field |
body.metadata (anyOf 1).* | string | Additional keys | |
body.metadata (anyOf 2) | string | Alternative | One of: |
body.meter | string | Optional | The meter tracking the usage of a metered price Maximum length: 5000 |
body.nickname | string | Optional | A brief description of the plan, hidden from customers. Maximum length: 5000 |
body.product | JSON | Optional | |
body.product (anyOf 1) | object | Alternative | The product whose pricing the created plan will represent. This can either be the ID of an existing product, or a dictionary containing fields used to create a [service product](https://docs.stripe.com/api#product_object-type). |
body.product (anyOf 1).active | boolean | Optional | |
body.product (anyOf 1).id | string | Optional | Maximum length: 5000 |
body.product (anyOf 1).metadata | object | Optional | Additional keys: see wildcard field |
body.product (anyOf 1).metadata.* | string | Additional keys | |
body.product (anyOf 1).name | string | Required within parent | Maximum length: 5000 |
body.product (anyOf 1).statement_descriptor | string | Optional | Maximum length: 22 |
body.product (anyOf 1).tax_code | string | Optional | Maximum length: 5000 |
body.product (anyOf 1).tax_details | object | Optional | |
body.product (anyOf 1).tax_details.performance_location | string | Optional | Maximum length: 5000 |
body.product (anyOf 1).tax_details.tax_code | JSON | Optional | |
body.product (anyOf 1).tax_details.tax_code (anyOf 1) | string | Alternative | |
body.product (anyOf 1).tax_details.tax_code (anyOf 2) | string | Alternative | One of: |
body.product (anyOf 1).unit_label | string | Optional | Maximum length: 12 |
body.product (anyOf 2) | string | Alternative | The ID of the product whose pricing the created plan will represent. Maximum length: 5000 |
body.tiers | array | Optional | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
body.tiers[] | object | Each item | |
body.tiers[].flat_amount | integer | Optional | |
body.tiers[].flat_amount_decimal | string | Optional | Format: decimal |
body.tiers[].unit_amount | integer | Optional | |
body.tiers[].unit_amount_decimal | string | Optional | Format: decimal |
body.tiers[].up_to | JSON | Required within parent | |
body.tiers[].up_to (anyOf 1) | string | Alternative | One of: inf Maximum length: 5000 |
body.tiers[].up_to (anyOf 2) | integer | Alternative | |
body.tiers_mode | string | Optional | Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. One of: graduated, volume |
body.transform_usage | object | Optional | Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with `tiers`. |
body.transform_usage.divide_by | integer | Required within parent | |
body.transform_usage.round | string | Required within parent | One of: down, up |
body.trial_period_days | integer | Optional | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
body.usage_type | string | Optional | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. One of: licensed, metered |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create a plan — response body |
Referenced models: Create a plan — response body
Schemas
Section titled “Schemas”10 more schemas are linked from the tables above, on the schema pages.
Create a plan — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | You can now model subscriptions more flexibly using the [Prices API](https://docs.stripe.com/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration. Plans define the base price, currency, and billing cycle for recurring purchases of products. [Products](https://docs.stripe.com/api#products) help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme. For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year. Related guides: [Set up a subscription](https://docs.stripe.com/billing/subscriptions/set-up-subscription) and more about [products and prices](https://docs.stripe.com/products-prices/overview). |
active | boolean | Required within parent | Whether the plan can be used for new purchases. |
amount | JSON | Optional | |
amount (anyOf 1) | JSON | Alternative | |
amount (anyOf 1) (anyOf 1) | integer | Alternative | The unit amount in cents (or local equivalent) to be charged, represented as a whole integer if possible. Only set if `billing_scheme=per_unit`. |
amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
amount (anyOf 2) | null | Alternative | |
amount_decimal | JSON | Optional | |
amount_decimal (anyOf 1) | string | Alternative | The unit amount in cents (or local equivalent) to be charged, represented as a decimal string with at most 12 decimal places. Only set if `billing_scheme=per_unit`. Format: decimal |
amount_decimal (anyOf 2) | null | Alternative | |
billing_scheme | string | Required within parent | Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. Known values: per_unit, tiered |
created | JSON | Required within parent | |
created (anyOf 1) | integer | Alternative | Time at which the object was created. Measured in seconds since the Unix epoch. Format: unix-time |
created (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
currency | string | Required within parent | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
interval | string | Required within parent | The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. Known values: day, month, week, year |
interval_count | JSON | Required within parent | |
interval_count (anyOf 1) | integer | Alternative | The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. |
interval_count (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
livemode | boolean | Required within parent | If the object exists in live mode, the value is `true`. If the object exists in test mode, the value is `false`. |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | Maximum length: 500 |
metadata (anyOf 2) | null | Alternative | |
meter | JSON | Optional | |
meter (anyOf 1) | string | Alternative | The meter tracking the usage of a metered price Maximum length: 5000 |
meter (anyOf 2) | null | Alternative | |
nickname | JSON | Optional | |
nickname (anyOf 1) | string | Alternative | A brief description of the plan, hidden from customers. Maximum length: 5000 |
nickname (anyOf 2) | null | Alternative | |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: plan |
product | JSON | Optional | |
product (anyOf 1) | JSON | Alternative | The product whose pricing this plan determines. |
product (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
product (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a product — response body |
product (anyOf 1) (anyOf 3) | Model | Alternative | Expand Delete a product — response body |
product (anyOf 2) | null | Alternative | |
tiers | array | Optional | Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. |
tiers[] | Model | Each item | Expand Create a plan — response body — tiers item |
tiers_mode | JSON | Optional | |
tiers_mode (anyOf 1) | string | Alternative | Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price. In `graduated` tiering, pricing can change as the quantity grows. Known values: graduated, volume |
tiers_mode (anyOf 2) | null | Alternative | |
transform_usage | JSON | Optional | |
transform_usage (anyOf 1) | JSON | Alternative | Apply a transformation to the reported usage or set quantity before computing the amount billed. Cannot be combined with `tiers`. |
transform_usage (anyOf 1) (anyOf 1) | Model | Alternative | Expand Create a plan — response body — transform_usage / value / round: down, up |
transform_usage (anyOf 2) | null | Alternative | |
trial_period_days | JSON | Optional | |
trial_period_days (anyOf 1) | JSON | Alternative | |
trial_period_days (anyOf 1) (anyOf 1) | integer | Alternative | Default number of trial days when subscribing a customer to this plan using [`trial_from_plan=true`](https://docs.stripe.com/api#create_subscription-trial_from_plan). |
trial_period_days (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
trial_period_days (anyOf 2) | null | Alternative | |
usage_type | string | Required within parent | Configures how the quantity per period should be determined. Can be either `metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`. Known values: licensed, metered |
Referenced models: Delete a product — response body, Create a plan — response body — tiers item, Create a product — response body, Create a plan — response body — transform_usage / value / round: down, up
Delete a product — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
deleted | boolean | Required within parent | Always true for a deleted object Known values: True |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: product |
Create a plan — response body — tiers item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
flat_amount | JSON | Optional | |
flat_amount (anyOf 1) | JSON | Alternative | |
flat_amount (anyOf 1) (anyOf 1) | integer | Alternative | Price for the entire tier. |
flat_amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
flat_amount (anyOf 2) | null | Alternative | |
flat_amount_decimal | JSON | Optional | |
flat_amount_decimal (anyOf 1) | string | Alternative | Same as `flat_amount`, but contains a decimal value with at most 12 decimal places. Format: decimal |
flat_amount_decimal (anyOf 2) | null | Alternative | |
unit_amount | JSON | Optional | |
unit_amount (anyOf 1) | JSON | Alternative | |
unit_amount (anyOf 1) (anyOf 1) | integer | Alternative | Per unit price for units relevant to the tier. |
unit_amount (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
unit_amount (anyOf 2) | null | Alternative | |
unit_amount_decimal | JSON | Optional | |
unit_amount_decimal (anyOf 1) | string | Alternative | Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. Format: decimal |
unit_amount_decimal (anyOf 2) | null | Alternative | |
up_to | JSON | Optional | |
up_to (anyOf 1) | JSON | Alternative | |
up_to (anyOf 1) (anyOf 1) | integer | Alternative | Up to and including to this quantity will be contained in the tier. |
up_to (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
up_to (anyOf 2) | null | Alternative |
Create a product — response body — marketing features item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
name | string | Optional | The marketing feature name. Up to 80 characters long. Maximum length: 5000 |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.postplans. Catalog operation: PostPlans. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Stripe-Version": "2026-09-30.endive"}